I have two problems and one question. I assembled the PCB with one (out of three) TCL5925, just to test as they are out of stock everywhere. It works fine. I haven't completely figured out the communication yet, but I can light up LEDs (in quite random order, although I send a counting 16 bit stream (loop). This is what I send:
digitalWrite(OE, HIGH); //turns off output (prevent flickering while receiving data, not sure if needed?)
digitalWrite(LE, LOW); //unnecessary, just to make sure..
uint16_t value = 10; //For example 10. It is probably here I need to examine which values correspond with each LED being on or off.
//clocks in value, bit for bit:
for (uint8_t b = 0; b < 16; b++) {
if ((value & 0x01) == 0x01) {
digitalWrite(MOSI, HIGH);
}
else {
digitalWrite(MOSI, LOW);
}
digitalWrite(SCK, HIGH);
digitalWrite(SCK, LOW);
value = value >> 1;
}
digitalWrite(LE, HIGH);
digitalWrite(LE, LOW);
digitalWrite(OE, LOW);
I initially thought it would be a 16 bit stream, where each bit corresponded to each output, high or low. But I did not get the desired output when trying.
Anyone have some tips?
Second problem is, once I solder in the second TCL5925, programming the Atmega328p fails (I use STK600). It goes between these two failures:
avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
And:
avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: RST fail
Both ends with this:
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATmega328P is 1E 95 0F
Pulling off the second TLF5925, and it programs again.
I didn't realize SDO is only used for pushing data to the next TCL5925, so I routed them as I do with all SPI devices. I can't tell from the datasheet, does SDO push every FIFO bit out, from the moment the shift register is full (reached 16 bits)? Could this be messing up the programming? Should I cut these traces?
I also forgot in the original design to add RC on reset pin. I added a 10k pull-up, without any programming success. I'll also get a 22pF (or any other suggestion). But this would only help if noise was the problem?
My third is a question. I made a 500ms loop blinking each LED. Works fine with ISCP connected to STK600. However, when I unplug and run on AAbatteries, the blinking interval decreases dramatically. Fuses are (E:FD, H:DA, L:E2).
But that shouldn't matter, since the ICSP doesn't provide a clock or similar when idle? Voltage is about 3.28V both with STK600 and without (only AA-batteries). What could be happening here?