Neopixel library not work on Particle P2

I am trying to test RGB example code for APA104 led.

So, i used “neopixel.h” library for that but it shows error that "#error “*** PLATFORM_ID not supported by this library.”

So, i am trying to search for other library’s that support that P2 platform ID = 32 ,but i can’t found.
also try other libraries like
“FastLED.h”
“neopixelblush.h” etc…

So, can anyone have particular library for RGB led strip or matrix that support Particle P2
or have any other solution for that.

1 Like

Hi, this can be super hard, the FastLED and Neopixel will not work for sure. Here is what I found for RTL8721DM:

(APA104 should work with WS2812B)

But to be honest I don’t know how to port this for Photon 2. I’ll need more time and the Photon 2 which I don’t have. Also what is important you will lose your SPI functionality as this implementation use SPI to drive the leds

The existing port definitely won’t work because there are timing-sensitive loops in it. The GPIO on the RTL8720D is slow and bit-banging the output probably won’t work very well anyway.

The SPI peripheral trick is probably going to be the best way to do it, but I’m not sure it can be done entirely from user firmware.

1 Like

Now that the Photon 2 early samples have been in users hands for a little while, do you know if anyone has ported a neopixel library? I would like to transition my IoT class at cnm.edu to the Photon 2, but we rely heavily on neopixels. I’m starting to look into the SPI method, but I don’t have a lot of SPI experience, so I figured I’d ask before getting too lost in the wilderness.

1 Like

There is currently no NeoPixel library for the P2/Photon 2, but it is something that is being investigated.

The problem is that the GPIO on the RTL872x is slow, even though the MCU has a fast clock speed. This means that it is not possible to brute-force (“bit-bang”) the NeoPixel protocol. It may be possible to use the SPI peripheral and DMA to implement the protocol, which is the preferred method anyway, because it’s far more efficient and allows the MCU to continue performing other tasks while outputting the pixel data with precise timing.

1 Like

I'm a bit confused by that reply. I use Photons with a NeoPixel and a capacitive touch sensor to teach the I2C protocol and use a TFT w/SD card slot to teach SPI. The NeoPixel ring (12 pixels) doesn't have the pins to wire the SPI protocol (MOSI, MISO)...can you help me understand why you're referencing SPI as part of the solution for Photon2?

The NeoPixel library has been updated and now works on the Photon 2 and P2, as well as older platforms.

If you wish to use both NeoPixel and SD card on the Photon 2, you will need to use the two SPI busses that are available. The reason is that GPIO on the P2/Photon 2 is slow, but it is possible to use DMA to output high-speed digital data, but this is only available on the pins that are shared with SPI. Of course the NeoPixel protocol is different from SPI, so you will want to use two separate SPI busses, one for NeoPixel and one for actual SPI to the SD card.

2 Likes

@rickkas7 although you have stated that it is now supported, it still reads as unsupported (including screenshot). Can you comment?

That's because the examples use the generic Neopixel initialization code, which does not work on the P2. If you follow the instructions for initialization on a P2/Photon 2 it should work properly.