Question
Can't get a device to work on I2C on STM32F4
Posted on November 01, 2016 at 13:19
Hi!
In the past, I used Arduino Mega and Uno for some project of mine that required an OLED screen based onhttp://www.thebackshed.com/forum/uploads/jman/2014-12-21_042323_IMG_1JPG
driver and Real Time Clock module (http://docs.macetech.com/doku.php/chronodot
). Both work on I2C interface and worked just fine on Arduino. Chronodot uses Stephanie Maks'https://github.com/Stephanie-Maks/Arduino-Chronodot
and SSD1306 usedhttps://github.com/olikraus/u8glib
. I needed more CPU power and memory, therefore I bought STM32F4 I rewrote Stephanie Maks' library to work with Tilen Majerle'shttps://stm32f4-discovery.net/2014/05/library-09-i2c-for-stm32f4xx/
for STM32F407, which is also used by SSD1306 throughhttps://stm32f4-discovery.net/2015/05/library-61-ssd1306-oled-i2c-lcd-for-stm32f4xx/
. 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:
Chronodot rtc;
TM_I2C_Init(I2C1, TM_I2C_PinsPack_1, 400000);
// Configure I2C for RTC
rtc.begin();
/* Check if RTC connected to I2C */
if
(!TM_I2C_IsDeviceConnected(I2C1, CHRONODOT_ADDRESS))
{
/* Return false */
return
0;
}
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!
#i2c-ssd1306-stm32f4-chronodot