No I2C feedback: How to debug?
Re: No I2C feedback: How to debug?
I think it's time to use your logic analyzer to see, if clock and data signals are regular and whether the chip uses clock stretching. That is not supported by the Pico. You can try to use SoftI2C instead, which supports clock stretching. For a strange reason, SoftI2C works faster that hard I2C on the Pico. if set to 400kHz freq, I see 250kHz with hard I2C and 500kHz with SoftI2C.
- wintifrosch
- Posts: 12
- Joined: Sun Mar 20, 2022 9:37 am
- Location: Winterthur, Switzerland
- Contact:
Re: No I2C feedback: How to debug?
@Roberthh: Thank you for your support! I think it's time to use your logic analyzer
➝ I ordered an LA104, will take a week or so.
➝ I'll attend a hackerspace meeting tomorrow. Maybe I'll get learnings there.
With additional external power supply (EPS): stable 3.28V idle and during tests. However, results still depend on both, i2c frequency and i2c.status() poll delay. I resoldered the board pins: no improvement. I tried the spare PN532 board: same results.
PN532 test with connected EPS (board 1):
PN532 test with disconnected EPS, breadboard power supply board still mounted (3.27–3.29V during test, board 1):
PN532 test with disconnected EPS, breadboard power supply board still mounted (board 1 resoldered):
PN532 test with disconnected EPS, but breadboard power supply board still mounted (3.31–3.35V during tests, board 2):
Same test with another I2C board show flawless i2c.scan() results, as expected (VCNL4040 proximity sensor):
➝ I ordered an LA104, will take a week or so.
➝ I'll attend a hackerspace meeting tomorrow. Maybe I'll get learnings there.
With additional external power supply (EPS): stable 3.28V idle and during tests. However, results still depend on both, i2c frequency and i2c.status() poll delay. I resoldered the board pins: no improvement. I tried the spare PN532 board: same results.
PN532 test with connected EPS (board 1):
Code: Select all
delay=0.40 (real:0.4167s) freq=50_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.80 (real:0.8333s) freq=50_000: [[36], [36], [36], [], [36], [36], [36], [], [36], [36], [36], []]
delay=1.60 (real:1.6667s) freq=50_000: [[], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=3.20 (real:3.2500s) freq=50_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=6.40 (real:6.4167s) freq=50_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.40 (real:0.4167s) freq=100_000: [[36], [36], [], [36], [], [36], [], [36], [], [36], [], [36]]
delay=0.80 (real:0.8333s) freq=100_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=1.60 (real:1.5833s) freq=100_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=3.20 (real:3.2500s) freq=100_000: [[36], [36], [36], [], [], [], [], [], [], [], [], []]
delay=6.40 (real:6.4167s) freq=100_000: [[36], [36], [], [36], [36], [36], [36], [36], [36], [], [36], [36]]
delay=0.40 (real:0.4167s) freq=200_000: [[], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.80 (real:0.8333s) freq=200_000: [[36], [], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=1.60 (real:1.5833s) freq=200_000: [[36], [], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=3.20 (real:3.1667s) freq=200_000: [[], [36], [], [], [], [], [], [], [], [], [], []]
delay=6.40 (real:6.4167s) freq=200_000: [[], [], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.40 (real:0.4167s) freq=400_000: [[36], [36], [], [], [], [], [], [], [], [], [], []]
delay=0.80 (real:0.8333s) freq=400_000: [[], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=1.60 (real:1.5833s) freq=400_000: [[36], [36], [], [36], [36], [], [36], [36], [36], [], [36], [36]]
delay=3.20 (real:3.2500s) freq=400_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=6.40 (real:6.4167s) freq=400_000: [[36], [36], [], [], [], [], [], [], [], [], [], []]
Code: Select all
delay=0.40 (real:0.4167s) freq=50_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.80 (real:0.8333s) freq=50_000: [[36], [36], [36], [], [36], [36], [36], [], [36], [36], [36], []]
delay=1.60 (real:1.6667s) freq=50_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=3.20 (real:3.1667s) freq=50_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=6.40 (real:6.5000s) freq=50_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.40 (real:0.4167s) freq=100_000: [[36], [36], [], [36], [], [36], [36], [36], [36], [], [36], [36]]
delay=0.80 (real:0.7500s) freq=100_000: [[36], [], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=1.60 (real:1.6667s) freq=100_000: [[], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=3.20 (real:3.1667s) freq=100_000: [[36], [36], [36], [36], [], [], [], [], [], [], [], []]
delay=6.40 (real:6.4167s) freq=100_000: [[36], [36], [], [36], [36], [], [36], [36], [36], [], [36], [36]]
delay=0.40 (real:0.3333s) freq=200_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.80 (real:0.8333s) freq=200_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=1.60 (real:1.6667s) freq=200_000: [[], [], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=3.20 (real:3.1667s) freq=200_000: [[36], [36], [], [], [36], [], [], [], [36], [], [], []]
delay=6.40 (real:6.4167s) freq=200_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.40 (real:0.4167s) freq=400_000: [[36], [36], [], [], [], [], [], [], [], [], [], []]
delay=0.80 (real:0.8333s) freq=400_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=1.60 (real:1.5833s) freq=400_000: [[36], [36], [], [36], [36], [], [36], [36], [36], [], [36], [36]]
delay=3.20 (real:3.1667s) freq=400_000: [[], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=6.40 (real:6.4167s) freq=400_000: [[36], [36], [], [], [], [], [], [], [], [], [], []]
Code: Select all
delay=0.40 (real:0.4167s) freq=50_000: [[], [36], [36], [36], [36], [36], [], [], [36], [36], [36], [36]]
delay=0.80 (real:0.8333s) freq=50_000: [[], [], [36], [36], [36], [36], [36], [36], [], [], [], []]
delay=1.60 (real:1.6667s) freq=50_000: [[], [36], [], [36], [], [36], [], [36], [], [36], [], [36]]
delay=3.20 (real:3.1667s) freq=50_000: [[], [], [36], [], [36], [36], [], [36], [], [36], [36], []]
delay=6.40 (real:6.5000s) freq=50_000: [[36], [36], [36], [36], [36], [36], [], [], [], [], [], [36]]
delay=0.40 (real:0.4167s) freq=100_000: [[], [36], [36], [], [36], [36], [], [36], [36], [], [36], [36]]
delay=0.80 (real:0.8333s) freq=100_000: [[], [36], [36], [36], [36], [36], [36], [36], [], [], [36], [36]]
delay=1.60 (real:1.5833s) freq=100_000: [[36], [36], [], [36], [36], [], [36], [36], [], [36], [36], []]
delay=3.20 (real:3.2500s) freq=100_000: [[], [], [], [36], [36], [36], [], [], [], [], [36], [36]]
delay=6.40 (real:6.4167s) freq=100_000: [[36], [36], [36], [36], [36], [36], [], [], [36], [36], [36], [36]]
delay=0.40 (real:0.4167s) freq=200_000: [[36], [], [36], [36], [], [36], [36], [], [36], [36], [], [36]]
delay=0.80 (real:0.7500s) freq=200_000: [[36], [], [36], [], [36], [], [36], [], [36], [], [36], []]
delay=1.60 (real:1.6667s) freq=200_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [], [], []]
delay=3.20 (real:3.1667s) freq=200_000: [[36], [36], [36], [36], [36], [36], [], [36], [36], [36], [36], [36]]
delay=6.40 (real:6.4167s) freq=200_000: [[36], [], [36], [], [36], [], [36], [], [36], [], [36], []]
delay=0.40 (real:0.4167s) freq=400_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.80 (real:0.8333s) freq=400_000: [[], [], [], [], [], [], [], [], [], [], [], []]
delay=1.60 (real:1.5833s) freq=400_000: [[], [36], [], [36], [], [36], [], [36], [], [36], [], [36]]
delay=3.20 (real:3.1667s) freq=400_000: [[], [36], [36], [36], [36], [], [36], [], [36], [36], [36], [36]]
delay=6.40 (real:6.4167s) freq=400_000: [[], [], [], [], [], [], [], [], [], [], [], []]
Code: Select all
delay=0.40 (real:0.4167s) freq=50_000: [[], [36], [36], [36], [36], [36], [], [], [36], [36], [36], [36]]
delay=0.80 (real:0.8333s) freq=50_000: [[], [], [36], [36], [36], [36], [36], [36], [], [], [], []]
delay=1.60 (real:1.6667s) freq=50_000: [[], [36], [], [36], [], [36], [], [36], [], [36], [], [36]]
delay=3.20 (real:3.2500s) freq=50_000: [[], [], [36], [], [36], [36], [], [36], [36], [], [36], []]
delay=6.40 (real:6.4167s) freq=50_000: [[], [], [], [36], [36], [36], [36], [36], [36], [], [], []]
delay=0.40 (real:0.4167s) freq=100_000: [[36], [36], [], [36], [36], [], [36], [36], [], [36], [36], []]
delay=0.80 (real:0.8333s) freq=100_000: [[36], [36], [36], [36], [], [], [36], [36], [36], [36], [36], [36]]
delay=1.60 (real:1.5833s) freq=100_000: [[], [36], [36], [], [36], [36], [], [36], [36], [], [36], [36]]
delay=3.20 (real:3.2500s) freq=100_000: [[36], [], [], [], [36], [36], [36], [], [], [], [], [36]]
delay=6.40 (real:6.4167s) freq=100_000: [[36], [36], [], [], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.40 (real:0.4167s) freq=200_000: [[36], [], [36], [36], [], [36], [36], [], [36], [36], [], [36]]
delay=0.80 (real:0.8333s) freq=200_000: [[36], [], [36], [], [36], [], [36], [], [36], [], [36], []]
delay=1.60 (real:1.5833s) freq=200_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [], [], []]
delay=3.20 (real:3.1667s) freq=200_000: [[36], [36], [36], [36], [36], [], [36], [36], [36], [36], [36], [36]]
delay=6.40 (real:6.4167s) freq=200_000: [[], [36], [], [36], [], [36], [], [36], [], [36], [], [36]]
delay=0.40 (real:0.4167s) freq=400_000: [[], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.80 (real:0.8333s) freq=400_000: [[36], [36], [36], [], [], [], [], [], [], [], [], []]
delay=1.60 (real:1.5833s) freq=400_000: [[], [36], [], [36], [], [36], [], [36], [], [36], [], [36]]
delay=3.20 (real:3.2500s) freq=400_000: [[], [36], [36], [36], [36], [], [36], [36], [36], [36], [36], [36]]
delay=6.40 (real:6.4167s) freq=400_000: [[], [], [], [], [], [], [], [], [], [], [], []]
Code: Select all
delay=0.40 (real:0.5000s) freq=50_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=0.80 (real:0.8333s) freq=50_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=1.60 (real:1.5833s) freq=50_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=3.20 (real:3.2500s) freq=50_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=6.40 (real:6.4167s) freq=50_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=0.40 (real:0.4167s) freq=100_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=0.80 (real:0.8333s) freq=100_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=1.60 (real:1.6667s) freq=100_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=3.20 (real:3.1667s) freq=100_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=6.40 (real:6.4167s) freq=100_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=0.40 (real:0.4167s) freq=200_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=0.80 (real:0.8333s) freq=200_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=1.60 (real:1.5833s) freq=200_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=3.20 (real:3.2500s) freq=200_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=6.40 (real:6.4167s) freq=200_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=0.40 (real:0.4167s) freq=400_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=0.80 (real:0.7500s) freq=400_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=1.60 (real:1.5833s) freq=400_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=3.20 (real:3.2500s) freq=400_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
delay=6.40 (real:6.4167s) freq=400_000: [[96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96], [96]]
Re: No I2C feedback: How to debug?
Did you try SoftI2C?
Re: No I2C feedback: How to debug?
The other board used a different sensor. So you cannot compare the test result.
Re: No I2C feedback: How to debug?
Many people use these simple logic analyzers. Sample Link: https://www.amazon.de/AZDelivery-%E2%AD ... r=8-6&th=1
Together with the Saleae Logic software or Open Source Pulseview. Very handy.
Together with the Saleae Logic software or Open Source Pulseview. Very handy.
- wintifrosch
- Posts: 12
- Joined: Sun Mar 20, 2022 9:37 am
- Location: Winterthur, Switzerland
- Contact:
Re: No I2C feedback: How to debug?
«Did you try SoftI2C?»
➝ Same results (see below)
«The other board used a different sensor. So you cannot compare the test result.»
➝ This was the tests aim: to prove that the hard- and software test setup besides the PN532 board will work fine for i2C.scan(). Test successful.
«…logic analyzers»
➝ Ordered an LA104 4 channel logic analyzer. Will postpone further tests, unless new inputs suggest otherwise.
PN532 test with board 2 and SoftI2C. Same inconsistent results.
➝ Same results (see below)
«The other board used a different sensor. So you cannot compare the test result.»
➝ This was the tests aim: to prove that the hard- and software test setup besides the PN532 board will work fine for i2C.scan(). Test successful.
«…logic analyzers»
➝ Ordered an LA104 4 channel logic analyzer. Will postpone further tests, unless new inputs suggest otherwise.
PN532 test with board 2 and SoftI2C. Same inconsistent results.
Code: Select all
i2c = SoftI2C(sda=Pin(4), scl=Pin(5), freq=freq)
...
delay=0.40 (real:0.4167s) freq=50_000: [[], [36], [36], [36], [], [36], [], [36], [], [36], [], [36]]
delay=0.80 (real:0.8333s) freq=50_000: [[36], [36], [], [36], [36], [36], [], [36], [36], [], [], [36]]
delay=1.60 (real:1.6667s) freq=50_000: [[], [], [36], [36], [36], [36], [], [], [], [36], [36], [36]]
delay=3.20 (real:3.2500s) freq=50_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=6.40 (real:6.4167s) freq=50_000: [[36], [36], [], [36], [36], [36], [], [36], [36], [], [], [36]]
delay=0.40 (real:0.4167s) freq=100_000: [[36], [], [36], [36], [], [], [36], [36], [], [36], [36], []]
delay=0.80 (real:0.8333s) freq=100_000: [[], [36], [], [36], [], [36], [], [36], [], [36], [], [36]]
delay=1.60 (real:1.5833s) freq=100_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=3.20 (real:3.2500s) freq=100_000: [[36], [36], [], [36], [36], [36], [36], [], [36], [36], [36], [36]]
delay=6.40 (real:6.4167s) freq=100_000: [[], [36], [], [36], [], [36], [], [36], [], [36], [], [36]]
delay=0.40 (real:0.3333s) freq=200_000: [[36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36], [36]]
delay=0.80 (real:0.8333s) freq=200_000: [[36], [36], [], [], [], [], [], [], [], [], [], []]
delay=1.60 (real:1.5833s) freq=200_000: [[], [36], [], [36], [36], [], [36], [], [36], [36], [], [36]]
delay=3.20 (real:3.2500s) freq=200_000: [[], [36], [], [36], [], [36], [], [36], [], [36], [], [36]]
delay=6.40 (real:6.4167s) freq=200_000: [[36], [], [], [], [], [], [], [], [], [], [], []]
delay=0.40 (real:0.4167s) freq=400_000: [[], [36], [], [36], [], [36], [], [36], [], [36], [], [36]]
delay=0.80 (real:0.7500s) freq=400_000: [[], [36], [36], [36], [], [36], [36], [36], [], [36], [36], [36]]
delay=1.60 (real:1.6667s) freq=400_000: [[], [], [], [], [], [], [], [], [], [], [], []]
delay=3.20 (real:3.1667s) freq=400_000: [[], [], [], [], [], [], [], [], [], [], [], []]
delay=6.40 (real:6.4167s) freq=400_000: [[36], [36], [36], [36], [], [36], [36], [36], [], [36], [36], [36]]
Re: No I2C feedback: How to debug?
so:
- a different chip at that board works fine. So the hardware of the Pico and the wiring is OK.
- Using SoftI2C gives the same pattern. This clock stretching seems not to be the problem.
Not much left besides the target board.
- a different chip at that board works fine. So the hardware of the Pico and the wiring is OK.
- Using SoftI2C gives the same pattern. This clock stretching seems not to be the problem.
Not much left besides the target board.
- wintifrosch
- Posts: 12
- Joined: Sun Mar 20, 2022 9:37 am
- Location: Winterthur, Switzerland
- Contact:
Re: No I2C feedback: How to debug?
Agree.
I ordered another two PN532 boards from another supplier. HTH.
I ordered another two PN532 boards from another supplier. HTH.
- wintifrosch
- Posts: 12
- Joined: Sun Mar 20, 2022 9:37 am
- Location: Winterthur, Switzerland
- Contact:
Re: No I2C feedback: How to debug?
Received the logic analyzer. Here's what I've learned up to now:
In a few days, I'll post observations during a longer communication, with focus on PN532s long ACK signals.
_______________________________
VCNL4040 reference board, freq=100_000, Hardware I2C: arrhythmic patterns now and then. 30–180ns per byte. Snapshot Ⓓ was 10x faster than usual (▲T is the time between the two dotted lines, from MSB to ACK).
VCNL4040 reference board, freq=100_000, Software I2C: similar to Hardware I2C.
VCNL4040 reference board, freq=10_000: ~1ms per byte, but reliable pulse on SCL in both modes (images from SoftI2C)
PN532 RFID board, freq=100_000, Hardware I2C: arrhythmic now and then (Ⓜ︎ is zoomed in to see the first bit, ACK is on the right far outside the screen), after ACK pulse (=rightmost white dotted line), SDA is pulled LOW for 300µs or longer, probably by PN532. In Ⓞ SDA didn't return to HIGH within the sampling period.
- PICO's I2C timing is not very constant, especially in high frequencies.
- After pulling SDA to LOW in the ACK pulse, the PN532 keeps the signal LOW for a long time (0.3ms or more. sometimes the signal even remains LOW (Screenshot Ⓞ below). It's a pity I don't have an analog oscilloscope to observe the power levels on SDA and SCL.
- The color display of the mini ware LA104 logic analyzer is to small to analyse more than a couple of bytes. I downloaded the csv data and built an I2C interpreter in Excel.
In a few days, I'll post observations during a longer communication, with focus on PN532s long ACK signals.
_______________________________
VCNL4040 reference board, freq=100_000, Hardware I2C: arrhythmic patterns now and then. 30–180ns per byte. Snapshot Ⓓ was 10x faster than usual (▲T is the time between the two dotted lines, from MSB to ACK).
VCNL4040 reference board, freq=100_000, Software I2C: similar to Hardware I2C.
VCNL4040 reference board, freq=10_000: ~1ms per byte, but reliable pulse on SCL in both modes (images from SoftI2C)
PN532 RFID board, freq=100_000, Hardware I2C: arrhythmic now and then (Ⓜ︎ is zoomed in to see the first bit, ACK is on the right far outside the screen), after ACK pulse (=rightmost white dotted line), SDA is pulled LOW for 300µs or longer, probably by PN532. In Ⓞ SDA didn't return to HIGH within the sampling period.