I am using a TPIC6B595 to drive 8 relays with a custom arduino board controlling the TPIC via SPI.
Unfortunately I have already tied (designed PCB) the output enable pin of the chip permanently to ground (enabled) which means that when the system powers on the outputs are on a random state until they are reset by software.
The reset (SRCLR) pin of the chip is also connected to the system reset (arduino reset).
How would you keep the arduino reset active for a "while" after power on to make sure that the TPIC register clears?
I know there are specific CPU supervision chips to do this, but I am looking for a simple way to do it without redesigning the PCB if possible.
Wawa:
Do you initialize all relays to 'off' in setup(), before you do anything else?
Leo..
Yes i do.
But even before setup runs , some relays are energised long enough to hear them click to off.
Additional info:
Thee is an onboard switching regulator which might couse this initial random behaviour.
I have tried adding a 1uf cap from reset to gnd to provide power on reset delay which seemed to improve things a little. I.e the problem doesnt always happen after power on, but at times its still there...
I made once a 24-relay board with TPIC chips, and didn't have that problem.
I don't think I used any reset or enable lines (fixed).
Here is the setup() code I used (already changed to 8 relays).
Leo..
void setup() {
digitalWrite(latchPin, HIGH);
digitalWrite(dataPin, HIGH);
digitalWrite(clockPin, HIGH);
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
digitalWrite(latchPin, LOW);
digitalWrite(dataPin, LOW);
digitalWrite(clockPin, LOW);
for (int i = 0; i < 8; i++) { // clock in LOWs
digitalWrite(clockPin, HIGH);
digitalWrite(clockPin, LOW);
}
digitalWrite(latchPin, HIGH); // transfer to outputs
// more setup code here
}
Wire the output enable of your shift registers to an Arduino pin. The put an external pull up resistor of about 1K on that pin.
When it powers up only set the pinMode of this reset pin to be an output and low once you have set the shift register outputs low.
Make better use of that capacitor by putting it between the power and ground on the shift registers.
Grumpy_Mike:
Wire the output enable of your shift registers to an Arduino pin. The put an external pull up resistor of about 1K on that pin.
When it powers up only set the pinMode of this reset pin to be an output and low once you have set the shift register outputs low.
Make better use of that capacitor by putting it between the power and ground on the shift registers.
Thanks Mike .
Unfortunately i have already made the pcb using all smd devices as explained in the OP , output enable is permanently enabled.
Otherwise i would have done exactly what you are proposing.
Unfortunately i have already made the pcb using all smd devices as explained in the OP
What does that matter?
When I worked in consumer electronics we made a PCB as the very first prototype. We then used a scalpel and fine gauge wire to do corrections to it, it was standard practice.