2015-07-21 11:51 AM
Hello folks,
I am working with an STM32F7 Discovery board which uses an STM32F746NG microcontroller.I would like to use the I2C peripheral without using the STM32Cube HAL, just by directly accessing the registers.I manage to initialize the peripheral and I send the slave address over the bus. However, the I2C bus frequency (the frequency of the SCL line) is always way too high. I either get 1.35 MHz or 2.27 MHz although I am configuring everything to use the Standard mode 100 kHz.I use the STM32CubeMX to retrieve the correct value for the TIMINGR register. My setup uses the 25 MHz HSE and the PLL is configured to produce a 200 MHz SYSCLK. The APB1 Frequency is 50 MHz (SYSCLK/4). I verified the SYSCLK frequency by looking that the RCC status register to verify that the PLL is up and running and I read out the SystemCoreClock variable and I indeed get 200 MHz. I am also verified that I set the I2CCLK to be sourced from the APB1 clock.My code is attached. I am using I2C1 on PB8 and PB9.After about 10 hours of tears I took the RCC and I2C initialization code actually generated by the STM32CubeMX and I get the same problem.I am totally lost here. I added a scope screenshot. The signal quality is of course very bad as the bus (and the pullups) are not designed to work with this frequency.Any help is highly welcomed. #i2c #stm32f72015-07-21 01:22 PM
Wouldn't it be helpful to enable the peripheral's clock *before* programming it's registers?
2015-07-21 01:38 PM
Oh dear, I screwed up big time... Thanks for your help!