1

I have an Arduino Pro Micro(blue version) and I'm having trouble using the I2C. To test it, I use the code below and the result is an infinite square wave on SCL and SDA lines and I only get the number 1 on the terminal output. I have pullup resistors on both wires, 2k each. Since the board uses an ATMEGA32U4, I tried the same code on a bare MCU and the code works as expected. The difference between the two is the bootloader type. The bare PCB is flashed over USB, using the factory bootloader(ATMEGA32U4-AU, QFP44). By debugging the code, I found out that endTransmission does not return. Does anyone have an idea, why the I2C is not working as expected on the Pro Micro module?

Thanks!

#include <Wire.h>
void setup() {
 Serial.begin (115200);
 // Leonardo: wait for serial port to connect
 while (!Serial)
 {
 }
 Serial.println ();
 Serial.println ("I2C scanner. Scanning ...");
 byte count = 0; 
 Wire.begin();
} // end of setup
void loop() {
 byte count = 0;
 for (byte i = 1; i < 120; i++)
 {
 Serial.println(i);
 Wire.beginTransmission (i);
 Wire.endTransmission ();
 delay(10);
 }
}
asked Nov 26, 2020 at 13:27
10
  • What do you mean by "infinite square wave"? Does that mean, that both SDA and SCL get continuously pulsed forever, when Wire.endTransmission() blocks? Commented Nov 26, 2020 at 13:38
  • Yes, and it does not stop. The waveform looks good, signal level is VCC and GND for 1 and 0. Commented Nov 26, 2020 at 14:12
  • 1
    Mhh, strange. Does this also happen, when nothing is connected to the bus? Commented Nov 26, 2020 at 14:24
  • 1
    Yes, that's right. Commented Nov 26, 2020 at 15:06
  • 1
    And nothing is printing on the Serial Monitor? then I guess your microcontroller is broken. Your sketch seems legit to me. And the lines should never just pulse continuously. A common problem is the bus getting stuck, because one line gets stuck at low, but I haven't seen your problem ever. Can you tell us the frequency of the pulses? Just to check Commented Nov 26, 2020 at 15:38

1 Answer 1

2

Seems like the module has a defect, since the same code on another board produces the expected output on the I2C lines

answered Nov 27, 2020 at 21:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.