Skip to content

I2C hardware or Software not working on STM32F103C8T6 with "generic STM32F103 series" selected #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nikisalli opened this issue Aug 9, 2018 · 6 comments
Labels
bug 🐛 Something isn't working
Milestone

Comments

@nikisalli
Copy link

nikisalli commented Aug 9, 2018

using a normal I2C scanner code, i keep getting random addresses detected. i tried with another core (roger's core) with the same hardware and code and it works but when i switch to the stm32duino core it doesn't work anymore.

code:
`#include <Wire.h>

void setup() {
Serial1.begin(115200);
Wire.begin();
Serial1.println("\nI2C Scanner");
}

void loop() {
byte error, address;
int nDevices;

Serial1.println("Scanning...");

nDevices = 0;
for(address = 1; address < 127; address++) {
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.

Wire.beginTransmission(address);
error = Wire.endTransmission();

if (error == 0) {
  Serial1.print("I2C device found at address 0x");
  if (address < 16) 
    Serial1.print("0");
  Serial1.println(address, HEX);

  nDevices++;
}
else if (error == 4) {
  Serial1.print("Unknown error at address 0x");
  if (address < 16) 
    Serial1.print("0");
  Serial1.println(address, HEX);
}    

}
if (nDevices == 0)
Serial1.println("No I2C devices found");
else
Serial1.println("done");

delay(5000); // wait 5 seconds for next scan
}`

@fpistm
Copy link
Member

fpistm commented Aug 9, 2018

Linked #217

@fpistm fpistm added the duplicate This issue or pull request already exists label Aug 9, 2018
@nikisalli
Copy link
Author

Isn't there a temporary fix i can use? Because from what i see it's like six months it is broken

@LMESTM
Copy link
Member

LMESTM commented Aug 10, 2018

@nikisalli Hi - please find a proposed patch to fix the scan issue - let me know if you can test on your side.

@nikisalli
Copy link
Author

@LMESTM i just tested your patch on the bluepill (stm32f103c8t6) and it works flawlessly

@LMESTM
Copy link
Member

LMESTM commented Aug 10, 2018

@nikisalli thanks for the quick feedback and testing !

@fpistm fpistm added bug 🐛 Something isn't working and removed duplicate This issue or pull request already exists labels Aug 13, 2018
@fpistm fpistm added this to the 1.3.1 milestone Sep 4, 2018
@fpistm
Copy link
Member

fpistm commented Sep 4, 2018

Fixed with #301

@fpistm fpistm closed this as completed Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants