NoahK
New member
Hello PJRC! I am a new member here and am really excited to get to know you all.
I am looking to make a 3 dimensional POV display using APA102 LEDs. Specifically, I plan on making a 20x20 matrix (400 LEDs), and am debating how to handle pushing data to the LEDs. I need to refresh the LED's 3600 times per second in order to achieve 120 subdivisions per revolution at 30 revolutions per second. Each LED requires 32 bits (4 bytes) of data, so for 400 LEDs, that is 1600B of data per subdivision, which constitutes 192000B of data per frame. With 30 frames per second, this means that I have to push out 5,760,000 Bytes of data per second via SPI to the LEDs. On a single strand, this would require upwards of a 50MHz SPI clock speed, but if I were to split up the LED's into many strands and drive those simultaneously, the speed needed would be much slower. I figured, looking at the APA102 datasheet, that I could bit-bang the clock and data line for 7 strands en masse, using two bytes per SPI clock cycle. Transmitting 7 BGR values of 0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0x00FFFF, 0xFF00FF, and 0xFFFFFF simultaneously, with the clock on the first bit, would output the following bytes in this order on a 8-pin port:
This basically doubles the memory that frames take up, but it slows down the necessary SPI clock speed by a factor of 7. And considering how fast Port Manipulation is, this should be feasible. But to make the most use of the Teensy and free up as much time as possible, I started to wonder if 16 bit/pin ports existed on the Teensy 3.6. In this forum post, there is mention of 16 pin ports that are addressed using 32 bit writes. Is it possible to write to 16 or even 32 pins simultaneously? What kind of limitations or complications would I run into?
I am looking to make a 3 dimensional POV display using APA102 LEDs. Specifically, I plan on making a 20x20 matrix (400 LEDs), and am debating how to handle pushing data to the LEDs. I need to refresh the LED's 3600 times per second in order to achieve 120 subdivisions per revolution at 30 revolutions per second. Each LED requires 32 bits (4 bytes) of data, so for 400 LEDs, that is 1600B of data per subdivision, which constitutes 192000B of data per frame. With 30 frames per second, this means that I have to push out 5,760,000 Bytes of data per second via SPI to the LEDs. On a single strand, this would require upwards of a 50MHz SPI clock speed, but if I were to split up the LED's into many strands and drive those simultaneously, the speed needed would be much slower. I figured, looking at the APA102 datasheet, that I could bit-bang the clock and data line for 7 strands en masse, using two bytes per SPI clock cycle. Transmitting 7 BGR values of 0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0x00FFFF, 0xFF00FF, and 0xFFFFFF simultaneously, with the clock on the first bit, would output the following bytes in this order on a 8-pin port:
Code:
01001011 \ \__ Two lines (bytes) make up one clock cycle
11001011 | /
01001011 |
11001011 |
01001011 |
11001011 |
01001011 \__ 16 lines make up one byte of data
11001011 / Blue data for the 7 pixels, clock is on leftmost bit
01001011 |
11001011 |
01001011 |
11001011 |
01001011 |
11001011 |
01001011 |
11001011 _/
00101101 \
10101101 |
00101101 |
10101101 |
00101101 |
10101101 |
00101101 \__Green data for LED's
10101101 /
00101101 |
10101101 |
00101101 |
10101101 |
00101101 |
10101101 |
00101101 |
10101101 _/
00010111 \
10010111 |
00010111 |
10010111 |
00010111 |
10010111 |
00010111 |
10010111 |
00010111 \___ Red Data for LEDs
10010111 /
00010111 |
10010111 |
00010111 |
10010111 |
00010111 |
10010111 _/
This basically doubles the memory that frames take up, but it slows down the necessary SPI clock speed by a factor of 7. And considering how fast Port Manipulation is, this should be feasible. But to make the most use of the Teensy and free up as much time as possible, I started to wonder if 16 bit/pin ports existed on the Teensy 3.6. In this forum post, there is mention of 16 pin ports that are addressed using 32 bit writes. Is it possible to write to 16 or even 32 pins simultaneously? What kind of limitations or complications would I run into?