cancel
Showing results for 
Search instead for 
Did you mean: 

input capture help or other suggest

amor88_star
Associate
Posted on May 20, 2014 at 01:21

hello 

I am using STM32f100C8 on this controller implemented :

  • Tim4 that work as global clock for all the functions (generating ticks and counter with  flags compare to seconds )
  • Tim3 work as PWM but it implemented manually using the timer4 ticks as I put the port high and low manually after checking the timer and the port status (all these steps of PWM done in ISR with pirotry less that the ISR of TIM4)
  • this PWM is connected to current booster (using transistor and coil and store the charges in a capacitor).
  • I change the PWM duty cycle according to the voltage on Capacitor (get this value using ADC)
the problem that while the code running the signal of the PWM hang to be high that make the current in the coil increase until I hear the coil sound and I didn't stop the coil get burned 

this problem happen completely random and I haven't notice any condition to initiate it 

the hardware design don't allow me to connect the debugger while the current booster working to get in which part this problem happen and why it stuck with high out of the PWM

any idea to troubleshoot this bug is highly appreciated 

I think I can use input capture as I hardware connected this PWM port with PB15 wired and try to configure the timer to capture any high pulse with width over than 14us

so if input capture can  solve this problem to get where this bug generated

plz show me the code to configure the timer and remap this timer as this is my first time to deal with input capture  

thanks in advance

#input-capture
2 REPLIES 2
Posted on May 20, 2014 at 01:51

Review the code more carefully.

Have the hardware generate the PWM, if software crashes input capture isn't going to help.

Make sure you don't program the HW PWM with any values which will cause if to operate out-of-bounds, set it to zero so it doesn't generate any signal.

Figure out how to debug the current set up, use GPIO, SWV or USART to output real-time telemetry information. Having a debugger dead-stop critical systems where things can burn out is a bad plan. Have a kill button to place the system in a safe state, consider a software watchdog to do the same.

Code something on a system you CAN debug, by emulating the hardware cap/coil, and fake ADC readings. Experiment and test this system with a scope until you understand the mechanics and the mode of failure in your current system.

Review other input capture or pwm input examples, and add them to your emulation.

If you have to get real measurements to do this, rather than figure out how it should behave, then set up a system to record and/or output diagnostic reading via a serial port. Capture this, and sacrifice a few coils to understand and replicate this in your emulation model.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
amor88_star
Associate
Posted on May 25, 2014 at 11:05

thanks I have tried it all but unfortunately it didn't work 

so I want to ask if there is any way that I can stop the program once the high pulse width become more than a certain value

can input capture  be triggered to activate a interrupt if the pulse width come over a certain value  ?

thanks in advance