HAL_Delay() not working properly?
Hi,
I'm working on a project to create a voltage inverter controlled by a STM32103C8T6 (the bluepill). Later, I intend to include a boost converter to have a better voltage control.
The problem is that my delays aren't working properly. Where I should get 7ms, I get 8ms, and where I should get 1ms, I get 2ms.
In the infinite loop is
GPIOA->BSRR = GPIO_PIN_9; // Bit 9
HAL_Delay(7);
GPIOA->BRR = GPIO_PIN_9;
HAL_Delay(1);
GPIOA->BSRR = GPIO_PIN_10; // Bit 10
HAL_Delay(7);
GPIOA->BRR = GPIO_PIN_10;
HAL_Delay(1);In the inverter's output, I'm getting 50Hz when I should get 62.5Hz approximately.
The complete code is available in https://gist.github.com/adailtonjn68/b80a8f2370d5024dc6b750ffe0dad0b8
I'm configuring the MCU to run at 72MHz, the basic project is generated in CubeMX, and I use CubeProgrammer to program the MCU through ST-Link V2.
It is important to mention that I am a newbie in STM32 programming. My experience I have is programming Arduinos, PIC16F and PIC12F. I do think that I'm missing something. What is it? Please, help me.
