2023-05-12 08:43 AM
Hi, I'm using STMH755BIT MCU.
I've configured three TIM1 channels to generate PWM signals, everything is working correcty except during the initial phase of software download, when PWM signals self-enable for approximatly 150ms, and then return correctly turn inactive, until the program starts.
How to solve this unexpected behaviour of output PWM signals during flashing phase?
Regards,
2023-05-12 12:04 PM
What does "initial phase of software download" mean? Is this programming the FLASH using CubeProgrammer either via an STLink or the built-in bootloader?
And what does "self-enable" mean? Do these pins start outputting PWM signals? Or do the output a logic high or low when you don't expect it?
Are any of the PWM pins used by the built-in bootloader? See AN2606. Or JTAG pins?
2023-05-15 02:35 AM
The described problem occurs when I start debug from STM32CubeIDE, the PWM pins start output a PWM signals even if the application is not started.
The flashing operation is performed via STLink.
The PWM pins give as output the undesired PWM signal for 190ns, then turn off.
None of the PWM pins are used by the built-in bootloader or as JTAG pins.
Regards,
2023-05-15 09:18 AM
When debugging from CubeIDE - during the process of detecting the STM32 CPU and downloading the new firmware image there is a "short" time where the CPU is reset and then starts running the existing firmware before the download starts. On my systems I see a dozen or so lines of debug output on my serial port from my init code. That may be what you are seeing. That doesn't happen when the code runs without the IDE trying to start a debug session.
If this messes with your hardware (like, starts a motor running when you don't expect it), you may be able to avoid that by placing a sufficiently long delay near the top of main(), with the delay long enough that the code never gets past this delay during the debugger startup. Obviously after HAL_Init() so that SysTick is running. I don't think there are any IDE settings to avoid this, but I have not looked.