An SPI bus is capable of serving multiple devices, only one wire has to be private for every device: the SS line. So use a separate SS pin for every device and you won't get any problem, just keep the SS HIGH while the device is not in use.
The issue i have, is that D10 on the UNO board is being used as a CS pin from the SPI library on the CAN chip, whereas d10 is being used as a BLANK signal on the TLC chip, would this not interfere with eachother?
The TLC doesnt seem to require an SS signal?? or am i being silly?
The TLC5940 is not an SPI device (to my knowledge). The change to other pins should be relatively easy. Can you provide a link to the library you wanna use?
For the TLC5940 you have to provide the PWM clock signal (GSCLK). This has to be on a PWM pin. Which pins (other than the SPI bus pins) do you still have available?
I took a look at the library code of the TLC5940, changing the BLANK, GSCLK and XLAT pins seems very hard because of the very special PWM setup they need. This probably means it's easier to change the SS of the MCP chip. Which library do you use for that chip?
The shield has a solder bridge to select between pin 10 and pin 9 for SS. Unfortunately both pins are used by the TLC5940 and because they are PWM pins but pin 9 isn't directly set by the hardware but controlled by the timer1 interrupt. This mean you can either select pin 9 using the solder bridge or solder that point with a wire to any other free digital pin. The first way means you have to change the MCP library as described later AND modify the TLC5940 library to use another pin in the interrupt handler. The second solution doesn't have an implication on the TLC5940 library, but you have to solder a wire to the solder bridge.
The change to the MCP library is easy, in mcp_can_dfs.h change to following line:
#define SPICS 10
Just replace the 10 with the pin number you connected the SS to.
Yes, as long as you don't use the SPI there but the bit bang interface with other pins (not 11, 12 and 13, so you have to change at least the default setting for XERR when you changed to bit bang mode).
Well what i have done as a test, is to use just the MCP wired to the Arduino, using its standard pins on the SPI except the CS pin which as you instructed, i changed that line in the code to pin 5, then i have wired the CS pin from the MCP to D5 on the Arduino and ran some code that i know works,
It doesnt seem to function with this change made,
Maybe i need to change that pin elsewhere in the Code?
Maybe i need to change that pin elsewhere in the Code?
No, I checked the code and I cannot find any other location where the SS is set otherwise.
You took exactly the same code which ran with CS at pin 10? Are you absolutely sure that the compiler used the version you changed? My test in such cases is to insert a syntax error in the changed file, compile again and remove that error again if the compiler reported the error. If the compiler does not complain about the error, it uses another version of the library somewhere else.
The pin is changed in the code with digitalWrite() so incompatibilities shouldn't occur.
I don't know the TLC chip very detailed but from the timing diagram in the datasheet I'd suppose that the chip doesn't have an SS/CS (Slave Select/Chip Select) input pin.
If you must have faster TLC output, give the chip a separate ATmega which you may connect by I2C to the master.
Well, it seems that it works on BIT_BANG, but it doesnt upate the LED's, fast enough
What speed do you need then? How fast is it now with BIT_BANG?