COG Stalling??
matb_uk
Posts: 16
Can individual cogs·or io pins stall?
Basically i'm building a small computer based on the Prop which reminds me at points throughout the day to do certain tasks.
It's paired up to a HD44780 16*4 screen with a PS/2 port and a small piezo buzzer for alarm sounds.
I made a small loop to flick a port on and off a number of times per second and the buzzer is connected to that port and therfore makes a sound. Depending on the duration between on off pulses, the tone changes. This works fine for the most part but if i call the loop a few times it seems to lock and play the sound indefinately and sometimes i get garbage displayed on the display.·Now i accept that there could well be a fault in my wiring (Very little electronics experience) but there is nothing else attatched to the buzzer i/o port and i've checked that it's not shorting to an adjacent pin.
The only over thing of note is that i'm using a 5v battery pack for power which creates a 5v rail and off that 5v rail is a (150ma Max) voltage regulator creating a 3v rail which the Prop get's it's power from. I thought that 150ma should be enough to feed two to three cogs running at PLL4 (20 Mhz).
Any ideas?
Basically i'm building a small computer based on the Prop which reminds me at points throughout the day to do certain tasks.
It's paired up to a HD44780 16*4 screen with a PS/2 port and a small piezo buzzer for alarm sounds.
I made a small loop to flick a port on and off a number of times per second and the buzzer is connected to that port and therfore makes a sound. Depending on the duration between on off pulses, the tone changes. This works fine for the most part but if i call the loop a few times it seems to lock and play the sound indefinately and sometimes i get garbage displayed on the display.·Now i accept that there could well be a fault in my wiring (Very little electronics experience) but there is nothing else attatched to the buzzer i/o port and i've checked that it's not shorting to an adjacent pin.
The only over thing of note is that i'm using a 5v battery pack for power which creates a 5v rail and off that 5v rail is a (150ma Max) voltage regulator creating a 3v rail which the Prop get's it's power from. I thought that 150ma should be enough to feed two to three cogs running at PLL4 (20 Mhz).
Any ideas?
Comments
Excuse the variable names. This was a test bit of code.
I'm going to try the filter capacitors now.
Post Edited (matb_uk) : 10/1/2007 7:07:24 PM GMT
Do you use a LowDrop regulator? Most likely, there are hardly any others...
How large is the resistor you have connected the buzzer and the LED by?
The duty cycle of your signals is>90% so a lot of current might flow all the time (40mA?)
What you describe looks like a reset due to a "brown-out" due to voltage breakdown.
You have connected brown-out enable to GND?
In any case add a 100nF between Vss and Vdd of the Prop. Alas, Parallax does not stress this recommendation from more than 40 years practice...
Your program will be much easier to read here if you get rid of the <tab>s (which the forum server ignores) and enclose the whole thing in [noparse][[/noparse]code] ... [noparse][[/noparse]/code] tags. You can edit your posting: no need to create a new one.
-Phil
I've added a 0.47uf cap from the 3v rail to ground but this didn't help.
By the way, the voltage regulator i've used is a TS2950CT-3.3
EDIT: Helps if you use [noparse][[/noparse]Code] instead of <Code>
(2) All linear regulators need an capacitor - best close to their pins. It starts with 10myF
Some will improve by a additional smaller cap at the input, even when you use batteries..
(3) The recommended 100nF should be located near the pins of the Prop. This is something different..
I had more questions...
I have a 10k resistor connected to the buzzer and i've implemented the 100nf as suggested.
Now the big issue is... Have i damaged my Prop (I shouldn't be allowed to play with electrical equiptment!!)
I've defined three stacks Stack1[noparse][[/noparse]9]... Stack3[noparse][[/noparse]9] in VAR
in my PUB Main i have cognew(Display, @Stack1) and this start my LCD loop and displays the value of seconds variable.
i then have cognew(Clock, @Stack2) to update seconds variable every second.
This doesn't seem to work yet if i change @Stack2 to @Stack3 it works??
Substitute all 9s by 20s
EDIT: Really sorry but it seems adding a wait after clearing the LCD it works fine. Also after adjusting the stack values of my originally problematic code seems to have made a big difference.
Post Edited (matb_uk) : 10/1/2007 8:43:58 PM GMT
(a) No it will suffice to connect it at one side, or even between the sides which is quite convenient..
(b) GND and Vdd are connected internally, buit the question is: for how much current. It might be not so good an idea to connect a regulator able to - say - deliver 3 A at one side and draw 2 A out of the other side of the Prop .
I generally "mesh" the voltage as much as possible on the breadboards
The cogs may need oiling occasionally.. a little SINGER oil is fine..
ron
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?