C162b07 BP6: I2C repeated start not working

In earlier code on BP5, I could call up a repeated start as follows:

[ 0xc0 0x02 0x53 0x00 0x20
[ 0xc0 0x07 0x00 ]

Note no STOP on the first line.

This does not work on the subject configuration:

I2C> [ 0xc0 0x02 0x53 0x00 0x20

I2C START
TX: 0xC0 ACK 0x02 ACK 0x53 ACK 0x00 ACK 0x20 ACK
I2C> [ 0xc0 0x07 0x00 ]

I2C START
TX: 0xC0 NACK (I2C bus error)
I2C>

It works if I put a stop on the first line, but I should be able to use the repeated START so the bus is not released.

Owen

1 Like

Here is a log of this working on BP5 with earlier firmware (see log).

HiZ> m

Mode selection
1. HiZ
2. 1-WIRE
3. UART
4. HDPLXUART
5. I2C
6. SPI
7. 2WIRE
8. LED
x. Exit
Mode > 5

Use previous settings?
I2C speed: 100kHz

y/n, x to exit (Y) > n

I2C speed
1kHz to 1000kHz
x. Exit
kHz (400kHz*) > 100k
Mode: I2C
I2C> W
Power supply
Volts (0.80V-5.00V)

Maximum current (0mA-500mA), <enter> for none
- SDA SCL - - - - - - GND
3.30V requested, closest value: 3.30V 0.0V 0.0V 0.0V 0.0V GND
100.0mA requested, closest value: 100.0mA

Power supply:Enabled
Vreg output: 3.3V, Vref/Vout pin: 3.3V, Current: 41.7mA

I2C> P
Pull-up resistors: Enabled (10K ohms @ 3.3V)
I2C> i

This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) this device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation.

Bus Pirate 5 REV10
Firmware main branch (2024-04-10T12:30:36Z)
RP2040 with 264KB RAM, 128Mbit FLASH
S/N: 2145260B134063E4
https://BusPirate.com/
Storage: 0.10GB (FAT16 File System)

Configuration file: Loaded
Available modes: HiZ 1-WIRE UART HDPLXUART I2C SPI 2WIRE LED
Active mode: HWI2C (speed)=(0)
Display format: Auto
Data format: 8 bits, MSB bitorder
Pull-up resistors: ON
Power supply: ON (3.3V/3.29V)
Current limit: OK (33.6mA/100.0mA)
Frequency generators: OFF

I2C> [ 0xc0 0x02 0x53 0x00 0x20
Vout: 3.29V/100.0mA max | Pull-ups: ON |
I2C START
038.3mA SDA SCL - - - - - - GND
3.3V [ 0xc0 0x07 0x00 3.2V 3.3V 3.2V 3.3V 3.3V 3.2V GND

I2C START
031.9mA0 ACK 0x07 ACK 0x00 ACK
3.3V [ 0xc0 0x0f 0x00 0x0c 0x8c 0x8c 0x8c 0x8c 0x8c 0x8c 0x8c 3.2V

I2C START
TX: 0xC0 ACK 0x0F ACK 0x00 ACK 0x0C ACK 0x8C ACK 0x8C ACK 0x8C ACK 0x8C ACK
007.0mAC ACK 0x8C ACK 0x8C ACK
3.3V [ 0xc0 0x1a 0xa4 0x3c 0x00 0x0f 0xff 0xb9 0x55 0xbc3.3V 3.3V

I2C START
TX: 0xC0 ACK 0x1A ACK 0xA4 ACK 0x3C ACK 0x00 ACK 0x0F ACK 0xFF ACK 0xB9 ACK
038.3mA5 ACK 0xBC ACK
3.3V [ 0xc0 0x2a 0x00 0x02 0x01 0x0f 0x40 0x00 0x00 0x003.3V 3.3V

I2C START
TX: 0xC0 ACK 0x2A ACK 0x00 ACK 0x02 ACK 0x01 ACK 0x0F ACK 0x40 ACK 0x00 ACK
035.6mA0 ACK 0x00 ACK
3.3V [ 0xc0 0x5a 0x00 0x003V 3.3V 3.3V 3.3V 3.3V 3.2V

I2C START
030.5mA0 ACK 0x5A ACK 0x00 ACK 0x00 ACK
3.3V [ 0xc0 0x95 0x00 0x00 0x00 0x00 0x00 0x00 0x00V 3.3V 3.3V

I2C START
TX: 0xC0 ACK 0x95 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK
006.5mA0 ACK
3.3V [ 0xc0 0xa2 0x00 0x00 0x00 0x00 3.3V 3.3V 3.2V 3.3V

I2C START
024.4mA0 ACK 0xA2 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK
3.3V [ 0xc0 0xb7 0x92 ] 3.3V 3.3V 3.3V 3.2V 3.3V 3.3V

I2C START
TX: 0xC0 ACK 0xB7 ACK 0x92 ACK
010.4mAP
3.3V p 3.3V 3.3V 3.3V 3.2V 3.3V 3.2V 3.3V 3.3V
Pull-up resistors: Disabled
I2C> w
Power supply: Disabled

I2C> i

This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) this device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation.

Bus Pirate 5 REV10
Firmware main branch (2024-04-10T12:30:36Z)
RP2040 with 264KB RAM, 128Mbit FLASH
S/N: 2145260B134063E4
https://BusPirate.com/
Storage: 0.10GB (FAT16 File System)

Configuration file: Loaded
Available modes: HiZ 1-WIRE UART HDPLXUART I2C SPI 2WIRE LED
Active mode: HWI2C (speed)=(0)
Display format: Auto
Data format: 8 bits, MSB bitorder
Pull-up resistors: OFF

Frequency generators: OFF
1 Like

Thank you so much for providing the i output. I can browse the history to see where this might have started.

However, I have a mostly finished rewrite of the I2C PIO program that should be a lot more flexible. Iā€™ll try to get that pushed today, but more realistically tomorrow. I will check the repeated starts as well.

2 Likes

Hello,

There should be an auto build momentarily with a completely reworked I2C mode.

Using SI7021 and reading serial number, repeated start seems to work ok. That doesnā€™t mean itā€™s fixed for all cases, but Iā€™m hopeful :slight_smile:

2 Likes

This one should work.

2 Likes

This sequence worked earlier on BP5 as noted, but it does not work on 305f709.

I2C> i

This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) this device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation.


Bus Pirate 6
https://BusPirate.com/
Firmware main branch @ 305f709 (2024-10-30T10:54:09Z)
RP2350B with 512KB RAM, 128Mbit FLASH
S/N: 2EAE869F8943242C
Storage:   0.10GB (FAT16 File System)

Configuration file: Loaded
Available modes: HiZ 1-WIRE UART HDUART I2C SPI 2WIRE DIO LED INFRARED
Active mode: I2C
 I2C speed: 100kHz
 Clock stretching: OFF

Display format: Auto
Data format: 8 bits, MSB bitorder
Pull-up resistors: ON
Power supply: ON (3.3V/3.29V)
Current limit: OK (25.8mA/100.0mA)
Frequency generators: OFF

I2C> [ 0xc0 0x02 0x53 0x00 0x20

I2C START
TX: 0xC0 ACK 0x02 ACK 0x53 ACK 0x00 ACK 0x20 ACK
I2C> [ 0xc0 0x07 0x00

I2C START
TX: 0xC0 NACK 0x07 NACK 0x00 NACK
I2C> [ 0xc0 0x0f 0x00 0x0c 0x8c 0x8c 0x8c 0x8c 0x8c 0x8c 0x8c

I2C START
TX: 0xC0 NACK 0x0F NACK 0x00 NACK 0x0C NACK 0x8C NACK 0x8C NACK 0x8C NACK 0x8C NACK
    0x8C NACK 0x8C NACK 0x8C NACK
I2C> [ 0xc0 0x1a 0xb5 0xa7 0x00 0x0f 0xf3 0x00 0x24 0xfb

I2C START
TX: 0xC0 NACK 0x1A NACK 0xB5 NACK 0xA7 NACK 0x00 NACK 0x0F NACK 0xF3 NACK 0x00 NACK
    0x24 NACK 0xFB NACK
I2C> [ 0xc0 0x2a 0x00 0x04 0x00 0x2a 0xe0 0x00 0x00 0x00

I2C START
TX: 0xC0 NACK 0x2A NACK 0x00 NACK 0x04 NACK 0x00 NACK 0x2A NACK 0xE0 NACK 0x00 NACK
    0x00 NACK 0x00 NACK
I2C> [ 0xc0 0x5a 0x00 0x00

I2C START
TX: 0xC0 NACK 0x5A NACK 0x00 NACK 0x00 NACK
I2C> [ 0xc0 0x95 0x00 0x00 0x00 0x00 0x00 0x00 0x00

I2C START
TX: 0xC0 NACK 0x95 NACK 0x00 NACK 0x00 NACK 0x00 NACK 0x00 NACK 0x00 NACK 0x00 NACK
    0x00 NACK
I2C> [ 0xc0 0xa2 0x00 0x00 0x00 0x00

I2C START
TX: 0xC0 NACK 0xA2 NACK 0x00 NACK 0x00 NACK 0x00 NACK 0x00 NACK
I2C> [ 0xc0 0xb7 0x92 ]

I2C START
TX: 0xC0 NACK 0xB7 NACK 0x92 NACK
I2C STOP
I2C>

It does work if I do not use repeated START:

I2C> i

This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) this device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation.


Bus Pirate 6
https://BusPirate.com/
Firmware main branch @ 305f709 (2024-10-30T10:54:09Z)
RP2350B with 512KB RAM, 128Mbit FLASH
S/N: 2EAE869F8943242C
Storage:   0.10GB (FAT16 File System)

Configuration file: Loaded
Available modes: HiZ 1-WIRE UART HDUART I2C SPI 2WIRE DIO LED INFRARED
Active mode: I2C
 I2C speed: 100kHz
 Clock stretching: OFF

Display format: Auto
Data format: 8 bits, MSB bitorder
Pull-up resistors: ON
Power supply: ON (3.3V/3.29V)
Current limit: OK (30.6mA/100.0mA)
Frequency generators: OFF

I2C> [ 0xc0 0x02 0x53 0x00 0x20 ]

I2C START
TX: 0xC0 ACK 0x02 ACK 0x53 ACK 0x00 ACK 0x20 ACK
I2C STOP
I2C> [ 0xc0 0x07 0x00 ]

I2C START
TX: 0xC0 ACK 0x07 ACK 0x00 ACK
I2C STOP
I2C> [ 0xc0 0x0f 0x00 0x0c 0x8c 0x8c 0x8c 0x8c 0x8c 0x8c 0x8c ]

I2C START
TX: 0xC0 ACK 0x0F ACK 0x00 ACK 0x0C ACK 0x8C ACK 0x8C ACK 0x8C ACK 0x8C ACK
    0x8C ACK 0x8C ACK 0x8C ACK
I2C STOP
I2C> [ 0xc0 0x1a 0xb5 0xa7 0x00 0x0f 0xf3 0x00 0x24 0xfb ]

I2C START
TX: 0xC0 ACK 0x1A ACK 0xB5 ACK 0xA7 ACK 0x00 ACK 0x0F ACK 0xF3 ACK 0x00 ACK
    0x24 ACK 0xFB ACK
I2C STOP
I2C> [ 0xc0 0x2a 0x00 0x04 0x00 0x2a 0xe0 0x00 0x00 0x00 ]

I2C START
TX: 0xC0 ACK 0x2A ACK 0x00 ACK 0x04 ACK 0x00 ACK 0x2A ACK 0xE0 ACK 0x00 ACK
    0x00 ACK 0x00 ACK
I2C STOP
I2C> [ 0xc0 0x5a 0x00 0x00 ]

I2C START
TX: 0xC0 ACK 0x5A ACK 0x00 ACK 0x00 ACK
I2C STOP
I2C> [ 0xc0 0x95 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ]

I2C START
TX: 0xC0 ACK 0x95 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK
    0x00 ACK
I2C STOP
I2C> [ 0xc0 0xa2 0x00 0x00 0x00 0x00 ]

I2C START
TX: 0xC0 ACK 0xA2 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK
I2C STOP
I2C> [ 0xc0 0xb7 0x92 ]

I2C START
TX: 0xC0 ACK 0xB7 ACK 0x92 ACK
I2C STOP
I2C>

Owen

1 Like

Thank you so much for testing.

In a moment there should be a new firmware with explicit start/repeated start tracking. A repeat start sequence is sent instead of relying on the PIO program to sort it out.

Repeat starts will be sent until a stop is sent.

1 Like

Hi Ian,

That worked, thanks:

I2C> i

This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) this device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation.


Bus Pirate 6
https://BusPirate.com/
Firmware main branch @ fdd4e34 (2024-10-30T16:25:38Z)
RP2350B with 512KB RAM, 128Mbit FLASH
S/N: 2EAE869F8943242C
Storage:   0.10GB (FAT16 File System)

Configuration file: Loaded
Available modes: HiZ 1-WIRE UART HDUART I2C SPI 2WIRE DIO LED INFRARED
Active mode: I2C
 I2C speed: 100 kHz
 Clock stretching: OFF

Display format: Auto
Data format: 8 bits, MSB bitorder
Pull-up resistors: ON
Power supply: ON (3.3V/3.29V)
Current limit: OK (27.8mA/100.0mA)
Frequency generators: OFF

I2C> [ 0xc0 0x02 0x53 0x00 0x20

I2C START
TX: 0xC0 ACK 0x02 ACK 0x53 ACK 0x00 ACK 0x20 ACK
I2C> [ 0xc0 0x07 0x00

I2C REPEATED START
TX: 0xC0 ACK 0x07 ACK 0x00 ACK
I2C> [ 0xc0 0x0f 0x00 0x0c 0x8c 0x8c 0x8c 0x8c 0x8c 0x8c 0x8c

I2C REPEATED START
TX: 0xC0 ACK 0x0F ACK 0x00 ACK 0x0C ACK 0x8C ACK 0x8C ACK 0x8C ACK 0x8C ACK
    0x8C ACK 0x8C ACK 0x8C ACK
I2C> [ 0xc0 0x1a 0xb5 0xa7 0x00 0x0f 0xf3 0x00 0x24 0xfb

I2C REPEATED START
TX: 0xC0 ACK 0x1A ACK 0xB5 ACK 0xA7 ACK 0x00 ACK 0x0F ACK 0xF3 ACK 0x00 ACK
    0x24 ACK 0xFB ACK
I2C> [ 0xc0 0x2a 0x00 0x04 0x00 0x2a 0xe0 0x00 0x00 0x00

I2C REPEATED START
TX: 0xC0 ACK 0x2A ACK 0x00 ACK 0x04 ACK 0x00 ACK 0x2A ACK 0xE0 ACK 0x00 ACK
    0x00 ACK 0x00 ACK
I2C> [ 0xc0 0x5a 0x00 0x00

I2C REPEATED START
TX: 0xC0 ACK 0x5A ACK 0x00 ACK 0x00 ACK
I2C> [ 0xc0 0x95 0x00 0x00 0x00 0x00 0x00 0x00 0x00

I2C REPEATED START
TX: 0xC0 ACK 0x95 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK
    0x00 ACK
I2C> [ 0xc0 0xa2 0x00 0x00 0x00 0x00

I2C REPEATED START
TX: 0xC0 ACK 0xA2 ACK 0x00 ACK 0x00 ACK 0x00 ACK 0x00 ACK
I2C> [ 0xc0 0xb7 0x92 ]

I2C REPEATED START
TX: 0xC0 ACK 0xB7 ACK 0x92 ACK
I2C STOP
I2C>

Owen

2 Likes

Yeah! Thank you so much for the bug report and test result follow ups. Iā€™m.glad itā€™s working.

Just let me know of thereā€™s anything else.

Cheers,

Ian

2 Likes

Small issue, see the corrupted prompt for clock stretching:

I2C> m 5


Use previous settings?
 I2C speed: 100 kHz
 Clock stretching: OFF

y/n, x to exit (Y) > n

I2C speed
 1kHz to 1000kHz
 x. Exit
kHz (400kHz*) > 100
Clock stretching
 1. OFF
 2. ON
 x. Exit
Ć°Ā©?Ć°Ā© (0) > 1
Mode: I2C
I2C>
3 Likes

Thank you I will push a fix.

1 Like

Thanks again for the bug reports!

I pushed a fix. This was a little bug that crept in during the recent rework of the I2C PIO program. I think itā€™s good to go now. Happy Bus Pirate-ing!

1 Like

Thanks.

Bus Pirate 6
https://BusPirate.com/
Firmware main branch @ 8e51eb6 (2024-10-31T11:09:12Z)
RP2350B with 512KB RAM, 128Mbit FLASH

Works fine now.

Owen

1 Like