Skip to content

Makerdiary.com nRF52832-MDK supported by generic device #301

Open
@w8abz

Description

@w8abz

All,
I was able to get the "generic nRF52" device to support the makerdiary.com nRF52832-MDK (which I got from Seeed Studio) by modifying the generic variant.h file to line up the various pins, especially the RGB LED and tx/rx pins for serial support. The modified variant.h is listed below. That was all I needed to modify to get everything I needed working.

Not so much an "issue" as hoping this helps someone else.

Sorry, I don't know the Arduino library/hardware structure well enough to create a whole new variant.

BTW, I hope you'll support the nRF52840-MDK soon, too!

Dale

  /*
  Copyright (c) 2014-2015 Arduino LLC.  All right reserved.
  Copyright (c) 2016 Sandeep Mistry All right reserved.
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU Lesser General Public License for more details.
  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

#ifndef _VARIANT_GENERIC_
#define _VARIANT_GENERIC_

/** Master clock frequency */
#ifdef NRF52
#define VARIANT_MCK       (64000000ul)
#else
#define VARIANT_MCK       (16000000ul)
#endif

/*----------------------------------------------------------------------------
 *        Headers
 *----------------------------------------------------------------------------*/

#include "WVariant.h"

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

// Number of pins defined in PinDescription array
#define PINS_COUNT           (32u)
#define NUM_DIGITAL_PINS     (32u)
#define NUM_ANALOG_INPUTS    (8u)
#define NUM_ANALOG_OUTPUTS   (0u)

// LEDs
#define PIN_LEDG               (22)   // P0.22
#define PIN_LEDR               (23)   // P0.23
#define PIN_LEDB               (24)   // P0.24
#define LED_BUILTIN            PIN_LEDG

/*
 * Analog pins
 */
#define PIN_A0               (2)  // P0.02
#define PIN_A1               (3)  // P0.03
#define PIN_A2               (4)  // P0.04
#define PIN_A3               (5)  // P0.05
#define PIN_A4               (28) // P0.28
#define PIN_A5               (29) // P0.29
#define PIN_A6               (30) // P0.30
#define PIN_A7               (31) // P0.31

static const uint8_t A0  = PIN_A0 ;
static const uint8_t A1  = PIN_A1 ;
static const uint8_t A2  = PIN_A2 ;
static const uint8_t A3  = PIN_A3 ;
static const uint8_t A4  = PIN_A4 ;
static const uint8_t A5  = PIN_A5 ;
static const uint8_t A6  = PIN_A6 ;
static const uint8_t A7  = PIN_A7 ;
#ifdef NRF52
#define ADC_RESOLUTION    14
#else
#define ADC_RESOLUTION    10
#endif

/*
 * Serial interfaces
 */
// Serial
#define PIN_SERIAL_RX       (19) // P0.19
#define PIN_SERIAL_TX       (20) // P0.20

/*
 * SPI Interfaces
 */
#define SPI_INTERFACES_COUNT 1

#define PIN_SPI_MISO         (11) // P0.11
#define PIN_SPI_MOSI         (12) // P0.12
#define PIN_SPI_SCK          (13) // P0.13

static const uint8_t SS   = (14) ;  // P0.14
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t MISO = PIN_SPI_MISO ;
static const uint8_t SCK  = PIN_SPI_SCK ;

/*
 * Wire Interfaces
 */
#define WIRE_INTERFACES_COUNT 1

#define PIN_WIRE_SDA         (15u) // P0.15
#define PIN_WIRE_SCL         (16u) // P0.16

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

#ifdef __cplusplus
}
#endif

#endif

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions