cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-L4R5ZI user LED's are not turning ON

VSira
Associate II

I am a beginner in embedded coding, I am trying to turn on user LED's of nucleo-l4r5zi board but its not turning on. kindly lead me to the solution. (I am using keil)

Thanks.

Code:

#include "stm32l4xx.h"         // Device header

int main(void)

{

RCC->AHB2ENR |=3;  //enable gpio group a,b,c clock

GPIOB->MODER |=0x10004000;

GPIOA->MODER |=0x400; 

GPIOC->MODER |=0x4000;

while(1)

{

GPIOA->ODR = 0x20;  //0b 0000 0000 0010 0000  to make PA5 high

GPIOB->ODR = 0x4080; //0b 0100 0000 1000 0000  to make PB7 and PB14 high

GPIOC->ODR = 0x80; //0b 0100 0000 1000 0000  to make PC7 high

}

}

1 REPLY 1

Looks OK, except

> RCC->AHB2ENR |=3;  //enable gpio group a,b,c clock

which wouldn't enable GPIOC (you'd need to |= 7).

But at least LED on PB14 should be lit.

JW