Greetings
TL/DR - I'm using 2 spi peripherals, and they fight with one another. My code worked with oldDuino but not Teensy (I think the teensy is so fast it runs into problems).
Long version: I have some code I put together on my arduino Mega and it worked, albeit slow (less than 100fps updates of 64 leds). I load a bitmap from the sd card, and output it line by line to a strip of leds. This can store animations, or more importantly, a POV image that I can move around the strip to get the image to show up in the air.
It's been done before, BUT, this time it's full RGB 24 bit.
The uSD card is the Waveshield adapter board, 3v3 native.
I'm using the sdFAT library - the new version adapted for the teensy, since its wicked fast.
The files I deal with are in the order of 32x100, or generally about 10k. In theory they could be very large since we only ever load one line at a time. Even small files are much larger than the uC has ram to hold, hence the stuttered process.
http://code.google.com/p/beta-lib/
The strips are WS2801 led strips - with synchronous clock and data, but NO chip select. I address this by using an npn transistor to interrupt the spi clock signal to the strip whenever it's not needed. This way, the SD card data doesn't write random info to the strip.
I'm using the fastSPI library from Daniel Garcia - new version adapted for the teensy 3.0
http://code.google.com/p/fastspi/
I've had success (if a bit slower) using the adafruit ws2801 library.
pseudocode: (Attached is the real thing)
I have a hunch that the spi data rate is getting mad between changes of 'who' is using the spi bus at the same time. The pinout diagram leads me to believe there is more than one SPI bus (greyed out scl, sda, din dout) -- the datasheet says the chip has one spi module.
I've asked around the arduino forums with limited success - The sdFat and fastSPI authors are relatively busy so I imagine they don't have time for my little project .
If I was bitbanging the output it would work, but it would be brutally inefficient.
Long story shorter: Is there a way to tell when the sdFat library is done doing its buffering so I know it won't interfere with the strip output?
and
Does the Teensy3 actually have multiple spi ports?
-if so, how does one point an spi library at the second port?
For your viewing pleasure:
https://www.youtube.com/watch?v=tWjcMlhfz1Y
TL/DR - I'm using 2 spi peripherals, and they fight with one another. My code worked with oldDuino but not Teensy (I think the teensy is so fast it runs into problems).
Long version: I have some code I put together on my arduino Mega and it worked, albeit slow (less than 100fps updates of 64 leds). I load a bitmap from the sd card, and output it line by line to a strip of leds. This can store animations, or more importantly, a POV image that I can move around the strip to get the image to show up in the air.
It's been done before, BUT, this time it's full RGB 24 bit.
The uSD card is the Waveshield adapter board, 3v3 native.
I'm using the sdFAT library - the new version adapted for the teensy, since its wicked fast.
The files I deal with are in the order of 32x100, or generally about 10k. In theory they could be very large since we only ever load one line at a time. Even small files are much larger than the uC has ram to hold, hence the stuttered process.
http://code.google.com/p/beta-lib/
The strips are WS2801 led strips - with synchronous clock and data, but NO chip select. I address this by using an npn transistor to interrupt the spi clock signal to the strip whenever it's not needed. This way, the SD card data doesn't write random info to the strip.
I'm using the fastSPI library from Daniel Garcia - new version adapted for the teensy 3.0
http://code.google.com/p/fastspi/
I've had success (if a bit slower) using the adafruit ws2801 library.
pseudocode: (Attached is the real thing)
Code:
setup
load sd file, library takes care of file handling/buffering
/setup
loop
read entire file, one line at a time of the bitmap (32 bytes * 3rgb) to a buffer //I can do this, and serial.print it all day long, flawless.
write one line to 32 rgb leds from buffer //I can procedurally generate animations, flawless
//I can't do both at the same time.
/loop
I have a hunch that the spi data rate is getting mad between changes of 'who' is using the spi bus at the same time. The pinout diagram leads me to believe there is more than one SPI bus (greyed out scl, sda, din dout) -- the datasheet says the chip has one spi module.
I've asked around the arduino forums with limited success - The sdFat and fastSPI authors are relatively busy so I imagine they don't have time for my little project .
If I was bitbanging the output it would work, but it would be brutally inefficient.
Long story shorter: Is there a way to tell when the sdFat library is done doing its buffering so I know it won't interfere with the strip output?
and
Does the Teensy3 actually have multiple spi ports?
-if so, how does one point an spi library at the second port?
For your viewing pleasure:
https://www.youtube.com/watch?v=tWjcMlhfz1Y
Attachments
Last edited: