Almost there!

A project log for Chirppp, Serial over LORA

Use LORA via GPIO and a full-duplex serial emulator for serial a connection intended for extended range use.

dominic-demarcoDominic DeMarco 07/28/2017 at 03:430 Comments

Version 0.1 is well on its way!

I've still got a few kinks to iron out, I had to adjust the flowchart I posted in the previous log a bit to properly handle retry and heartbeat packets.

Occasionally I'll get a false positive that the radio has received a packet, and 0 bytes of data will be read from serial. This is tolerable at lower speeds, I can add some retry logic in to handle it well, but at higher speeds this can end up with only half a packet read. I'll have to pore over the driver logic again to see if it's a logic error of mine, or just an erroneous signal that is managing to make it through the AUX wire to the device...

If I end up not being able to fix it, I'll be able to make it send a retry packet if it gets corrupt data to just try receiving it again. Not the most elegant solution, but when you're trying to pick up hardware interrupts with epoll on a slow embedded device, there's only so much you can do :P

I may also have to move from using the libc binding of openpty to using the rust nix crate. When I use stty (a tool for looking at serial connection information) on one of ssh's ptys this is the output I see:

root@chip:/dev/pts# stty -F 2
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint ixany

Looks pretty good. We can see it's running at a virtual 38400 baud and we can see special end of line characters and some other flags that have been enabled.

This is what mine looks like..

root@chip:/dev/pts# stty -F 1
speed 0 baud; line = 0;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>;
start = <undef>; stop = <undef>; susp = <undef>; rprnt = <undef>;
werase = <undef>; lnext = <undef>; flush = <undef>; min = 0; time = 0;
ignbrk -brkint -icrnl ixoff -imaxbel
-opost -onlcr cr2 tab2
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

 yeeg... not so good. We can see that apparently the speed is 0, we've got a LOT of undefined things, and for some reason only ixoff is enabled when we should be seeing ixon as well.

Hm. I'll have to poke around with that further to try and clean up how our pty is being exposed.