How neopixal can be operate on SPI using IMX6sl ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How neopixal can be operate on SPI using IMX6sl ?

1,408 Views
alokpawar
Contributor I

Hi All, 

I am using imx6sl board with kernel version 4.1.15, build machine using Yocto.

I am trying to operate neopixel LED strip of 25 LED using SPI interface. But not getting proper color.

Neopixel LED have 3 lines (Vcc, Gnd and Data pin). Data pin is connected with MOSI pin.

Can anyone suggest some input ?

Please let me know if need to share anyother information of setup.

Tags (3)
0 Kudos
7 Replies

1,157 Views
alokpawar
Contributor I

Hi All, 

After doing some work on LED (WS2812) timing, I am able to operate LED's with perfect color. Below are obervations :

  1. Able to drive LEDs with proper color.
  2. Able to set almost all colors on LEDs { using argument in binary for color change : “led_spi <R> <G> <B>”. }
  3. Checked for 5 LEDs, and they are working fine in strip.

Following are some input of test code :

Speed : 10Mhz

Data bit : 16

Led_byte : 24 (three color R, G, B)

But, Only 5 Led’s are working fine, when I am trying more than 5 LED’s then random colors are coming.

And as per my understanding if 5 LED’s are working then timing is fine, then it may be some issue of SPIdev buffer or memory.

 

Please share some inputs regarding this.

0 Kudos

1,157 Views
mtx512
Contributor V

You need to review the output bit stream on a logic analyser in order to see what the symptoms are when going pass 5.

0 Kudos

1,157 Views
art
NXP Employee
NXP Employee

Are the processor's SPI signals and neopixel SPI signals in the same voltage domain? Please check.


Have a great day,
Artur

0 Kudos

1,157 Views
alokpawar
Contributor I

We are using IMX6SL micro processor with kernel-4.1.15 and LED strip(WS2812: contains 3 pin Vcc, Gnd, Data) is connected on SPI interface (MOSI pin).

We have enable Spidev driver for it and put entry in device tree too.

And we are using spidev node for operating LED strip, and written one test code for same which is written SPI buffer to Spidev node.

 

But we are not able to get perfect/correct colors on led strip.

 

Following are some input of test code :

Speed : 3Mhz (also checked 10Mhz)

Data bit : 8

Reset count : 20

Led_byte : 24 (three color R, G, B)

 

Please suggest some input regarding this, how we can operate perfectly all colors on LED strip. And suggest also correct spi mode for it.

0 Kudos

1,157 Views
alokpawar
Contributor I

Thanks for reply Jas, 

I am using imx6sl micro processor and SPI interface (SPIdev node)on it. And neopixel is ws2812.

and following are details of my code:

reset count : 20

speed : 3Mhz

led byte (3 color) : 24

writing data to SPI for 1 led : (reset_count + 1*24)

able to operate red/blue/green color but intensity is very low.

I am also assuming that is issue of timeing.

Which mode i need to configure for this (led strip) of SPI ?

0 Kudos

1,157 Views
mtx512
Contributor V

You need to do the sums to work out the correct spi frequency + byte count based on the article. However before using SPI I would recommend implementing a gpio bit-bang test program to verify the LED intensity is fine.  

0 Kudos

1,157 Views
mtx512
Contributor V

If the colours aren't correct then timing of '1' on '0' must be incorrect when generated by SPI for your controller. You haven't mentioned which controller your interfacing too, if its the WS2811 then this article gives a good run down of the timings that need to be generated. You need to translate those timings into equivalent SPI data packets, for example a WS2811 '0' or '1' could be represented as 3 SPI data bits at the correct frequency. 

0 Kudos