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

     

  • 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. 

  • for i2s_ws2812b_drive_handler used 3 argument and in PCA10056 nrfx_i2s_data_handler_t used 2 argument.

    rr_code = nrf_drv_i2s_init(&config, i2s_ws2812b_drive_handler);

    void i2s_ws2812b_drive_handler(uint32_t const * p_data_received,
    uint32_t p_data_to_send,
    uint16_t number_of_words
    )

    typedef void (* nrfx_i2s_data_handler_t)(nrfx_i2s_buffers_t const * p_released,
    uint32_t status);

    so for WS2812B PCA10056 driver is available?so i can take it reference and used driver on my exciting project. 

  • It is more likely that the driver you are referencing is implemented for a different version of the SDK, not that it is incompatible with PCA10056.

    You can maybe search the internet for a different driver. Both the nRF52840 and the WS2812B are popular devices. There are more than one driver projects. This is literally the first Google result when I search for "ws2812 nrf52840":  WS2812 nrf52840 example 

    Regardless, you will have to analyze the code, understand what the parameters of the functions are for, and port it for your environment.

  • Than you so much for your support,

    i used WS2812 nrf52840 example for reference and i am able to operate the all three led 

Reply Children
Related