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:
The XModem API works as follows:
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?
Hi,To me it looks like the nrf_libuarte_async is a good fit for your use case and the MIN protocol, since messages are sent async and the MIN protocol supports messages of different length.
I am not sure I understand what you mean when you say you would like to switch to synchronous operation. To me it looks like the synchronous operation required by the XModem protocol is something that must be implemented in your application. Since you know the amount of bytes being sent and (N)ACKs returned it sounds like you can manage without the async timeout handling while in MCU DFU mode. It is possible to uninit the libarute_async and initialize e.g. the libarte_drv lib, then switch back to libuarte_async when done in the MCU DFU mode.
Thanks, I’ll have a go at this.
Is there an example using libuarte with RTC and timer instead of app timer? It's hitting the ASSERT in nrfx_timer.c:143
m_cb[p_instance->instance_id].state == NRFX_DRV_STATE_INITIALIZED
I was calling nrf_libuarte_async_enable twice, there should probably be a check in nrf_libuarte_async_enable for this.
Bug report: In nrf_libuarte_async.c, line 389.
Prints lowest priority as APP_IRQ_PRIORITY_LOW, but if app_timer is used then lowest priority is APP_TIMER_CONFIG_IRQ_PRIORITY - 1