driving APA102 LED array in lucid

Need some help on a project you are working on or got stuck on a tutorial? Post your questions here.
Post Reply
hydronics
Posts: 4
Joined: April 27th, 2018, 7:33 pm

driving APA102 LED array in lucid

Post by hydronics » April 27th, 2018, 7:50 pm

hello....!

I'm really close to driving these LEDs over SPI. I'm sending the bytes to the AVR serial console and the SPI module simultaneously.

Every time I send the bytes, the 3 LEDs act quite randomly and or at least mostly random... so close!.

Code: Select all

    spi_out.data_in = ledArrayManager.tx_data;
    spi_out.start = ledArrayManager.new_tx;  
    avr.new_tx_data = ledArrayManager.new_tx;
    avr.tx_data = ledArrayManager.tx_data;  
https://github.com/hydronics2/mojo_fpga

It reads in starting at the last byte in the array....

data2 = {.............8hff, 8b0, 8b0, 8h1e, 8he3, 8b0, 8b0, 8b0, 8he3, 8b0, 8b0, 8h1e, 8he3, 8b0, 8b0, 8b0, 8b0};


The APA102 data protocol is described here: https://cpldcpu.wordpress.com/2014/11/3 ... -superled/
I've tried a bunch of mixing the bytes around with no avail... The 32 0s start frame is most important. I think it's a problem with interfacing with the SPI module.

- as 32 bits of 0s for the start of the sequence

- followed by a 32 bits per LED frame of 3 bits (111) and 5 bits (brightness), and 1 byte per R,G,B...

- followed by 32 bits of 1 or 0 depending on what you read

hydronics
Posts: 4
Joined: April 27th, 2018, 7:33 pm

Re: driving APA102 LED array in lucid

Post by hydronics » May 9th, 2018, 1:32 pm

.... update

the code more or less works... I found infrequent updates produce glitchy results but if I continuously send out the LED array it is stable. I'll update this later as I understand more but feel free to make suggestions!

https://github.com/hydronics2/mojo_fpga ... ter/apa102

Post Reply