cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware Reset Affecting Input Capture Direct?

GEvan.1
Associate

Hi,

I have come across an unusal problem and I can't seem to figure out.

I am using an RC transmitter to send signals to a receiver that is hooked up to an STM32F411VE board. I am reading the receiver signal using input capture direct mode (timer 2, channel 2). I am reading a consistent range of values. It works, and I am able to calculate an angle which steers a servo. All good up until this point.

The Problem:

After flashing the board via USB (Visual GDB) the code works perfectly, as expected. However, if I hit the reset button on the dev board when it's running, the board resets and my input captured values suddenly change (much lower than before). The same thing happens if I power up the board via USB/Battery Pack or VDD pin. This does not happen during a software reset from IDE, only on hard reset or power up. The code is not crashing (it is still running, no hardfaults).

What could be causing my input capture values to be correct on the inital run after flashing the code, but different when booting the board up without PC connection?

Firmware for the board is all up to date. Communicating to the board via ST-Link.

-TIM1 and TIM3 are used for PWM generation for a motor and a servo.

Here is my config for Timer 2:

0690X00000BwM9yQAF.png

Thanks for reading. If you have an ideas please leave them below, I'd really appreciate it. Hopefully someone a lot more experienced can explain this issue

1 REPLY 1
Bob S
Principal

Perhaps running using the debugger/IDE is initializing some clock circuitry differently than from a hard reset. The debugger startup script may be setting something that your code doesn't. If you have a debug port, add code to output the clock configuration registers after you call HAL_Init() and see if they match from the IDE and from a hard reset or power-on.

Or the reset vector in the interrupt vector table isn't correct. Debugging with the IDE usually doesn't actually use the reset address in the vector table. It uses the "start" address from the ELF file.