WS2812B library/code for DP32 or similar

Talk about anything you want!
Post Reply
rs2845
Posts: 18
Joined: Tue May 17, 2016 9:02 pm

WS2812B library/code for DP32 or similar

Post by rs2845 » Mon Jul 17, 2017 4:26 am

Struggling to get WS2812B's driven from a DIY Chipkit DP32.

Most libraries I want to use aren't compatible as:
A) They're written for AVR processors
B) They're requiring SPI and DMA resources that apparently my MX270F256B doesn't have

It's confusing as I have managed to drive these LED's in seconds on a cheap arduino that I believe runs at 16Mhz.

I've managed to get "some" flickering when using the PICxel LED library - but they clearly don't operate.

Libraries tried:
- FAB-LED
- Adafruit
- Chipkit's own
- PICxel
- FastLED (didn't try as it says AVR only)
- light_ws2812


Has anyone had success driving these LED's without having the top end chipkit boards?

GastonLagaffe
Posts: 101
Joined: Sun Oct 26, 2014 2:50 pm

Re: WS2812B library/code for DP32 or similar

Post by GastonLagaffe » Mon Jul 17, 2017 9:07 am

Salut,

I have this modified ChipKitPixel library that works nicely with my boards based on the DP32. You will find in the code a compiler switch for the processor as the NOP calls depend on the frequency your board runs on. You can omit the call to HelvePic32.h as it defines nothing but a few pin names and arrays of my board.

No guarantee it works with yours but perhaps a good start

Ciao, Mathias
Attachments
strandtest.zip
(39.76 KiB) Downloaded 5 times

EmbeddedMan
Posts: 597
Joined: Tue May 24, 2011 9:24 pm
Location: Minneapolis, MN
Contact:

Re: WS2812B library/code for DP32 or similar

Post by EmbeddedMan » Mon Jul 17, 2017 2:33 pm

Hi Gaston!

I have another modified PICxel library here : https://github.com/EmbeddedMan/PICxel

This one should work on every chipKIT board, as it knows how many NOPs to insert based on core clock speed.

*Brian

rs2845
Posts: 18
Joined: Tue May 17, 2016 9:02 pm

Re: WS2812B library/code for DP32 or similar

Post by rs2845 » Mon Jul 17, 2017 7:49 pm

Wow thanks for the fast responses! Really appreciated.

@ Mathias - I am not quite sure how to work the second parameter (nP[RIGHT][Pin]) - have you got an example of what the 'RIGHT' variable should be?

@Brian
Thanks for your modified library too! The LED's are blinking away. Does the original developer know about the changes you made to get this running on all chipkit boards? It'd be good if they were all packaged in a single library as his comes up on Google when you search "WS2812B chipkit"..

GastonLagaffe
Posts: 101
Joined: Sun Oct 26, 2014 2:50 pm

Re: WS2812B library/code for DP32 or similar

Post by GastonLagaffe » Mon Jul 17, 2017 8:26 pm

Salut,

nP is just a 2-dimensional array that has the pin number stored. If your LED strip is connected to pin 5, just use this instead of the nP[RIGHT][pin]

Ciao, Mathias

EmbeddedMan
Posts: 597
Joined: Tue May 24, 2011 9:24 pm
Location: Minneapolis, MN
Contact:

Re: WS2812B library/code for DP32 or similar

Post by EmbeddedMan » Tue Jul 18, 2017 1:59 am

Yes, I submitted a pull request. It may be that the original library is abandoned. We'll see.

*Brian
rs2845 wrote:Wow thanks for the fast responses! Really appreciated.

@ Mathias - I am not quite sure how to work the second parameter (nP[RIGHT][Pin]) - have you got an example of what the 'RIGHT' variable should be?

@Brian
Thanks for your modified library too! The LED's are blinking away. Does the original developer know about the changes you made to get this running on all chipkit boards? It'd be good if they were all packaged in a single library as his comes up on Google when you search "WS2812B chipkit"..

Post Reply