|
Forum Index : Microcontroller and PC projects : Pico as I2C sniffer ?
| Author | Message | ||||
| 58kk90 Regular Member Joined: 14/06/2023 Location: United KingdomPosts: 79 |
I urgently need to capture some data between a piece of old test equipment and it's battery. Looking on the scope I believe it to be either SMbus or I2C which are essentially very similar as far as I can tell for just two devices on the bus. I am not at home currently so I don't have access here to logic analyser or bus pirate, but I do have a couple of Pi Pico's in my laptop bag, does anyone have any quick and dirty code to sniff I2C data and output it to raw bytes to the terminal? Tony |
||||
| mozzie Guru Joined: 15/06/2020 Location: AustraliaPosts: 429 |
G'day Tony, Can you ascertain the clock frequency from the scope, if so you could try: Assuming the battery is the slave: Hook up a PicoMite to CLK/DAT Set system I2C Use LIST SYSTEM I2C to find address of battery If that works then: Hook up PicoMite to CLK/DAT via 22K series resistors Connect battery to device Set PicoMite as slave at battery address Use Interrupts to see what is sent I have done something similar to get touch info from a touchscreen controller but it took a fair bit of stuffing around. Someone will likely chime in with a better solution using PIO etc Regards, Lyle. |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3368 |
Mozzie is on to something with the PIO idea. In the manual Appendix F, The PIO Programming Package, EXAMPLE PROGRAM 3 is a basic logic analyser that could probably be adapted to do what you want. For a more comprehensive logic analyser search Volhout's posts. Here it is Edited 2026-08-29 18:54 by phil99 |
||||
| 58kk90 Regular Member Joined: 14/06/2023 Location: United KingdomPosts: 79 |
@Mozzie, the clock frequency seems to be just about 20KHz, I'll try and find the battery I2C address using the List System I2C as you suggest, that would be a starting point I guess, then I could do as you suggest capturing the data, but I'm not sure how the Pico I2C slave code would deal with the acknowledges as the Pico would be on the same I2C address as the battery. I'll do a bit of poking around and update later. @phill99, the PIO is waay above my level of programming, but i'll take a look and see if I can make sense of it. If only i'd have my Buspirate in the laptop bag, it would be quick and easy! Tony |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6068 |
Hi, Use the PicoLA (picomite logic analyzer for PicoMiteVGA. You can trigger on start condition, and it has a built in I2C decoder. In the help menu it shows where to connect SDA and SCL. PicoLA Alternatively you can use SCOPPY (the free version). It has a built in logic analyzer, and 2 channel scope. Volhout Volhout Edited 2026-08-30 00:56 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| mozzie Guru Joined: 15/06/2020 Location: AustraliaPosts: 429 |
G'day, With a 20khz clock frequency I would guess its SMBus, pretty sure a lot of the power tool batteries use this. SMBus_made_Simple_slua475.pdf Volhouts Pico_LA logic analyzer looks like the answer here am going to load it up and take it for a spin myself, Thanks Volhout Regards, Lyle. |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6068 |
LA26.zip The latest. Runs on V60302. Maybe I finally will start looking at integrating other decoders (SPI/UART) (**). It has been 3 years, and since I only kept it compatible with evolving MMBasic. Should also work on HDMI. If you have no sound attached to GP6/7 you can change the define at line 55 of the program to enable channels 7 and 8. You will also have to disable the built in test pattern generator in the program (comment line 61). Volhout (**) LA uses quite a lot of heap, and only recently improvement has been on heap for the 2040 VGA. Maybe there is enough room now to add features. Edited 2026-08-30 01:37 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6068 |
If you only have a pico (the module), and no VGA/HDMI, use SCOPPY. You can install scoppy in a pico, connect it through a USB cable to your (android) phone, install the scoppy app on the phone. If you have a pico-W, you can also connect the phone through WIFI. Not sure how far the "free" version goes (decoding I2C). But you can for sure see the waveforms on scope , and use the logic analyzer built in. Volhout Edited 2026-08-30 01:48 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |