WiPy LoPy I2C with ATMEGA



  • I tried to to connect my LoPy with an Arduino Pro Mini @ 8MHz 3.3V via I2C. The results were not the expected.

    The reason I want to do this, is that I must count pulses from various devices. ESP8266 and ESP32 are not stable with ISR so I decided to keep the ATMEGA with the bug free hardware interrupts at PINS 2,3. Currently I use Software Serial with UART and it works just fine. But I would like to go further using I2C.

    I tested the solution but it didn't work. I was getting wrong bytes from time to time and that's why the setup is considered as not reliable.

    Does anybody managed to achieve this?

    Thanks
    Constantinos



  • @jmarcelino Cables are really very short. Can't be shorter... Baud rate is 100000. I tried different baud rates but this value seems to be the correct.

    I will try the pullup resistors today



  • Are you using the Arduino libraries with your ATMEGA? If so those enable AVR's internal pull-ups too, so you have two devices enabling weak, not really up to the job, pull-ups at both ends. I guess it's very possible the bus isn't really running on spec doing that.

    I don't know if you can disable the pull-ups on the Arduino or Pycom side, but maybe worth investigating.

    Edit : On the Arduino side you should be able to

      digitalWrite(SDA, 0);
      digitalWrite(SCL, 0);
    

    After calling Wire.begin to disable the pull-ups? Maybe that could help.



  • @constantinos
    Have you tried lowering your I2C speed (baurate= init parameter)?

    Also how long is your cable? You can try adding external pull-up (to 3.3V) resistors too (maybe 4.7K)



  • @constantinos
    Maybe because I2C is still software implementation...


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.