2014-10-20 03:00 PM
Hi all, I am working with the STM32F4 Discovery board and I changed the Standard Periph Library from 1.0 to 1.4
With the 1.4 version the boards run slow with this code:#include ''stm32f4xx_conf.h''
#include ''stm32f4xx.h''
GPIO_InitTypeDef GPIO_InitStructure;
void Delay(__IO uint32_t nCount) {
while(nCount--) {
}
}
int main(void) {
/* GPIOD Periph clock enable */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
/* Configure PD12, 13, 14 and PD15 in output pushpull mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOD, &GPIO_InitStructure);
while (1) {
/* Set PD12 Green */
GPIOD->BSRRL = GPIO_Pin_12;
/* Reset PD13 Orange, PD14 Red, PD15 Blue */
GPIOD->BSRRH = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
Delay(10000000L);
/* Set PD13 Orange */
GPIOD->BSRRL = GPIO_Pin_13;
/* Reset PD12 Green, PD14 Red, PD15 Blue */
GPIOD->BSRRH = GPIO_Pin_12 | GPIO_Pin_14 | GPIO_Pin_15;
Delay(10000000L);
/* Set PD14 Red */
GPIOD->BSRRL = GPIO_Pin_14;
/* Reset PD12 Green, PD13 Orange, PD15 Blue */
GPIOD->BSRRH = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_15;
Delay(10000000L);
/* Set PD15 Blue */
GPIOD->BSRRL = GPIO_Pin_15;
/* Reset PD12 Green, PD13 Orange, PD14 Red */
GPIOD->BSRRH = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14;
Delay(10000000L);
}
}
I set HSE_VALUE to 8000000 with the both library but the speed of leds is half with the 1.4 library.
Anyone know what is happening?
I use Ecipse IDE.
Thnaks
2014-10-20 04:43 PM
Guess you want to make sure what system_stm32f4xx.c is doing with the PLL, and defines for which CPU. Also make sure you aren't using the F401C code, as that part runs at 84 MHz, not 168 MHz.
2014-10-20 04:48 PM
1.4? DSP Library
STM32F4-DISCO V1.1.0http://www.st.com/web/en/catalog/tools/PF257904
2014-10-21 06:00 AM
Thanks for reply.
I use this library I think the problem is the system file you means, I check this at this night.Regards.2014-10-21 02:08 PM
Hi Clive , you were right , the problem was the system_stm32f4xx.c file.Now it works fine.Thanks for your time.