nrf52840 mini setup issue

Attempting to setup a new nrf52840 mini using this guide: https://learn.sparkfun.com/tutorials/sp … okup-guide

On both mac and PC I get everything installed (variants etc) and board can be selected, but when I compile I get this error:

/Users/john/Library/Arduino15/packages/adafruit/hardware/nrf52/0.20.1/cores/nRF5/Uart.cpp:247:48: error: 'PIN_SERIAL1_RX' was not declared in this scope
   Uart Serial1( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );
                                                ^~~~~~~~~~~~~~
/Users/john/Library/Arduino15/packages/adafruit/hardware/nrf52/0.20.1/cores/nRF5/Uart.cpp:247:48: note: suggested alternative: 'PIN_SERIAL_RX'
   Uart Serial1( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );
                                                ^~~~~~~~~~~~~~
                                                PIN_SERIAL_RX
/Users/john/Library/Arduino15/packages/adafruit/hardware/nrf52/0.20.1/cores/nRF5/Uart.cpp:247:64: error: 'PIN_SERIAL1_TX' was not declared in this scope
   Uart Serial1( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );
                                                                ^~~~~~~~~~~~~~
/Users/john/Library/Arduino15/packages/adafruit/hardware/nrf52/0.20.1/cores/nRF5/Uart.cpp:247:64: note: suggested alternative: 'PIN_SERIAL_TX'
   Uart Serial1( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );

I suspect I am missing a header file that defines these or the boards.txt copy/paste definition is missing something. Both my mac and PC arduino installs work for all of my other devices (nodemcu, arduino pro mini etc) so I am confident in my setup.

Thanks for help with this basic issue!

John-

I think I resolved this by manually updating variant.h. For nrf it only defines PIN_SERIAL_RX and PIN_SERIAL_TX. All other variants that are installed defined PIN_SERIAL1_RX and PIN_SERIAL1_TX.

My variant.h looks like this now

/*
 * Serial interfaces
 */
// Serial
#define PIN_SERIAL_RX       (15)
#define PIN_SERIAL_TX       (17)
/*
 * added for arduino compatibility
 *
*/
#define PIN_SERIAL1_RX       (15)
#define PIN_SERIAL1_TX       (17)

I have not tested deeply but this at least let the code compile. Is this a fix required on the sparkfun side to the adafruit nrf libs?

@jotermoter Our solutions are the same. Thank you for posting. One thing I noticed with this solution was that my devices would work as a Central Scanner, but they won’t work as a Beacon Advertiser. Do you think the Serial1 definition is messing up the radio communication?

Not sure but that would make sense. This is really non-standard for how serial is defined usually. Sparkfun should update the libs.

I’ve moved on to ESP32’s now for combo BT/Wifi, my nrf is collecting a bit of dust at the moment…