Serial communication in different modes

I'm implementing communication with an MCU via UART. There are two types of communication – messages, and MCU DFU data. Messages are <256 bytes of data. MCU DFU is >50kb data and is already implemented on the MCU using XModem. When a DFU start message is sent to the MCU from the nRF, the protocol will switch to Xmodem and the nRF will send the MCU DFU data.

We have chosen MIN as the wire protocol for messages as a reliable transport. The MIN C API works as follows:

  • RX: on data received, pass a variable length data buffer to min_poll
  • TX: min_tx_space callback to return available buffer length, min_tx_start, min_tx_byte (multiple calls), and min_tx_finished callbacks to send data

The XModem API works as follows:

  • RX: callback to receive a single byte with timeout
  • TX: callback to send a single byte with timeout

I need to implement these on the nRF. After evaluating the myriad of libraries (UART, UARTE, Serial, libuarte) it seems nrf_libuarte_async is most appropriate for the MIN messages, is this correct?

How can I switch from this async mode of operation to a synchronous mode of operation with XModem?

Parents Reply Children