Problem with demo without OS
Posted: Tue Dec 08, 2015 11:28 am
Hello.
I made a simple "hello world" project(blinking LED on PB2), using stm32l4discovery board.
For the first time i didn't use OS.
everything was OK.
After that i wrote the following:
Nothing happened:(
Registers PUPDR, OTYPER, OSPEEDR i didn't use, because config. bits for that registers have the same values as in the reset state.
Can someone help me? What is a difference?
Thanks
I made a simple "hello world" project(blinking LED on PB2), using stm32l4discovery board.
For the first time i didn't use OS.
Code: Select all
#include "ch.h"
#include "hal.h"
#include "test.h"
int main(void)
{
halInit();
palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL);
while(1) {
for(volatile int32_t i = 0; i < 300000; i++);
GPIOB->ODR ^= 1 << 2;
}
}
everything was OK.
After that i wrote the following:
Code: Select all
#include "ch.h"
#include "hal.h"
#include "test.h"
int main(void)
{
halInit();
RCC->AHB2ENR |= RCC_AHB2ENR_GPIOBEN;
GPIOB->MODER |= GPIO_MODER_MODER2_0;
while(1) {
for(volatile int32_t i = 0; i < 300000; i++);
GPIOB->ODR ^= 1 << 2;
}
}Nothing happened:(
Registers PUPDR, OTYPER, OSPEEDR i didn't use, because config. bits for that registers have the same values as in the reset state.
Can someone help me? What is a difference?
Thanks