Try to develop Driver for WS2812B

I used nRF52840 board with SDK 17_1_0 ,

I want to used WS2812B in my project so any one can give me  reference code for this or

can suggest me how can i implement its driver in segger embedded studio.

Parents
  • Hello,

    Sorry for the late reply. We are a bit short staffed at the moment.

    We don't have any drivers for this one in the nRF5 SDK, unfortunately. 

    I have seen a few drivers around, and most of them use either I2S or SPI to simulate the timing requirements of this driver. 

    It would be possible to bit bang this protocol, but if you intend to do anything (!) else, such as do anything Bluetooth related, this would fail pretty quickly. Therefore it is a good idea to use a hardware peripheral that will not stop when the CPU needs to handle, e.g. Bluetooth stuff. 

    One example of these drivers is this one:

    https://github.com/edwios/nRF5_WS2812B/tree/master

    I have not tested it, but if you search for "WS2812B nRF5 SDK" you should be able to find a few that you can test.

    Another post you can check is this one:

     Driving WS2812B LEDs using I2S on the Nordic nRF52832 

    Best regards,

    Edvin

  • As per the WS281B Datasheet we have require the delay in nenosec but i am not able to give delay in neno second,i also used the nop but still i did't get the proper output

     

  • Hi ChiragBhavsar,

    You seem to be using bit banging to implement the driver. Is that correct? As noted by Edvin, this can likely fail when you have the SoftDevice and other peripheral interrupts running.

    If you must use this solution, how have you checked if the output is proper? How many NOP are you using.

    For something like this, you will need a lot of them. It's just a matter of connecting the hardware to a scope and add/remove NOP until the desired timing is reached.

    By the way, are you starting a new project? For new project, we recommend the nRF Connect SDK where there is native driver support for WS281B based on I2S and SPI. The nRF5 SDK is in maintenance mode and we do not recommend it for new projects.

    Hieu

  • Actually this project is exciting and i want to add WS2812B.

    yes i used bit banging,is there any other way to operate  WS2812B?

    Also my output is not proper as you mention when i used soft device at that time pin high and low take time and i have did not get proper output.

    if i can used free rtos in my project so it can work? 

  • As far as bit banging go, I think adding an RTOS would just hurt your precision even more, as there are now more things that can interrupt your precise NOP operations.

    Edvin had already pointed out in his initial reply that there are open-source drivers that uses the I2S or SPI peripheral. He also gave some links.

    I also recommended the nRF Connect SDK, which is more up to date, and has native support for WS2812B.

  • if i used nrf Connect SDK then i want to write hole code from starting right?

    ok i will try with i2s or spi peripheral

    which driver Edvin provide is for PCA10040,so for PCA10056 any driver is available?

    i try to implement code in  PCA10056 using i2s PCA10040  reference code but nrf_drv_i2s_init not match with PCA10056.

  • ChiragBhavsar said:
    if i used nrf Connect SDK then i want to write hole code from starting right?

    Is your project already in development? I recommend the nRF Connect SDK for new project. The code from nRF5 SDK cannot be carried over.

    ChiragBhavsar said:

    ok i will try with i2s or spi peripheral

    which driver Edvin provide is for PCA10040,so for PCA10056 any driver is available?

    i try to implement code in  PCA10056 using i2s PCA10040  reference code but nrf_drv_i2s_init not match with PCA10056.

    The use of the peripheral drivers is mostly the same between PCA10040 and PCA10056. I don't understand what you mean by nrf_drv_i2s_init not matching PCA10056. 

Reply
  • ChiragBhavsar said:
    if i used nrf Connect SDK then i want to write hole code from starting right?

    Is your project already in development? I recommend the nRF Connect SDK for new project. The code from nRF5 SDK cannot be carried over.

    ChiragBhavsar said:

    ok i will try with i2s or spi peripheral

    which driver Edvin provide is for PCA10040,so for PCA10056 any driver is available?

    i try to implement code in  PCA10056 using i2s PCA10040  reference code but nrf_drv_i2s_init not match with PCA10056.

    The use of the peripheral drivers is mostly the same between PCA10040 and PCA10056. I don't understand what you mean by nrf_drv_i2s_init not matching PCA10056. 

Children
Related