When running SLM on nrf91, it sends "Ready\r\n" over UART on boot/reset. On nrf54, we use "Ready" to detect reboots and rerun the setup. However, when the modem reboots, sometimes it has a prefix character in front of "Ready" (see log below, prefix c0), which breaks modem handler parsing. This doesn't always happen and the character varies, which leads me to believe it's UART noise while SLM is booting up.
[00:00:04.346,176] <dbg> modem_cmd_handler: cmd_handler_process_rx_buf: RECV c0 52 65 61 64 79 |.Ready
What has worked for us is changing SLM_SYNC_STR to include \r\n before it. This way any garbage gets flushed out by the handler on nrf54, and "Ready" is parsed correctly.
#define SLM_SYNC_STR "\r\nReady\r\n"
[00:00:40.903,648] <dbg> modem_cmd_handler: cmd_handler_process_rx_buf: RECV ff |. [00:00:40.903,712] <dbg> modem_cmd_handler: cmd_handler_process_rx_buf: RECV 52 65 61 64 79 |Ready [00:00:40.903,712] <dbg> modem_cmd_handler: cmd_handler_process_rx_buf: match cmd [Ready] (len:5)
If this solution makes sense, please incorporate into `ncs-serial-modem` repo. If not, I'd be interested in other settings that could fix this issue. Or if there is a better way to detect SLM reboot, I'm open to suggestions.
Thanks,
Konstantin