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

Need UART driver for nrf52840 with DMA and Interrupt modes.

Hi Team,

One of my application needs the UART driver in both Interrupt and DMA mode for more data bytes transfer. No need of timeout operation or polling mode.

Can any body have an idea on which is the best driver for my requirement. I have some doubts on UART Layers.

1. Need the driver which will not interrupt the BLE Events and SD operation.

2. What is the difference between UART and UARTE as part of initialization.

3. Difference between UART driver and Serial driver.

4. If we are going to use the interrupt mode , we will get interrupt for every byte transfer or receive. In DMA mode we will only get interrupt after transfer of bulk data. on this point please correct me if i am wrong.

Regards,

Srinivas.V

Parents
  • Hi Srinivas,

    2. What is the difference between UART and UARTE as part of initialization.

    The UART peripheral does not have DMA. The UARTE peripheral has DMA.

    1. Need the driver which will not interrupt the BLE Events and SD operation.

    You probably want to use the UARTE peripheral. If using the legacy driver or one of the libraries based on it, you select between UART and UARTE based on if you configure DMA enabled or not in sdk_config.h. If you refer to the UART example, you can see that UART_EASY_DMA_SUPPORT is enabled by default in sdk_config.h, which in turn means that DMA is used.

    3. Difference between UART driver and Serial driver.

    The serial library is a library build on top of the UART driver. That has been deprecated in SDK 17 and is now replaced by the libUARTE library. Depending on your needs you may stick with the UART driver or the libUARTE library

    4. If we are going to use the interrupt mode , we will get interrupt for every byte transfer or receive. In DMA mode we will only get interrupt after transfer of bulk data. on this point please correct me if i am wrong.

    You can get interrupts in any case, so this is not related to DMA or not. Normally you separate between blocking and non-blocking, where with blocking modes you don't have interrupts, or at least the driver hides it from the user. But for a real product you typically always want non-blocking and interrupts, so that the CPU can sleep or do other tasks while waiting for the UART transaction to finish. Similarly, there are few good reasons for not using DMA, as that frees up more time for the CPU as it will get an interrupt once the transaction is completed (the specified number of bytes are transferred) instead of for every single byte.

    In general, the SoftDevice has some timing requirements meaning it normally needs to have the highest interrupt priority. Therefor it makes sense to use flow control for the UART even if you use DMA, as any delay in handling the UART will not cause loss of UART Rx data in that case.

    Br,

    Einar

  • Hello, @Einar Thorsrud.

    It makes sense to benefit from UART flow control in order to avoid data loss.

    If we use UART with flow control, do we need to handle RTS output in our application, or the module will automatically stop UART data transfer (setting RTS high) every time some higher priority interrupt occurs?

    Cheers,

    Bojan.

  • Hi Bojan,

    The driver handles flow control for you as long as you enable it.

    Einar

  • Thanks, Einar, that's great!

    I had a hard time merging libuarte example in the project that contains SoftDevice and app_timer. You can see here the details of my issue.

    Do you have any idea what I am doing woring?

    Regards,

    Bojan.

  • Hi Bojan,

    I see you found a solution and wrote an excellent explanation in the other thread. If there are any updates later I suggest you continue in that one.

    Einar

Reply Children
No Data
Related