arduino / arduino/ArduinoCore-samd

variant.cpp has so many mistakes that it can only be intentional

Open
#630 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

Hi,
I've been using this [variant.cpp](ArduinoCore-samd/variants/arduino_zero/variant.cpp) and the g_APinDescription has so many mistakes in it that I can only conclude these mistakes are maybe intentionnal. Let's take a [random](https://github.com/arduino/ArduinoCore-samd/blob/master/variants/arduino_zero/variant.cpp#L134) example:
```
{ PORTA, 6, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_6 }, // TCC1/WO[0]
```
If you read the spec sheet, PA06 can be used for many things, as correctly noted in the comments
```
| 8 | ~8 | PA06 | | EIC/EXTINT[6] ADC/AIN[6] AC/AIN[2] PTC/Y[4] SERCOM0/PAD[2]
TCC1/WO[0]
```
This pin can be muxed to be
* external interrup 6
* adc in 6
* ac in 2
* ptc 4
* sercom0 2
* tcc1 0

but the description tells e.g. No_ADC_Channel (and omit attribute PIN_ATTR_ANALOG)

Before I spend time fixing this and I submit a PR, can somebody confirm it is not a "feature".
And if it is indeed a feature, I propose to add, starting from e.g. position 50 in g_APinDescription (i.e. leaving a few empty spots), the complete pin definitions for each PortA and PortB pins (even for pins not broken out)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with variants/arduino_zero/variant.cpp and inspect g_APinDescription around the PA06 entry, comparing its attributes with the SAMD21 specification table cited in the issue. Confirm whether the existing mappings are intentional; done means documenting that decision or preparing complete, accurate PortA and PortB pin definitions as proposed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.