I am prototyping a mesh network with the PCA10056 (52840 DK). I have one node programmed with the serial_nrf52830_xxAA project (from the Mesh 2.1.1 SDK) that implements a serial interface into a the mesh network. I have things generally working but noticed that the protocol to send/recieve serial packets could benefit from some additional robustness. Based upon the source code and the documentation here:
I noticed that there is no framing / synchronization bytes to mark the start of a packet. It is very easy to "break" the interactive python shell or the the firmware with unexpected bytes. Once the embedded serial application or the host software lose synchronization, it is nearly impossible to gracefully recover as each packet starts with a length and opcode.
I will be modifying the serial example to include a simple synchronization pattern (i.e. 4 known bytes such as 0xDEADBEEF) so the decoders on either end can synchronize if there is an error. I have 2 questions:
1.) I studied the serial_nrf52830_xxAA project and found several places where I could modifiy the packet format to include a synchronization header. I want to make sure that I am not introducing any potential problems in the core mesh stack.
a.) It looks like I can insert some bytes at the beginning of a packet by modifiying the "do_transmit()" function in serial_bearer.c
b.) On the receive side, I could modify the the char_rx_simple function to strip off the synchronization header
2.) I believe there are other tools for DFU, etc that use the serial firmware interface. If I modify the code, I would also need to modify the tools. I see there are macros for "SERIAL_SLIP_ENCODING". Is this supported by nrf_util?
I trying to add a bit more robustness to the protocol and do not want to add any issues into the mesh stack. Are there any other options that I may not have considered?