Hello All,
I am trying to set up the ASYNC UART and I am getting the following error:
-ENOSYS: If configuration is not supported by the device or driver does not support setting configuration at runtime
To my understanding Noridc supports the Asyn UART which should include the Seeed Xiao sense nrf52480. Correct me if I am wrong?
Furthermore, nordic has a tutorial on how to use this UART configuartion so I am not sure why I am getting this error when I try to implement it.
What is the issue?
What else can I check to find the cause of this issue?
Any insights are much appreciated.
The following is the code that is relevant before the error:
Function called:
int configUART(const struct device *uart){
if (!device_is_ready(uart)) {
return -ENODEV;
}
const struct uart_config uart_cfg = {
.baudrate = 9600,
.parity = UART_CFG_PARITY_NONE,
.stop_bits = UART_CFG_STOP_BITS_1,
.data_bits = UART_CFG_DATA_BITS_8,
.flow_ctrl = UART_CFG_FLOW_CTRL_NONE
};
int err = uart_configure(uart, &uart_cfg);
if (err < 0) {
return err;
}
return 0;
};
Main file code to start the uart
//----------------------UART INIT--------------------------//
const struct device *uart = DEVICE_DT_GET(DT_NODELABEL(uart0));
if (!uart) {
LOG_ERR("Unable to get the UART binding");
return -1;
}
err = configUART(uart);
if (err < 0){
LOG_ERR("ERROR Configuring UART: %d", err);
Device tree overlay set up:
&uart0{
current-speed = <9600>;
};
Hi there,
So just taking a wild guess I would look to the Board config(device tree), or the Overlay and be sure the Uart is set up and enabled.
HTH
GL PJ
Hey PJ:
I think I got the device tree correctly configured:
This is the default configuration in the xio_ble_common.dtsi:
&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
Below is the pin default pin control:
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 1, 11)>;
};
group2 {
psels = <NRF_PSEL(UART_RX, 1, 12)>;
bias-pull-up;
};
};
uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_TX, 1, 11)>,
<NRF_PSEL(UART_RX, 1, 12)>;
low-power-enable;
};
};
This is my overlay code:
&uart0 {
current-speed = <9600>;
};
I used an overlay because I needed to adjust the baud rate.
Is there anything else I need to do with the UART overlays?
I have done some more leg work and have found that the errors are compiling form similar structures as like the below:
static inline int z_impl_uart_configure(const struct device *dev,
const struct uart_config *cfg)
{
#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE
const struct uart_driver_api *api =
(const struct uart_driver_api *)dev->api;
**if (api->configure == NULL) {**
** return -ENOSYS;**
}
return api->configure(dev, cfg);
#else
ARG_UNUSED(dev);
ARG_UNUSED(cfg);
return -ENOTSUP;
#endif
}
the api->configure value is null.
Upon finding this out I thought the async uart method would not be compatible but when looking at the devicetree set up for the uart the underlying nordic, nrf-uart-common.yaml file states that the Nordic nRF family UART is working with EasyDMA which is a prerequisite for using the async functionality.
Are there more setup that I need to do?
The tutorial by Nordic do not state otherwise.