Anybody know an efficient way to read data off of SerialUSB and blast it out to WS2812s using an Arduino Due/FastLED?
If I send serial data to it while it’s running fastLED.show() I get strange artifacts (only the first section of strand gets data). I suspects interrupts are messing up the WS2812 timing, but the arduino stdlib is such a bowl of spaghetti that I was unable to actually figure out how SerialUSB.readBytes() is implemented, so I could be totally wrong.
My reading of the SAM3X features, it should be possible to do the receives via DMA and not mess up program execution while the host computer is sending data (atmel advertises it as kicking ass at bus translation, and 900kb/sec isn’t exactly that), but setting up all the USB and DMA control registers to do the right thing is… not an adventure I want to embark upon until I’ve made absolutely sure nobody else has done it before and that doing so will actually solve my problem.
Currently I’ve got it working by using software flow control (the 'duino sends a byte back to the host PC when it’s done with show(), then the host PC waits for that before sending a frame of data), but I want it faster, and in theory that should be possible.
Code: https://github.com/sazamore/SynapticAquarium/blob/master/serial_controller/serial_controller.ino
If I move the SerialUSB.write() at the end to before the FastLED.show(), I get much better framerates (my PC measures like 3.3MB/sec throughput), but artifacts. As is, it runs really slow, but works (like 800kB/sec)