Hi All,
I'd like to init two uart in nRF52840.
However, i don't know how to init the 2nd uart.
Is there any example about that?
Thanks.
Hi All,
I'd like to init two uart in nRF52840.
However, i don't know how to init the 2nd uart.
Is there any example about that?
Thanks.
I think this is quite straight forward, could you try something like this:
...
...
#define UART_0 DT_LABEL(DT_NODELABEL(uart0))
#define UART_1 DT_LABEL(DT_NODELABEL(uart1))
static const struct device *uart_dev_0;
static const struct device *uart_dev_1;
void main(void)
{
...
uart_dev_0 = device_get_binding(UART_0);
uart_dev_1 = device_get_binding(UART_1);
...
//Now use uart_dev_0 with the UART API to control UART0
//and use uart_dev_1 with the UART API to control UART1
...
}
I haven't tested this, so let me know if you encounter any issues.
Best regards,
Simon
Oh, it seems like you're using the nRF5 SDK, correct? My advice was for the nRF Conect SDK
For new products I would recommend you to use the nRF Connect SDK, see nRF Connect SDK and nRF5 SDK statement
Best regards,
Simon
Hi Simon,
Yes, I'm using "nRF5_SDK_17.1.0" with "SEGGER Embedded Studio".
Would you share some information about the development of 2 uart?
Thanks.
It's several years since last time I looked at the nRF5 SDK, but I'll try to help you. Could you take a look at RF52840 Two instances of UART/UARTE
Best regards,
Simon