DUE with I2C SSD1306 crash on EEPROM write.

Hi Repetier,

I know that this is modified code and will probably never work, but I try to ask. :)

I have a DUE with an EEPROM on the I2C bus. This works great with SPI SSD1306, but the displays I have does not have CS pin, only RESET. That is bad.

So I added an I2C SSD1306 display to the same bus as the EEPROM. The code would not compile as the U8G lib has no I2C interface for DUE. I copied the interface for ARDUINO to the DUE and it compiles and runs fine.

But the firmware crash and reboot anytime I try to update the EEPROM.

I assume that this is a clash between U8G and the EEPROM code. Is there any way to fix this or must I just switch back to the SPI display?

Thank you,
Errol

Comments

  • With I2C use the latest dev release. RAyBW had done some experiments on this problem and detected that there were some implementation problems with more then one device and this has been patched, so at least several devices on I2C are possible. But think about the logic level! Due works with 3.3V I2C logic level and I'm not sure the SSD1306 does as well, so that might be also a problem.

    Maybe it is easier to use software SPI in your case, Then the missing cs should not be a problem.
  • Hi Repetier,

    Thank you for the message.

    This was with the development branch, downloaded on 05/30, which is after the last commit.

    The SSD1306 is a 3V3 device, so it is happy.

    I did switch back to the soft SPI. :)

    Thank you,
    Errol

  • Hi errolt,
    did you check if devices are set for the same I2c speed ?
    regards,
    RAyWB


  • Hi RAyWB,

    I am unable to set the I2C speed of the devices. But the EEPROM reads on startup and the OLED works fine. Only when the EEPROM is written does it crash.

    But I might have gotten confused will all my firmware folders and actually flashed a firmware that is a month old. I will try to test again this weekend and will report back...

    Thank you,
    Errol

  • edited June 2016
    i guess you use uiconfig for settings of the display , eeprom is usually set in pins.h
    so search for #define TWI_CLOCK_FREQ          400000 (used for eeprom in pins.h)
    also search for
    #define UI_I2C_CLOCKSPEED 100000L (used in uiconfig)
    set both to the same value ,best is to start on 100000.

    i think the problem is located in different values, i spent a lot of time on the i2c stuff for due,
    original implementation was not correct but is fixed now.
    as i don´t have such a display i cannot test it for you, but i know multiple i2c components are working.
    i have i2c eeprom , two mcp23017 and one pcf8574 working at the same time without an issue.

    kind regards,

    RAyWB

    PS: which I2C port of due do you use? the one near AREF needs external Pullups while PIN20 and21 have Pullups installed
    on DUE.anyway I2C is sensitive on wiring...best to use is twisted pair and as short as possible.
    I2C initially was designed as Inter-Inter-Circuit bus to work on PCB only.
    for longer distances there are special drivers available for example 82B715 or 82B96 .
    I made 20 meters throug noisy environment with a set of 82B96  so if you need help i can try to support you

  • No luck. OLED says V1.0.0dev, so newest version.

    Using pins 20,21.

    Tried both 100KHz and 400KHz for both settings.

    Don't think it is a noise issue.
    The OLED works 100% fine.
    The EEPROM works fine if the OLED is on SPI, both reading and writing.
    The EEPROM reading works when the OLED is connected to I2C, but writing causes a delay of a second or two, the a reset.

    Note that this is an I2C OLED, U8GLIB_SSD1306_I2C. I don't know if the U8GLIB I2C does not like repetier i2c. The U8G lib does not have I2C hardware interface code for the DUE, so I had to copy the code from the Arduino over to the DUE...

    Thank you,
    Errol

  • Due caches eeprom values. So on startup complete eeprom is read into ram and never used to read again. And since it is initalized first that is the reason it works. After that I guess reading will also not work due to same reason write is not working. But I also can not say when u8g does for I2C. They have their own implementation I think and I guess they change I2C configuration to something incompatible for eeprom.
Sign In or Register to comment.