2019-09-06 08:19 AM
Hi,
I am using KEIL to program PA5 pin which is connected to the user LED. But after writing the program, I am unable to get the LED on. It is a simple program but I am not sure, why it is not working. Any help will be appreciated.
#include "stm32l0xx.h" // Device header
int main (void)
{
RCC->IOPENR |= 0x1;
GPIOA->MODER |= (1<<10);
while(1)
{
GPIOA->ODR = 0x20;
}
}
Regards,
Tapas
2019-09-06 12:17 PM
This looks OK.
You can in Keil single-step the program, and/or check the registers content.
JW
2019-09-07 08:39 AM
Hi,
I am able to turn ON Led in F407 discovery board.
But why it is not working in L053/73 board.
I have spent three hours reading reference manual but unable to get the answer.
Code that is working in F407 discovery board
#include "stm32f4xx.h" // Device header
int main(void)
{
RCC->AHB1ENR |= 0x8;
GPIOD->MODER |= 0x1000000;
while(1)
{
GPIOD->ODR = 0x1000;
}
}
Regards,
Tapas
2019-09-08 12:57 AM
As I told you, look at the register's in the debugger.
You would then probably spot that MODER content is not what you intended, as in 'L0 its reset default content is not 0x00000000 as in the 'F4.
JW