[LEDE-DEV] Serial data getting lost - bug or a feature?

Jay Carlson nop at nop.com
Fri Oct 20 08:09:27 PDT 2017


On 2017-10-18 Wed, at 06:32, Valent Turkovic <valent at otvorenamreza.org> wrote:

> So if wifi is active, in sta mode but not associated to AP then serial
> communication is having issues and is loosing characters when
> receiving them.

Regardless of this poor behavior, I think you're going to regret it eventually if you don't have some kind of checksum and retransmit logic--implying you're also doing framing. Async serial lines can be tricky, and have non-zero bit error rates. And the framing mechanism needs to be resilient against incomplete packets (meaning, bytes dropped between transmitter and receiver). 

Newline-separated ASCII records with a hex CRC are not the worst idea, but you need to deal with the situation where a newline gets lost, or you get trash or fewer bytes than you needed. I've used YMODEM before for bulk data.

Note that the Arduino Yún uses packets.

Jay


More information about the Lede-dev mailing list