07-13-2009, 02:09 AM
|
#1991 (permalink)
|
PaulH
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832
Thanks: 1,362
Thanked 1,202 Times in 765 Posts
|
I disabled all pull up resistors (Thanks, JayC), and the dang blasted thing still didn't work! monkey poo! I thought that would be it for sure! But then I added a temporary pull down resistor from PIN 5 of U5B to Ground (is that redundant? hehe), and it seems to work! Maybe I'll just solder a 2 or 3k resistor there and test that monkeypoo out!
|
|
|
Today
|
|
|
Other popular topics in this forum...
|
|
|
07-13-2009, 06:28 AM
|
#1992 (permalink)
|
EcoModding Apprentice
Join Date: May 2009
Location: Australia
Posts: 109
Thanks: 0
Thanked 2 Times in 2 Posts
|
Paul,
Can you talk me through the R11 , R12, D3 circuit please.
It looks a little unusual. D3 seems to be half a diode or circuit.
To get the over current reset to work you must make sure the PWM output from the micro is low '0' before applying the CLEAR signal else it will be trying to hold p5 U5 at about 3.9V while the clear signal is trying to pull it to 0V.
Now to read your code......
What is the purpose of feeding PWM into the reset pin of the SR flip flop?
Remove D3 and your reset will likely work regardless of state of PWM.
I am not sure you gain anything by providing a voltage divider to the input P10 U5
Last edited by squiggles; 07-13-2009 at 07:23 AM..
Reason: more thoughts added
|
|
|
07-13-2009, 07:24 AM
|
#1993 (permalink)
|
EcoModding Apprentice
Join Date: May 2009
Location: Australia
Posts: 109
Thanks: 0
Thanked 2 Times in 2 Posts
|
Quote:
Originally Posted by TheSGC
Yeah try it!
Mixing Digital and Analog parts can be tricky, especially when the NAND gates are so much slower than the digital! Can't wait to hear how it went!
|
Picky I know, but NAND gates are digital
|
|
|
07-13-2009, 08:39 AM
|
#1994 (permalink)
|
Master EcoModder
Join Date: Nov 2008
Location: Massachusetts, USA
Posts: 442
Thanks: 1
Thanked 60 Times in 45 Posts
|
Quote:
Originally Posted by squiggles
Picky I know, but NAND gates are digital
|
I know they are "digital", but the rise and fall times are so slow that they might as well be analog.
Paul, I also second that you should have the PWM set to 0 while the Over Current is resetting the flip flop. The PWM may be keeping the pin high enough to stop the flip flop from resetting.
|
|
|
07-13-2009, 12:31 PM
|
#1995 (permalink)
|
PaulH
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832
Thanks: 1,362
Thanked 1,202 Times in 765 Posts
|
Problems COMPLETELY SOLVED!!!!!! WILL EXPLAIN LATER! MUST GO TO SCHOOL!!!!!!!!! hahaha! ya!
Basically it's perfect now. No hardware changes necessary for anyone (well I had to replace my bad ATMega8 since I ruined it in the testing)!!!!!! Coding mistake!
OK, I'll just say it now:
I set PB2 as output, but then in InitPWM(), I accidentally set PB2 to input when I do this:
DDRB = 0b00000010;
I accidentally did = instead of:
DDRB |= 0b00000010;
So, PB2 was set as an input, so when I would try to use it as an output, since I would have to pulse it low, it would say to me, I WILL NOT GO LOW AND RESET THAT OVERCURRENT EVENT! I'M AN INPUT!!! It was really quite rude, actually.
EXPLANATION OF overcurrent diode et. al. soon! must go to school! ya!
|
|
|
The Following User Says Thank You to MPaulHolmes For This Useful Post:
|
|
07-13-2009, 12:44 PM
|
#1996 (permalink)
|
Master EcoModder
Join Date: Nov 2008
Location: Massachusetts, USA
Posts: 442
Thanks: 1
Thanked 60 Times in 45 Posts
|
Quote:
Originally Posted by MPaulHolmes
Problems COMPLETELY SOLVED!!!!!! WILL EXPLAIN LATER! MUST GO TO SCHOOL!!!!!!!!! hahaha! ya!
Basically it's perfect now. No hardware changes necessary for anyone (well I had to replace my bad ATMega8 since I ruined it in the testing)!!!!!! Coding mistake!
OK, I'll just say it now:
I set PB2 as output, but then in InitPWM(), I accidentally set PB2 to input when I do this:
DDRB = 0b00000010;
I accidentally did = instead of:
DDRB |= 0b00000010;
So, PB2 was set as an input, so when I would try to use it as an output, since I would have to pulse it low, it would say to me, I WILL NOT GO LOW AND RESET THAT OVERCURRENT EVENT! I'M AN INPUT!!! It was really quite rude, actually.
EXPLANATION OF overcurrent diode et. al. soon! must go to school! ya!
|
There is nothing worse than a rude Pin not knowing it's proper place. Great that you fixed it!
|
|
|
07-13-2009, 10:30 PM
|
#1997 (permalink)
|
EcoModding Lurker
Join Date: Feb 2009
Location: MO
Posts: 37
Thanks: 0
Thanked 3 Times in 2 Posts
|
|
|
|
07-14-2009, 12:06 AM
|
#1998 (permalink)
|
PaulH
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832
Thanks: 1,362
Thanked 1,202 Times in 765 Posts
|
I resoldered the stuff that I removed in the debugging process. It's all a go, I repeat, everything is a go! With it all working perfectly, I believe. I am going to put it in the car later.
I have a way to tune my PI loop now. I'll use the serial port to output the current so I can look at step response. I'm getting a super cheap laptop on Craigslist if it isn't sold already. This is going to be awesome! I remember Jay's graphs if his robot PD loop, and I'm going to try something similar. I can't wait to get good solid data! Then Joe and Adrian can tune to their motors too, and we can get something of a library together, so we know the just right P and I for each motor type.
//////////////////////////////////////////////////////////////////////////////
R12 keeps pwm output low as the default
R11 keeps the current draw from the PB1 down
The 1N4148 diode pulls PWM low while !CLEAR is active
ya!
|
|
|
07-14-2009, 12:28 AM
|
#1999 (permalink)
|
EcoModding Apprentice
Join Date: May 2009
Location: Australia
Posts: 109
Thanks: 0
Thanked 2 Times in 2 Posts
|
Quote:
Originally Posted by MPaulHolmes
R12 keeps pwm output low as the default
R11 keeps the current draw from the PB1 down
The 1N4148 diode pulls PWM low while !CLEAR is active
ya!
|
Paul, good to see you sorted it.
Why do you need to pull PWM low while !CLEAR is active? Both are controlled by the uP, so that is how you should do it.
PB1 load is two CMOS inputs so current limit R11 should not be necessary.
R12 is just making the uP output work harder when high '1' for no real reason, you can be confident that if you have set the uP pin as output and told it to be low it will be. It is common to see pull up resistors in digital circuits, pull downs are rare.
Just my opinion of course, feel free to disagree.
|
|
|
07-14-2009, 01:17 AM
|
#2000 (permalink)
|
PaulH
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832
Thanks: 1,362
Thanked 1,202 Times in 765 Posts
|
It would be 2 extra instructions to disable the pwm and re-enable it. And people would have to make sure they did it right in the code. I think it was to keep the human error out of the critical overcurrent circuit, so there was no way to really mess it up (Fran made the overcurrent circuit a few months ago for me Fran's Overcurrent Circuit ). Mostly it's there for PI loop tuning safely, so that if I use a bad P or I, it won't fry the mosfets with too high of a current.
The 10k pull down is also for if there is some sort of microcontroller failure, that the direction of failure is to guarantee that PWM output is 0, so it doesn't do anything weird like float if there was some sort of latch up, which could cause a full-on failure state.
|
|
|
|