How to turn on a LED modyfing registers directly?
Hi to all,
I'm trying to use the Nucleo F446RE board to switch on an external LED. by using directly the registers
IN particular, I have connected the pin PA5 in series with a resistor, a LED and finally with the GND of the board.
The code uses is shown before. Initially I have activated the AHB1 internal pheripheral. Then, I enabled and forced to HIGH the pin PA5 of the board.
int main(int argc, char* argv[])
{
/** AHB1 **/
volatile uint32_t *RCC_AHB1ENR = 0x0;
RCC_AHB1ENR = (uint32_t*)(0x40023800 + 0x30);
*RCC_AHB1ENR = *RCC_AHB1ENR | 0x1;
/** GPIOA **/
volatile uint32_t *GPIOA_MODER = 0x0, *GPIOA_ODR = 0x0;
GPIOA_MODER = (uint32_t*)0x40020000;
*GPIOA_MODER = *GPIOA_MODER | 0x400;
GPIOA_ODR = (uint32_t*)(0x40020000 + 0x14);
*GPIOA_ODR = *GPIOA_ODR | 0x20;
/** Infinite loop **/
while (1);
}The code is correctly compiled and loaded on the board, bu the problem is that the LED doesn't turn on. Can someome suggest how to modify the code? There are some other registers to modify? Something else to do?
Thank you very much in advance.
