2016-11-01 05:19 AM
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
2016-11-01 02:23 PM
Hi,
I guess you double checked all connections and HW wise everything is correct ( for example I read the the Chronodot doesn't have pull up resistors on board which are necessary for the I2C, so I assume you have them on the STM32F4 board... )Your code looks correct, my only hint is to verify the Slave Address of the Chronodot.On the Arduino you use 0x68 ( just the 7 bits ) on TM library ( and in general STM32 I2C libraries ) you must specify the full 8 bits, so the address should be 0xD0..Massimo2016-11-02 03:13 AM
Thank you for response!
Yes, that was exactly it, 8-bit address instead of 7-bit. I even read an article on addresses and I couldn't figure out that it was wrong. Thank you so much!