I have created a custom SAMD51 board everything is working good so far.....
Now I connected some of the unused pins to test points to see if I could get them up and running
The pins PB04,5,6,7 (Attached). MCU is ATSAMD51J20A-AU
To start with I was trying to connect PB04 first
Manual reference
http://ww1.microchip.com/downloads/en/DeviceDoc/SAMD21-Family-DataSheet-DS40001882D.pdf PB04 VDDANA EXTINT[4] AIN[12] AIN[0]
I copied the 1.6.2 variant files from the Arduino51 area to work with. I want to bring these pins on as simple analog pins. I will us the PB04 pin to read battery voltage. The other are simple High/Low to turn on power sources etc.
So I opened the variant.h file and the variant.ccp files. THese are the changes I made
Variant.h
// Number of pins defined in PinDescription array
#define PINS_COUNT (37u) //Changed from 36 to 37
#define NUM_DIGITAL_PINS (20u)
#define NUM_ANALOG_INPUTS (7u) // Changed from 6 to 7
#define NUM_ANALOG_OUTPUTS (1u)
#define analogInputToDigitalPin(p) ((p < 7u) ? (p) + 14u : -1) //change from 6u to 7u
* Analog pins
*/
#define PIN_A0 (14ul)
#define PIN_A1 (PIN_A0 + 1)
#define PIN_A2 (PIN_A0 + 2)
#define PIN_A3 (PIN_A0 + 3)
#define PIN_A4 (PIN_A0 + 4)
#define PIN_A5 (PIN_A0 + 5)
#define PIN_A6 (PIN_A0 + 6) //added
#define PIN_DAC0 (14ul)
#define PIN_DAC1 PIN_A1
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; //added this line
variant.ccp
// 14..19 - Analog pins
// --------------------
{ PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 },
{ PORTB, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel12, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, //Added this line
{ PORTB, 8, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel2, TC4_CH0, TC4_CH0, EXTERNAL_INT_8 },
{ PORTB, 9, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel3, TC4_CH1, TC4_CH1, EXTERNAL_INT_9 },
{ PORTA, 4, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel4, TC0_CH0, TC0_CH0, EXTERNAL_INT_6 },
{ PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 },
{ PORTB, 2, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel14, TC6_CH0, TC6_CH0, EXTERNAL_INT_2 },
After I load these new files and run the blink code everything compiles correct but A6/PB4 never blinks the led....
Anyone have a bit more experience in this area and could shed some light on why this does not work?
Thanks.
T