Go Down

Topic: Primo and PWM (Read 392 times) previous topic - next topic


First post here, so be gentle..

Recently got an Arduino Primo and it's a great little board. I did however run into a snag, and my c++ skills being what they are I can't really figure it out.

I'am simply trying to compile a small sketch to use a NeoPixel ring, by means of the Adafruit_NeoPixel.h library. When attempting to compile it tells me that:

Code: [Select]

C:\Arduino\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp: In member function 'void Adafruit_NeoPixel::show()':

C:\Arduino\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp:1373:24: error: 'g_ADigitalPinMap' was not declared in this scope

     pwm->PSEL.OUT[0] = g_ADigitalPinMap[pin];


C:\Arduino\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp:1424:31: error: 'g_ADigitalPinMap' was not declared in this scope

     uint32_t pinMask = 1UL << g_ADigitalPinMap[pin];

That is, it seems ti be looking for a g_ADigitalPinMap which is undefined, which is true. The only place I've been able to find any reference to that object is in this Github


Like I said, I am a bit lacking in skills here, so any help would be appreciated!


That's a fancy little board you've got yourself there. If you are a beginner, there is nothing better than starting at the bleeding edge...

After having a look, it seems that the Adafruit_NeoPixel can run on one of those RF52832 MCUs. However, Adafruit have their own boards which use (among others) the RF52832 chip, sold under the "Feather" name. These boards have their own board definitions (I use the term loosely) which are used by the Arduino IDE to build your sketch. The NeoPixel library assumes you are using a Feather board and uses that g_ADigitalPinMap variable because it is available there. However, the Arduino Primo board definitions don't have that variable declared and so it fails to build.

As a workaround, the simplest way to fix this error is for you to go into your Arduino libraries folder and then into the NeoPixel sub-folder. Edit the Adafruit_NeoPixel.cpp file. Near the beginning of the file you will see this:

Code: [Select]
#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

which you should change to this:

Code: [Select]
#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



Obviously the folks at Adafruit haven't specifically targeted your board, so there could be other problems approaching you, who knows. But maybe you get lucky.


It's a nicve board, yes. And while I'm not a total beginner, having a degree in electrical engineering and having worked as a programmer for 20 years I am new to the Arduino landscape and, like I said, is not the greatest c or c++ programmer. I pretty much got as far as figuring out that the problem was what you said, a "misidentification" of my board, I really couldn't figure out a solution, so I very much appreciate your help.

And yea, there sure may be some other issues along the road, each one is a chance to learn something ne though!



Hi my friend I just bought the arduino primo board and I want to use a neopixel ring as well. Did you manage to make it work?

Cheers Alex

Go Up