Hi,
I am trying to write a simple application in C++ and HAL on STM32F405, but I am experiencing strange problem when I turn on optimization (from “None” to “Optimize for GDB”):
The timer which I initialize for PWM control of RGB LED strip (using channel 1,2 and 3) has CCMR register set for channel to work as input instead of output as shown in the attached screenshot from VS.
I also can not write to registers of output compare (CCR1,2,3) even with Hardware Registers view.
The code looks as follows:
main.cpp
#include <stm32f4xx_hal.h>
#include “LedStrip.h”
int main() {
HAL_Init();
LedStrip::Init();
LedStrip::SetColor(0xAA55AA); //here I set breakpoint and observe registers or manually try to set CCRx
while (1);
}
The LedStrip class is attached as source files with the mentioned screenshot below.
I am using VisualGDB 5.2R9 Embedded edition on Windows 10 x64, STM32F405, NewLib Nano or Standard library (same problem)
Could anyone please know what I am doing wrong / where is the problem?
Thanks in advance, Jiri
//EDIT
Can not upload .cpp file, here it is: https://1drv.ms/f/s!ApINDtgYn4CiiLpMIdDdP77qS-va7g
-
This topic was modified 7 years, 2 months ago by jiris97. Reason: File missing
Attachments:
You must be
logged in to view attached files.