I've got a bit of a strange problem with the TLC5940, using Alex Leone's library .
I have 8x10 leds in a matrix which is configured to be driven by 5 output pins times 16 TLC5940 channels. Ultimately I want to multiplex the matrix to have 80 individually controlled LEDs, but at the moment I'm having problems with whole rows.
I use Arduino digital pins 12, 8, 7, 4 and 2 as output pins, and they all work perfect - apart from pin 12!
Digital pin 12, PB4, is also the arduino MISO pin. When I have all the other rows turned off and pin 12 on, I can see a very faint light. Measuring the outputs I can see they're all at 4.92V, apart from pin 12 which only comes up to 4.75V - and that's with no LEDs on.
I've been looking through the TLC5940 library documentation, the code, and the ATmega168 datasheet, but I can't see any reason why the MOSI pin should be misbehaving. At first I thought it was because of the lib uses hardware SPI, but changing to BITBANG mode doesn't help one bit.
In any case the datasheet says: "When the SPI is enabled, the data direction of the MOSI, MISO, SCK, and SS pins is overridden..." and then a table says that in Master SPI mode, the MOSI pin direction is User Defined, which I take to mean it can be configured as either input or output.
I've tried both Arduino 0011 and 0016 and get the same result.
The code I've used for testing is based on BasicUse.pde from the lib. Nothing complicated or controversial - I'm happy to post it.
I've put a copy of the schematic here .
Is there any other part of the Arduino library/runtime code which messes with the MISO pin? Anyone else had any similar experiences? Any ideas?
EDIT: I'm a fool. I'm mixing up my MISOs and MOSIs, making a MISO soup out of the whole thing. Sorry. In SPI master mode, pin 12 / MISO is set as INPUT. However, it still doesn't work in BITBANG mode.