2014-05-21 02:36 PM
I have written
a small piece of Code
in
CooCox
. I want to use it for the F303 and for the F030.I have noticed
that the
reset
value
is not correct.
Regarding to the reference manual the RCC for both is identically. Reset value as written in the RM: 0x0000 XX83 where X is undefined. Binary 0000 0000 0000 0000 xxxx xxxx 1000 0011 Reading from F030 I got 0000 0000 0000 0001 0100 1000 1000 0011 And from F303 0000 0011 0000 0011 0100 0101 1000 0011Why
the readout
values
does not fit to the reset values?
Thanks This is the Code for F030, for F303 it's similar. #include ''stm32f0xx.h'' #include ''stm32f0xx_gpio.h'' #include ''stm32f0xx_rcc.h'' int Test=0; void wait(void); int main(void) { GPIO_InitTypeDef GPIO_InitStruct; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_5; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOA, &GPIO_InitStruct); //SystemCoreClockUpdate(); Test=RCC->CR; while(1) { GPIO_WriteBit(GPIOA, GPIO_Pin_5, Bit_SET); wait(); GPIO_WriteBit(GPIOA, GPIO_Pin_5, Bit_RESET); wait(); } } void wait(void) { for(int i=0;i<=100000;i++) { } }2014-05-21 03:09 PM
Depending on your toolchain, the startup code might have written to this register.
JW2014-05-21 03:39 PM
a) The Debugger
b) SystemInit() in system_stm32f0xx.c c) startup_stm32f0xx.s2014-05-21 04:07 PM
Ok, thanks.
I don't call SystemInit() in my Code, but I found these in my startup code. bl SystemInitThe startup
code
is
the same for both
. The F030 runs with 8MHz and the F303 runs at 72MHz.If he
would call
SystemInit() form system_stm32f0xx.c,
the
F030 shouldrun at
48MHz
??? A further question. The RM says I can feed the Systick directly with the HCLK. But I can't found theSysTick Control and Status Register in the RM???
The RCC feeds the Cortex System Timer (SysTick) external clock with the AHB clock (HCLK) divided by 8. The SysTick can work either with this clock or directly with the Cortex clock (HCLK), configurable in the SysTick Control and Status Register. Thanks
2014-05-21 04:16 PM
ST documents the peripheral structure in the reference manual, for the core you'd want to look at the ARM TRM (Technical Reference Manual)
Joseph Yiu's books are also a good source of reference.