Sharing UART between DFU & APP

I am using the UART to perform serial DFU on nRF52832. I got it to work fine using nRF Connect SDK 1.8.0.

Now, I need to pass some serial data to the APP when not in DFU mode. I am using:

# Enable the serial mcumgr transport.
CONFIG_MCUMGR_SMP_UART=y

# Enable console with mcumgr pass through
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_CONSOLE_MCUMGR=y
I can't find a way to get the APP to read the UART receiver successfully.
I have tried to check the UART using: uart_poll_in(uart_dev, uart_buffer) but it always returns -1 even though normal ASCII data (not DFU data) is being sent serially to the nRF chip.
I don't want to use the "SHELL" module, as it is an overkill for my application.
How do you share the UART between SMP & APP, i.e. how should the UART be initialized and accessed by the APP without breaking the serial DFU capability?
Parents
  • Hi,

    The mcumgr is part of the application as well (and not the bootloader), and you cannot use a single UART instance for two separate things at the same time. Do you only need the other UART for debugging? If so, the most straightforward would be do avoid UART for that, and use RTT instead.

  • I don't need the UART for debugging.

    I need to use the UART to communicate between a simple nRF52832 module and another Wi-Fi module on regular basis.

    Now, if the need arises, the Wi-Fi module can perform the DFU operation on the nRF chip to update its App. But this is a rare operation, and when this update becomes required, the App would relinquish the UART to the mcumgr to finish the DFU operation.

    I am thinking, since it is possible to share the UART between the SHELL and DFU subsystems, as indicated in the SMP-SVR sample (via CONFIG_MCUMGR_SMP_SHELL=y), how can I get such sharing without using SHELL?

    Thanks.

Reply
  • I don't need the UART for debugging.

    I need to use the UART to communicate between a simple nRF52832 module and another Wi-Fi module on regular basis.

    Now, if the need arises, the Wi-Fi module can perform the DFU operation on the nRF chip to update its App. But this is a rare operation, and when this update becomes required, the App would relinquish the UART to the mcumgr to finish the DFU operation.

    I am thinking, since it is possible to share the UART between the SHELL and DFU subsystems, as indicated in the SMP-SVR sample (via CONFIG_MCUMGR_SMP_SHELL=y), how can I get such sharing without using SHELL?

    Thanks.

Children
Related