Skip to content

Using both I2C lines on STM32F103C8 results in NACKs after some time. #699

Closed
@TByte007

Description

@TByte007

I'm using the I2C on PB6/PB7 for communicating with another controller - ESP8266 as master and STM32F103C8 as slave and the I2C on PB10/PB11 as master to communicate with sensors. But after a while (random) the ESP8266 receives only Wire error "2:received NACK on transmit of address" on Wire.endTransmission() until I reset the F103C8. I'm guessing there it's some kind of interrupt race condition happening but I thought that the controller should be able to manage both I2C without interference ? If I disable the second I2C (PB10/11) everything works forever but I want the sensors :)

PS1: May be mask I2C1 interrupt vector when communicating on I2C2 - could that be a
part of the Wire library ?

PS2: This made it work with frequent errors to the master but at least the F103C8 doesn't die horribly :)

    Wire.end();
    err = compass.read();
    Wire.begin(I2C_DRIVEMOD);         // join i2c bus
    Wire.onRequest(requestEvent); // register event
    Wire.onReceive(receiveEvent); // register event

Of course that is insane way of doing it and it's crazy slow - I'm sure there should be a better way of using both I2C lines :)

PS3: I found the same problem described on the STM's site and it doesn't seem like anybody from STM cared to reply for a year ...

https://community.st.com/s/question/0D50X00009yHD6SSAW/issue-when-using-i2c1-and-i2c2-simultaneously-with-stm32cubefwf0v190

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions