cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube for STM32F4-Discovery

joe14
Associate
Posted on February 28, 2014 at 21:37

Hello, 

I tried and tried to connect my discovery board to i2c device and it didnt work. Today i saw, there si new version of software out, that had some changes in i2c scripts but i still cant connect. Can anyone confirm, that i2c scripts for stm32f4-discovery are working?

thanks, joe

#discovery #i2c #stm32f4
1 REPLY 1
joe14
Associate
Posted on March 01, 2014 at 23:42 Hello, just a quick update if anyone has same problem. I didtn expext that STM32F4Cube's libs are programed so, that you actualy have to write 7bit I2c addres shifted for 1 bit in command. So if you want to write to device adressed 0x40, you have to use :

while(HAL_I2C_Master_Transmit(&I2cHandle, (uint16_t)0x40<<1, (uint8_t*)aTxBuffer, (uint16_t)TXBUFFERSIZE, (uint32_t)1000)!= HAL_OK)

More details :

http://scriptogr.am/jtech/post/note-to-myself-about-i2c-adressing-on-stm32f4-discovery

have fun