led blinking problem in stm32f401re NUCLEO64(newbie)

hi,

 earlier i was working on PIC controller, now i am shifting to ARM and i am having stm32f401re NUCLEO64 evaluation board.

development tool chain i am using is Keil arm mdk , keil version 5. i found some notes for blinking the led on board and i followed the step.

the led is blinking attached on PA5, below is the code,

/* use delay loop, 1 sec on 1 sec off
* default 16 MHz clock
* LD2 connects to PA5
*/
#include "stm32f4xx.h"
void delayMs(int n);
int main(void) {
RCC->AHB1ENR |= 1; /* enable GPIOA clock */
GPIOA->MODER &= ~0x00000C00; /* clear pin mode */
GPIOA->MODER |= 0x00000400; /* set pin to output mode */
while(1) {
GPIOA->BSRR = 0x00000020; /* turn on LED */
delayMs(500);
GPIOA->BSRR = 0x00200000; /* turn off LED */
delayMs(500);
}
}
/* 16 MHz SYSCLK */
void delayMs(int n) {
int i;
for (; n > 0; n--)
for (i = 0; i < 3195; i++) ;
}
 

now when i want to change the pin PC10 on PORTC. the register i changed is

RCC->AHB1ENR |= 0x04; /* enable GPIOA clock */

GPIOC->MODER |= 0x00200000; /* set pin to output mode */

GPIOC->BSRR = 0x00000400; /* turn on LED */
below is the edited code and i am getting nothing. this is the first attempt on stm32 controller. please help me out.

/* use delay loop, 1 sec on 1 sec off
* default 16 MHz clock
* LD2 connects to PC10
*/
#include "stm32f4xx.h"
void delayMs(int n);
int main(void) {
RCC->AHB1ENR |= 0x04; /* enable GPIOA clock */
//GPIOA->MODER &= ~0x00000C00; /* clear pin mode */
GPIOC->MODER |= 0x00200000; /* set pin to output mode */
while(1) {
GPIOC->BSRR = 0x00000400; /* turn on LED */
delayMs(500);
GPIOC->BSRR = 0x04000000; /* turn off LED */
delayMs(500);
}
}
/* 16 MHz SYSCLK */
void delayMs(int n) {
int i;
for (; n > 0; n--)
for (i = 0; i < 3195; i++) ;
}

More questions in this forum