Question about uart configurations for nRF52832 and nRF52840

Dear ,

I am currently testing the UART peripheral on nRF52832 and nRF52840 using nRF Connect SDK.

Basically, I have a sensor that continues sending out data via uart and I would like to use the uart peripheral to receive and parse the data packets. I checked the sample code provided as lpuart, but still have a few questions.

In the devicetree setup for the uart, there are REQ pin and RDY pin. Are these pins always compulsory for using lpuart? Can I use uart without configure these two pins, i.e. using only tx and rx pins?

As to the application I mentioned above, how can I set up an interrupt-driven process which will analyze each incoming byte once it's received?

If you could kindly provide a few advice and directions, it will be very helpful.

Thank you so much for your help and assistance.

Kind regards, Kevin

  • Dear Kenneth,

    Thanks a lot for the attached example.

    In the overlay file, the rx-pull-up keeps giving out the warning, saying property not mentioned in "nordic, nrf-uarte".

    Did I miss anything here?

    In addition, when calling uart_fifo_read and uart_fifo_fill, does it mean that I've been using the DMA with the UART peripheral? If not, how could I configure the current uart setup with DMA enabled?

    Thanks a lot.

    Kind regards, Kevin

  • pigno5e said:
    In the overlay file, the rx-pull-up keeps giving out the warning, saying property not mentioned in "nordic, nrf-uarte".

    The project was made for an older NCS, they might have changed something, in any case it can be removed, make sure that the RX pin is high level (e.g. controlled by external IC and/or pull-up, if it's left floating it will cause many framing errors).

    pigno5e said:
    In addition, when calling uart_fifo_read and uart_fifo_fill, does it mean that I've been using the DMA with the UART peripheral? If not, how could I configure the current uart setup with DMA enabled?

    I suggest t check out the uart api documentation, hopefully explained there:
    https://docs.zephyrproject.org/latest/reference/peripherals/uart.html 

  • Dear Kenneth,

    Thank you so much for your info. I will check the link which contains detailed info about using UART with DMA.

    While testing with the current setup and the code, I found that having a number larger than 1 for the buffer size in the uart_fifo_fill(..,..,size_t size) function doesn't make any difference, i.e. only the last byte in the buffer can be sent out and kept looping back.

    uart_fifo_fill(uart,"sx",2);

    I replaced line 25 with the above code and only observed the ASCII hex of x on the oscilloscope. It seems the FIFO depth is 1 and is regardless of the number I put here. 

    Did I miss any configurations here? I am using nrf52dk_nrf52832 and uart0 is binding as the uart device with below setups in the prj.conf 

    CONFIG_UART_INTERRUPT_DRIVEN=y
    
    CONFIG_CONSOLE=n
    CONFIG_UART_CONSOLE=n

    Thanks again for your kind assistance.

    Kind regards, Kevin

Related