calin 4 Posted December 23, 2012 Share Posted December 23, 2012 I am doing a fan controller using PWM. All nice, things work good etc. but I noticed something really odd on PWM output the transition has an super nasty ringing happening which is almost 5V peak to peak. It overshoots really nasty in both directions/transitions. I used the sample code from TI with just the launchpad nothing else connected except the scope. Tried different pins instead of 1.6 also .. same. Normally the output should swing smoother - a ring from 3.6V to 5V is huge. Did you guys ever noticed something like that ? pretty nasty. BTW ... with a simple 1uF cap to ground i reduced the spike/ring to 4.12 and it settles very fast but still I find this annoying. Especially when you switch transistors the spike does not very nice things down the line. #include <msp430g2231.h> void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1DIR |= BIT6; // P1.6 P1SEL |= BIT6; // P1.6 TA1/2 options CCR0 = 512-1; // PWM Period CCTL1 = OUTMOD_7; // CCR1 reset/set CCR1 = 384; // CCR1 PWM duty cycle TACTL = TASSEL_2 + MC_1; // SMCLK, up mode _BIS_SR(CPUOFF); // Enter LPM0 } Gyula84 1 Quote Link to post Share on other sites
jsolarski 94 Posted December 24, 2012 Share Posted December 24, 2012 I am using nearly the exact same code for PWM, I have yet to have any issues with it.One thing I did notice, my o-scope does over shoot and under shoot, I was also using a very simple transistor(2222) switch with 5v A few questions for you? are you measuring teh PWM with a motor attached? Do you have a diode attached to the inductive load? what is the circuit you are using? and where are you measuring the PWM from? Quote Link to post Share on other sites
Lgbeno 189 Posted December 24, 2012 Share Posted December 24, 2012 Posting a scope trace may help too Quote Link to post Share on other sites
calin 4 Posted December 24, 2012 Author Share Posted December 24, 2012 Circuit is literally just the launchpad with nothing attached. PWM output on P1.6. Hooked up to my computer USB (so powered by USB). So no motor no load no nothing. And I am 100% my scope does not overshoot BTW, I did tested with the motor and the 2222 attached also .. exactly same ringing. Yeah I have the fly-back diode etc on. The annoying thing is that this ringing cause really weird things on the transistor switching. Attached are some data captures from my scope. Scale is 2V/Div . Time base is 20uS - not matching the code above because I was playing with duty cycles. Quote Link to post Share on other sites
jsolarski 94 Posted December 24, 2012 Share Posted December 24, 2012 On my scope, I get similar readings as well, And I know for a fact that my readings is caused by my scope(old school analog scope). do you have a function generator to veryify that it is not your scope? or another PWM source? Have you tried using a pulldown/pullup on the base of the transistor or are you using the built in pullup/pulldowns? have you tried a different chip to see if its just one chip? for me it still looks like a scope issue, but I could be wrong. Quote Link to post Share on other sites
calin 4 Posted December 24, 2012 Author Share Posted December 24, 2012 I have 3 scopes, signal generator also ... unless everything has gone crazy and all 3 overshoot. I tried 5-6 chips, MSP430G2231 and an 2553 - two different Launchpads ... same all of them. Each transition is one nasty spike. I am starting to regret I took MSP430 for this tiny project . But it is the right pick for this kind of job (a simple temperature controlled fan with PID) and I want to use new stuff also. Quote Link to post Share on other sites
jsolarski 94 Posted December 24, 2012 Share Posted December 24, 2012 You got me then, lol have you tried a different power supply, other then usb, or the voltage regulator on the launchpad? does the issue happen at 3V? how about min volatage? what about max voltage? maybe try to opto isolator chip could if unable to find the source of the spike. Quote Link to post Share on other sites
oPossum 1,083 Posted December 24, 2012 Share Posted December 24, 2012 What you are seeing is the result of bad measurement technique. Make sure the probe is properly calibrated and the ground lead is as short as possible. Quote Link to post Share on other sites
jsolarski 94 Posted December 24, 2012 Share Posted December 24, 2012 oPossum, I will buy you a drink if you are correct because that was my thought too. Quote Link to post Share on other sites
Lgbeno 189 Posted December 24, 2012 Share Posted December 24, 2012 I agree, just the scope check out this article http://www2.electronicproducts.com/Frequency_response_A_scope_s_key_unseen_spec-article-farc_rohde_jul2011-html.aspx Quote Link to post Share on other sites
calin 4 Posted December 25, 2012 Author Share Posted December 25, 2012 Weird, I guess it does overshoot .. but I find it indeed odd. I guess may be the a very sharp rise that cause the scope overshoot. But heck all of 3 scopes ... one scope is an 1Ghz capable Agilent scope (I am sampling a lousy few kz signal .. how fast can it rise The sample shots are from a 100Mhz Owon SDS7102 I have @ home. I find it odd still because as you can see attached a 1MHZ 3v Pk to Pk from sig gen. and not even a hint of overshoot - so probe is pretty well calibrated. Anyways, the PWM works so I will move into putting this one on a final board ad call it done. Quote Link to post Share on other sites
jsolarski 94 Posted December 25, 2012 Share Posted December 25, 2012 Good to hear It may not be specifically the scope, it could be the probe/'s is not calibrated. On my probes, I have to use the trimmer on the probe to counter act that effect. Quote Link to post Share on other sites
bobnova 59 Posted December 27, 2012 Share Posted December 27, 2012 Outputs do ring somewhat as far as I know / can tell. It's a function of the MOSFETs among other things. My analog scope shows ringing on MSP430 outputs as well as ATTINY85 and Atmega328 outputs. A resistor (100ohm) in line with whatever I'm switching removes it. I get extremely similar ringing on MOSFETs that are switched too hard, a resistor between gate pin and MCU gets rid of it. Jeelabs did a thing on it, too: http://jeelabs.org/2012/12/05/ringing-mosfets/ Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.