ChanServ changed the topic of #rust-embedded to: Welcome to the Rust Embedded IRC channel! Bridged to #rust-embedded:matrix.org and logged at https://libera.irclog.whitequark.org/rust-embedded, code of conduct at https://www.rust-lang.org/conduct.html
IlPalazzo-ojiisa has quit [Remote host closed the connection]
Foxyloxy has joined #rust-embedded
Foxyloxy has quit [Quit: Textual IRC Client: www.textualapp.com]
crabbedhaloablut has quit []
xnor_ has joined #rust-embedded
kenny1 has joined #rust-embedded
Guest7221 has quit [*.net *.split]
kenny has quit [*.net *.split]
xnor has quit [*.net *.split]
crabbedhaloablut has joined #rust-embedded
vancz has quit []
vancz has joined #rust-embedded
IlPalazzo-ojiisa has joined #rust-embedded
IlPalazzo-ojiisa has quit [Quit: Leaving.]
IlPalazzo-ojiisa has joined #rust-embedded
IlPalazzo-ojiisa has quit [Quit: Leaving.]
IlPalazzo-ojiis1 has joined #rust-embedded
IlPalazzo-ojiis1 has quit [Client Quit]
IlPalazzo-ojiisa has joined #rust-embedded
Foxyloxy has joined #rust-embedded
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> Nothing jumps out to me but I'm not very familiar with C https://github.com/Noltari/pico-uart-bridge/blob/master/uart-bridge.c
<JamesMunns[m]> That uses tinyusb, and I see at least one strlen
<JamesMunns[m]> which in c-strings, only counts the len to the first null byte
<JamesMunns[m]> not sure, but that's my first guess
<JamesMunns[m]> but hmm, that's write_str, which isn't called... hmmmmmm
<JamesMunns[m]> So it goes something like:
<JamesMunns[m]> (other device) -> SERIAL: bytes1 -> (pico) -> USB: bytes2 -> PC
<JamesMunns[m]> where you DO see the zeroes at SERIAL: bytes1, but don't see them at your PC?
<AlexandervanSaas> Correct
<JamesMunns[m]> So we know either the pico bridge or your PC are eating zeroes, we just have to figure out which one :)
<AlexandervanSaas> I also suspect the uart bridge
<AlexandervanSaas> * suspect the pico uart bridge
<JamesMunns[m]> Do you have a SWD debugger for one of your picos?
<JamesMunns[m]> if so: you could try smashing together the embassy https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/usb_serial.rs example with the UART one, and make your own UART bridge, or use defmt to print the raw bytes received
<JamesMunns[m]> * UART bridge, and/or use
<AlexandervanSaas> Appologies, the second pico (the uart bridge) is running this https://github.com/raspberrypi/picoprobe
<AlexandervanSaas> * running this,, * not the other project I linked https://github.com/raspberrypi/picoprobe
<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!
crabbedhaloablut has quit []