-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Problem:
When performing the first write transaction of the i2c scanner example, there is never a NACK, even if no device is attached on the bus.
Hardware required:
1x STM32F072 Nucleo
2x appropriate (for example 4.7KOhm) pullup resistor (alternatively, use any known OK I2C breakout board with a known I2C address which already includes pullups)
1x https://github.com/stm32-rs/stm32f0xx-hal/blob/master/examples/i2c_find_address.rs (for easier pin access, you may want to change the SDA pin to be PB9 instead of PB7)
Steps to reproduce:
-
Wire up the pull up resistors from SCL/SDA to 3v3.
-
Run the i2c scanner example: https://github.com/stm32-rs/stm32f0xx-hal/blob/master/examples/i2c_find_address.rs
- Expected:
_devices
== 0 - Actual:
_devices
== 1, ACK at address 0 - If you see a lot of ACKs, your pull-ups could be wrong
- Change start address in line 32:
for add in 0..=127 {
- Expected:
_devices
== 0 - Actual:
_devices
== 1, ACK at address e.g. 6
- Before the scan loop, add this line:
let _ = i2c.write(0x4, &[]);
and re-run the scan.
- Expected:
_devices
== 0 - Actual:
_devices
== 0 (yay!)
- (Optional) Remove the line added in step 4. Attach an I2C sensor with known address to the bus and re-run the scan.
- Expected:
_devices
== 1 - Actual:
_devices
== 2
Metadata
Metadata
Assignees
Labels
No labels