Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 3 months ago.
I2C does not work after changing SystemCoreClock
Hi,
Problem appears on the STM32L476 (Nucleo). When SystemCoreClock is 80MHz (mbed system_clock.c file without changes) everything works fine: I2C, UART, SPI. After changing SystemCoreClock for other frequency (eg. 24MHz) I2C does not work (SPI and UART works fine like before: debug, memory). I wrote I2C discoverer. Before changes (80MHz) it discover different devices (3-on bus). After changes (clock 24MHz) discoverer discover nothing. I changed frequencies: 100kHz, 400kHz without result. My piece of file core_clock.c changes:
RC48MHz, HCLK 24MHz RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_11; /* 48 MHz */ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI; RCC_OscInitStruct.PLL.PLLM = 6; /* 8 MHz */ RCC_OscInitStruct.PLL.PLLN = 24; /* 192 MHz */ RCC_OscInitStruct.PLL.PLLP = 7; /* 27.428571 MHz */ RCC_OscInitStruct.PLL.PLLQ = 4; /* 48 MHz */ RCC_OscInitStruct.PLL.PLLR = 8; /* 24 MHz */
SystemCoreClock displayed in debug is 24MHz. I suppose it's a clocks problem so what else should I change?
If you manually set the I2C frequency (on the I2C object), can you get the bus to work again?
posted by Jan Jongboom 12 Oct 2017