Arduino Primo Neopixel(WS2812B)

Hi there,

i just bought the new Arduino Primo and Primo Core. I want to use some "Neopixel"(WS2812B, Nulsom Matrix Biscuit 3x3) with the Primo but it doesn't work. I tried using the Adafruit_NeoPixel library. At first the compiling of the added examples failed for the named boards. For this problem I found the following solution in another thread:
In the .ccp file of the NeoPixel library the part

#if defined(NRF52)
#include "nrf.h"

// Interrupt is only disabled if there is no PWM device available
// Note: Adafruit Bluefruit nrf52 does not use this option
//#define NRF52_DISABLE_INT
#endif

should be changed to:

#if defined(NRF52)
#include "nrf.h"

// Interrupt is only disabled if there is no PWM device available
// Note: Adafruit Bluefruit nrf52 does not use this option
//#define NRF52_DISABLE_INT

const uint32_t g_ADigitalPinMap[] = {
  // D0 - D7
  0,  // xtal 1
  1,  // xtal 2
  2,  // a0
  3,  // a1
  4,  // a2
  5,  // a3
  6,  // TXD
  7,  // GPIO #7

  // D8 - D13
  8,  // RXD

  9,  // NFC1
  10, // NFC2

  11, // GPIO11

  12, // SCK
  13, // MOSI
  14, // MISO

  15, // GPIO #15
  16, // GPIO #16

  // function set pins
  17, // LED #1 (red)
  18, // SWO
  19, // LED #2 (blue)
  20, // DFU
  21, // Reset
  22, // Factory Reset
  23, // N/A
  24, // N/A

  25, // SDA
  26, // SCL
  27, // GPIO #27
  28, // A4
  29, // A5
  30, // A6
  31, // A7

};

#endif

This helped. I'm no longer getting the error for the board.
But after compiling and uploading to the Arduino primo and connecting the LED, nothing happened.
I also tried to measure the PWM signal on the digital PIN with an oscilloscope but with the example code ("simple") nothing was to detect. (I already did a reference measurement with a simple analogWrite(...) function, the PIN works with a PWM signal this way)

The code was functional on the boards UNO and 101 and the LED worked.

Is the library not yet compatible to the Arduino Primo and does anyone have a solution for me? :confused:

I'd appreciate any help.
Kind regards, Richi. :slight_smile:

Have you tried uncommeting the line
//#define NRF52_DISABLE_INT
Just to see what happens?

I am facing the exact same issue with the functional code on Uno and 101, but shift to arduino Primo showed that the library update is needed. Thanks @rihatcw for the update and solution for the compilation problem. It worked for me as well.

@Grumpy_Mike: I tried uncommenting the line and unfortunately nothing has changed.

Thanks @rihatcw for the update and solution for the compilation problem

Sadly just getting something to compile is not the same as getting it to work. Anyone can get something to compile.

Yes the libiary needs updating.

I am facing exactly the same problem. Everything looks fine with the compiling but afterward, nothing is happening.

Ok. So, the problem was in the mapping array in g_ADigitalPinMap[]. Remapping the pins solves the problem (see the code below).

#if defined(NRF52)
//#define NRF52_DISABLE_INT // Not recommended to enable
#include "nrf.h"

// Interrupt is only disabled if there is no PWM device available
// Note: Adafruit Bluefruit nrf52 does not use this option
#define NRF52_DISABLE_INT

const uint32_t g_ADigitalPinMap[] = {
 // D0 - D7
 11,
 12,
 13,
 14,
 15,
 16,
 17,
 18,

 // D8 - D13
 19,
 20,
 22,
 23,
 24,
 25,

 // A0 - A7
 3,
 4,
 28,
 29,
 30,
 31,
 5, // AIN3 (P0.05)
 2, // AIN0 (P0.02) / AREF

 // SDA, SCL
 26,
 27,

 // RX, TX
 8,
 6
};

volatile NRF_PWM_Type* PWM[3] = {NRF_PWM0, NRF_PWM1, NRF_PWM2};
#endif

Thanks for your reply @matviienko. Your suggestion works just fine!