IlPalazzo-ojiisa has quit [Ping timeout: 255 seconds]
IlPalazzo-ojiisa has joined #rust-embedded
limpkin has quit [Quit: limpkin]
limpkin has joined #rust-embedded
IlPalazzo-ojiisa has quit [Ping timeout: 255 seconds]
IlPalazzo-ojiisa has joined #rust-embedded
IlPalazzo-ojiisa has quit [Ping timeout: 264 seconds]
IlPalazzo-ojiisa has joined #rust-embedded
hifi has quit [Server closed connection]
hifi has joined #rust-embedded
Foxyloxy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Foxyloxy has joined #rust-embedded
notgull has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
notgull has joined #rust-embedded
Foxyloxy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Foxyloxy has joined #rust-embedded
Guest7221 has joined #rust-embedded
Guest7221 has left #rust-embedded [Error from remote client]
Foxyloxy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<AlexandervanSaas>
I have what's probably a very easy to solve problem but I can't figure it out by myself so here it goes. I'm trying to log data over serial and I'm using the postcard crate for serialization and deserialization and cobs encoding to be able to separate the frames. On the receiving end I recorded some data with a serial monitor but there aren't any zero bytes in the bytes I recorded. I verified the zero byte is appended to the
<AlexandervanSaas>
messages on the sending side and with a hex editor I can see my messages in the recorded bytes, sans the zero byte. Why could that be?
<AlexandervanSaas>
* that be? I'm using embassy and `blocking_write`.
<JamesMunns[m]>
Do the other bytes look reasonable? If not it might be a baudrate issue. Can you share the code somewhere so I can take a peek?
<AlexandervanSaas>
Yes the other bytes are correct. I forgot that I had a logic analyzer but I've now confirmed the zero byte is transmitted at the end of each message.
<JamesMunns[m]>
I can't think of anything that would "swallow" the values
<AlexandervanSaas>
I'm using a second raspberry pi pico as a serial bridge. It wouldn't make sense to me but could that swallow the zero byte?
<JamesMunns[m]>
AlexandervanSaas: Ah! So the sender is definitely working, and definitely sending the zeroes, but the receiver isn't seeing them? What are you using to buffer/accumulate the bytes on the receiver side?
<AlexandervanSaas>
JamesMunns[m]: Just a serial monitor like Serial Studio or picocom
<JamesMunns[m]>
Hmm, maybe they could be seeing it as a NUL byte and walling it, if you are using it in some kind of a text mode
<JamesMunns[m]>
s/walling/swallowing/
<JamesMunns[m]>
Might be worth looking around the code or settings to see if they have anything about that?
<AlexandervanSaas>
So the second pico is a SWB debugger for the first one. I don't have a second SWD debugger/third pico unfortunately.
<JamesMunns[m]>
I'm not sure how better to debug, sadly. I'm not familiar enough with the pico-sdk, tinyusb, or the rest of the stack to know whats up :/
Foxyloxy has joined #rust-embedded
<AlexandervanSaas>
lol I found a ST link
<AlexandervanSaas>
To me it seems very unlikely that my computer is somehow eating the zero bytes.
dreamcat4 has joined #rust-embedded
<JamesMunns[m]>
<AlexandervanSaas> "To me it seems very unlikely..." <- you could take the embassy usb-serial example and just send `1, 2, 3, 4, 0` on the wire every second or somethingh
<JamesMunns[m]>
then you could prove it
notgull has quit [Ping timeout: 252 seconds]
notgull has joined #rust-embedded
<AlexandervanSaas>
It is my computer that's swallowing the zero bytes.
<AlexandervanSaas>
s/is/_is_/, s/./!/
<AlexandervanSaas>
s/is/_is_/, s/./! WTF!?/
<adamgreig[m]>
probably it's the serial monitor and it's just only designed for text or something
<adamgreig[m]>
maybe whip up a rust program using postcard to receive the serial data and decode it?
<AlexandervanSaas>
Is it common for software to skip zero bytes? I tried three different serial monitors so far
<adamgreig[m]>
... admittedly no, it doesn't seem common
<adamgreig[m]>
like you'd possibly expect it from software designed to just monitor text
xnor_ is now known as xnor
<adamgreig[m]>
if you have python installed, install pyserial, try just like import serial; s = serial.Serial("/dev/ttyACM0", 9600); data = s.read(16); print(repr(data)) (replace 9600 with your baud rate) and see if the 0s appear there?
<adamgreig[m]>
pyserial definitely doesn't strip 0s so if they're missing from that it's something really screwy on your computer itself
<adamgreig[m]>
(replace /dev/ttyACM0 with like COM15 or so if you're on windows)
<AlexandervanSaas>
ah, when passing -H/--displayhex to minicom it does display the zero byte
<adamgreig[m]>
aah, cool
<adamgreig[m]>
then yea, I guess it's coming through fine and your software's just stripping it because it's only showing you text
<adamgreig[m]>
maybe it strips other control codes too?
<AlexandervanSaas>
Actually that option displays the bytes as hex string but it doesn't write the raw bytes to a file. So I know my computer is receiving the null byte but I don't have the file that I need yet.
<AlexandervanSaas>
I'll write my own tool to read from serial and write to a file. Thanks everyone!