AnsweredAssumed Answered

Can't get a device to work on I2C on STM32F4

Question asked by Drulko.Malko on Nov 1, 2016
Latest reply on Nov 2, 2016 by Drulko.Malko
Hi!

In the past, I used Arduino Mega and Uno for some project of mine that required an OLED screen based on SSD1306 driver and Real Time Clock module (Chronodot). Both work on I2C interface and worked just fine on Arduino. Chronodot uses Stephanie Maks' library and SSD1306 used u8glib. I needed more CPU power and memory, therefore I bought STM32F407. I rewrote Stephanie Maks' library to work with Tilen Majerle's I2C library for STM32F407, which is also used by SSD1306 through another one of his libraries. The SSD1306 screen worked without a problem on any I2C (I2C1, I2C2, I2C3), but I could not get Chronodot to work. I tried different I2Cx and pin packs, but still nothing. I connected it back to Arduino and it works without a problem. Yes, I could have made a mistake when rewriting the library, BUT it doesnt even pass the basic test:

01.Chronodot rtc;
02.TM_I2C_Init(I2C1, TM_I2C_PinsPack_1, 400000);   // Configure I2C for RTC
03.rtc.begin();
04./* Check if RTC connected to I2C */
05.if (!TM_I2C_IsDeviceConnected(I2C1, CHRONODOT_ADDRESS))
06.{
07.        /* Return false */
08.        return 0;
09.}

Is it possible that different I2C is used on Arduino and SSD1306 screen just includes both versions? Maybe some ACK or something? I do not fully understant everything that can change in this protocol so I can't speculate much what could be wrong. I ask for your assistance please.
Thank you!

Outcomes