<re_irc>
<@jamwaffles:matrix.org> Huge shoutout to the "defmt" devs. I still can't quite believe I get basically the same log detail on a lil STM32 that I do in a full blown Linux environment. Truly impressive, and extremely useful for debugging. Thank you ❤️
<re_irc>
<@firefrommoonlight:matrix.org> Thx for teh whole Knurling app tepmlate stack
<re_irc>
<@firefrommoonlight:matrix.org> Those are absolutely critical to the Rust embedded experience
<re_irc>
<@firefrommoonlight:matrix.org> and the PAC team (most notablly Agg)
<re_irc>
<@firefrommoonlight:matrix.org> Those are critical to the Rust embedded experience
<re_irc>
<@whitequark:matrix.org> "defmt" is really good
m5zs7k has quit [Ping timeout: 245 seconds]
m5zs7k has joined #rust-embedded
dc740 has quit [Remote host closed the connection]
<re_irc>
<@thejpster:matrix.org> I shall pass on your thanks to Jorge and the team.
<re_irc>
<@thejpster:matrix.org> I claim no credit - it predates my arrival.
crabbedhaloablut has quit []
<re_irc>
<@phaseonx11:matrix.org> Hello all! Back for some help, after trying to solve this myself all week.
<re_irc>
I'm exploring the possibility of writing a simple driver for a Ublox GPS receiver, the NEO-M9N.
<re_irc>
So far, I've been attempting to figure out how to read data from it and its registers using i2c in a stable way and keep running into time out issues...
<re_irc>
- My code doesn't run reliably. I'm probably not waiting for the device correctly, because it often takes a few resets for things to run as I expect.
<re_irc>
- I might not be reading from the register correctly? All the examples use write_read, but that always times out in my case. I have to use separate read and write calls.
<re_irc>
- From reading the integration manual, what I've understood is you make calls to read 0xFD and 0xFE, that gives you the amount of bytes left. Then, you keep reading 0xFF one byte at a time, until you get
<re_irc>
I've made sure that the i2c bus is running at a frequency the device supports (400 kHz) and that I'm using the right port (0x42)...I've attached my code and a link to the integration guide + a snippet of it detailing i2c connectivity. https://pastebin.com/SjXjL1d1
<re_irc>
<@phaseonx11:matrix.org> +a 0xFF byte as a response...which means there is no more data to read at the moment.
<re_irc>
<@phaseonx11:matrix.org> * address
Guest6498 has joined #rust-embedded
Guest6498 is now known as nex8192
<re_irc>
<@henrik_alser:matrix.org> Luis Roel: 👋 Does any i2c transfer at all succeed? What Error are you getting?
<re_irc>
<@henrik_alser:matrix.org> Double checked all connections? And made sure SDA/SCL are not swapped etc?
<re_irc>
<@jamesmunns:beeper.com> also something to note, some more complex i2c devices will have their own boot up time, which might be shorter than the MCU's boot time. So you might need to wait a few hundred ms after startup before you start talking to them
<re_irc>
<@henrik_alser:matrix.org> Also some datasheets will give the address in ”pre shifted” format, so you might need to right shift it by one
<re_irc>
<@like2wise:matrix.org> pull ups on the wires? how strong? what kind of wires? length?
<re_irc>
<@henrik_alser:matrix.org> Do you have a scope or logic analyzer?
nex8192 has left #rust-embedded [Error from remote client]
<re_irc>
<@phaseonx11:matrix.org> : Hello Henrik, thank you for your reply. Yes, it seems that I am able to transfer a few bytes...after which, it fails continously with timeout.
<re_irc>
Sent init call to GPS...
<re_irc>
Got low byte of bytes avail: 110010
<re_irc>
Sent init call to GPS...
<re_irc>
Bytes available: 11826
<re_irc>
God high byte of bytes avail: 101110
<re_irc>
Selected register...
<re_irc>
Reading data...
<re_irc>
Read a byte: 30
<re_irc>
11825 bytes left...
<re_irc>
Read a byte: 30
<re_irc>
11824 bytes left...
<re_irc>
Read a byte: 2C
<re_irc>
11823 bytes left...
<re_irc>
Error reading byte: TimeOut...
<re_irc>
Waiting...
<re_irc>
Error reading byte: TimeOut...
<re_irc>
Waiting...
<re_irc>
Error reading byte: TimeOut...
<re_irc>
Waiting...
<re_irc>
Error reading byte: TimeOut...
<re_irc>
Waiting...
<re_irc>
Error reading byte: TimeOut...
<re_irc>
Waiting...
<re_irc>
Error reading byte: TimeOut...
<re_irc>
Waiting...
<re_irc>
<@phaseonx11:matrix.org> : Thank you for your reply James, I expected as much so I wait about 1000 ms before making that first call to the device.
<re_irc>
<@phaseonx11:matrix.org> : No, unfortunately I do not. I have purchased one but it comes next week :)
<re_irc>
<@phaseonx11:matrix.org> : Unfortunately, a lower speed would not work because the GPS device only functions in "fast" mode (400 kHz).
<re_irc>
<@phaseonx11:matrix.org> : There is a set of pullups on the bus...I am not sure what strength. They are connected via an m2 connector.
<re_irc>
<@phaseonx11:matrix.org> +I cut the pullups on everything else as I was advised you should only have one set per bus...
<re_irc>
<@phaseonx11:matrix.org> : Yes, I have made sure the pins are correct. I am able to comm with an SSD1306 OLED controller using the same bus...
<re_irc>
<@phaseonx11:matrix.org> : I have verified I am using the correct address by running this:
<re_irc>
<@phaseonx11:matrix.org> : I'm not sure but I think you might be onto something...see, I use this code to print all the available device addresses (to debug):