chipKIT® Development Platform

Inspired by Arduino™

WS2812B library/code for DP32 or similar

Created Mon, 17 Jul 2017 03:26:40 +0000 by rs2845


rs2845

Mon, 17 Jul 2017 03:26:40 +0000

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

Mon, 17 Jul 2017 08:07:11 +0000

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


EmbeddedMan

Mon, 17 Jul 2017 13:33:55 +0000

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

Mon, 17 Jul 2017 18:49:52 +0000

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

Mon, 17 Jul 2017 19:26:35 +0000

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

Tue, 18 Jul 2017 00:59:37 +0000

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

*Brian

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