2013-10-06 11:59 PM
hello forum. I am new at arm so first I want to use the GPIO. I use stm3210c-eval. and this development board use stm32f107VC. I write code like this.
#include ''stm32f10x.h''#include ''stm32_eval.h''#include <stdio.h>GPIO_InitTypeDef GPIO_initstructure;void delay(void){ uint8_t i,j; for(j=0;j<250;j++) { for(i=0;i<250;i++); } i=0; j=0;}/** * @brief Main program. * @param None * @retval None */int main(void){ /* Infinite loop */ while (1) { // ilk olarak kullanacagimiz pinlerin bagli oldugu portun clock'unu belirlemeliyiz. RCC_AHBPeriphClockCmd(RCC_APB2Periph_GPIOD,ENABLE); // daha sonra port d den hangi pinlerin kullanilacagini , bu pinlerin clock'unu ve mod'unu belirlemeliyiz. GPIO_initstructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 ; GPIO_initstructure.GPIO_Mode = GPIO_Mode_Out_OD; GPIO_initstructure.GPIO_Speed = GPIO_Speed_50MHz; // bu kadar ayarlama pin ayarlarini yapmak için yeterlidir. Simdi biz bu ayarlar1 kaydetmek zorundayiz. Daha sonra program calisacaktir. GPIO_Init(GPIOD,&GPIO_initstructure); // böylelikle pin ayarlamasi bitti . simdi bu pinlerle ne yapacagimizi bulmaliyiz. while(1) { GPIO_SetBits(GPIOD,GPIO_Pin_13); GPIO_SetBits(GPIOD,GPIO_Pin_14); delay(); GPIO_ResetBits(GPIOD,GPIO_Pin_13); GPIO_ResetBits(GPIOD,GPIO_Pin_14); delay(); } }} #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */void assert_failed(uint8_t* file, uint32_t line){ /* User can add his own implementation to report the file name and line number, ex: printf(''Wrong parameters value: file %s on line %d\r\n'', file, line) */ /* Infinite loop */ while (1) { }}#endifBut when I load the code to the board , nothing happens. So I debugged the code but in debug , program not exist below code part. How can I solve this problem ? do { HSEStatus = RCC->CR & RCC_CR_HSERDY; StartUpCounter++; } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));2013-10-07 04:18 AM
RCC_AHBPeriphClockCmd(RCC_APB2Periph_GPIOD,ENABLE);
Not AHB then.2013-10-08 10:49 AM
thank you clive but still this code doesnt work and problem is same . Have you any suggestion ?
2013-10-08 11:13 AM
Well if you're attempting to start the HSE, and it's not starting, then you need to examine the board, and the signal at the oscillator. Make sure there are no jumper or solder-bridge settings related to the clock source.