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.
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.
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.
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
It's good to know it works. Please close the ticket at your convenience then.