This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use two serial uartes

Hi all,

Please refer to the SDK version : nRF5_SDK_15.2.0_9412b96.

We need to use two uarts simultaneously for module & device respectively.

For example :

UARTE0 : Device (Agreed protocol - RX/TX only) 

UARTE1 : Module (AT command - RX/TX only) 

We are using "\examples\peripheral\serial_uartes" for reference code, but have few problems.

UARTE0 & UARTE1 should receive input data by interrupt handler. (nrfx_uarte_0_irq_handler(), nrfx_uarte_1_irq_handler() from nrfx_uarte.c)

However, we can't get data from both uarts simultaneously because of "nrf_serial_read()" function timeout inside while of Main.c.

We want to get single character once "nrfx_uarte_0_irq_handler() or nrfx_uarte_1_irq_handler()" is being called, and save it to our data variables respectively.

And then exectue when we get desire input by checking "run_command_0() or run_command_1()"  function that we made inside while.

Once we remove "nrf_serial_read()" function inside while we get "NRF_UARTE_EVENT_ERROR" after short amout of UART RX data input.

In conclusion, we would like to get recommendation or suggestion about using two UARTES simultaneously (UARTE0 RX/TX, UARTE1 RX/TX).

If you have an example plesase share us.

Your help will be highly appreciated.

Thank you

Parents Reply Children
No Data
Related