I am looking at to better understand the datasheet for the ATSAMD21:
https://www.mouser.com/datasheet/2/268/ ... 580554.pdf
The Qt Py SAMD21 appears to use the ATSAMD21E18A-U model.
That 256KB model is hard [for me] to find, so I am using what I hope is only a 128KB difference model ATSAMD21E17D-AU.
I hope there is not a huge difference between the "A-U" and "D-AU".
I am trying to understand in the pinout image how the Qt Py SAMD21 uses different pins that are designated in the datasheet as green for analog and blue for digital.
From Page 24 of the datasheet:
For example, in this keypad demo (https://learn.adafruit.com/deluxe-4x4-n ... d?view=all) they are controlling the columns using Qt Py SAMD21 pins SCL, TX, RX, and SCK, with SDA sending the neopixel data.
Those pins resolve to the SAMD21's respective pins of PA17, PA06, PA07, and PA11, with PA16 sending the neopixel data.
In the first image, PA06 and PA07 are Analog, and PA11 and PA17 are Digital, and PA16 sending the neopixel data is also Digital.
Is it OK to mix and match Analog and Digital pins like that for the columns?
Must the neopixel pin be Digital, or could is also be any of the Analog pins?
Or maybe I am reading the datasheet pinouts all wrong or having some other brain fart.
Any help in understanding how to use the Qt Py SAMD21 pinouts and/or SAMD21 in general would be greatly appreciated.
My project is in relation to this thread, viewtopic.php?f=19&t=184476#p899657, in an attempt to cleanup the trace routes for the keypad columns on a 1x4 or larger keypad.
Thanks, and Happy Thanksgiving! Gobble Gobble!
Better understanding Qt Py SAMD21 Analog vs Digital pinouts
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- swooby
- Posts: 67
- Joined: Wed Jun 19, 2019 4:09 pm
- swooby
- Posts: 67
- Joined: Wed Jun 19, 2019 4:09 pm
Re: Better understanding Qt Py SAMD21 Analog vs Digital pino
Basically, in the project's (https://learn.adafruit.com/deluxe-4x4-n ... d?view=all) code [by John Park]:
A0, A1, A2, A3, A6, and A7 all show up in the SAMD21 datasheet as Analog pins PA02, PA03, PA04, PA05, PA06, and PA07 respectively.
A8 (SCK?) and SCL show in the SAMD21 datasheet as Digital pins PA11 and PA17 respecively. Does it really not matter in this use case if there is a mix of datasheet spec'ed Analog and Digital pins used for the rows and/or columns, or is there some magic that `Adafruit_Keypad` is doing to initialize those pins?
A8 (SCK?) and SCL show in the SAMD21 datasheet as Digital pins PA11 and PA17 respecively. Does it really not matter in this use case if there is a mix of datasheet spec'ed Analog and Digital pins used for the rows and/or columns, or is there some magic that `Adafruit_Keypad` is doing to initialize those pins?
- swooby
- Posts: 67
- Joined: Wed Jun 19, 2019 4:09 pm
Re: Better understanding Qt Py SAMD21 Analog vs Digital pino
I see a bit more detail about the pinouts here that may answer my question(s):
https://learn.adafruit.com/adafruit-qt- ... -3073174-3
It looks like a lot of the pins can be dual Analog or Digital purposed.
And it looks like Adafruit_Keypad initializes the rows as digital:
https://github.com/adafruit/Adafruit_Ke ... d.cpp#L116
https://learn.adafruit.com/adafruit-qt- ... -3073174-3
It looks like a lot of the pins can be dual Analog or Digital purposed.
And it looks like Adafruit_Keypad initializes the rows as digital:
https://github.com/adafruit/Adafruit_Ke ... d.cpp#L116
Code: Select all
void Adafruit_Keypad::begin() {
_keystates = (volatile byte *)malloc(_numRows * _numCols);
memset((void *)_keystates, 0, _numRows * _numCols);
for (int i = 0; i < _numCols; i++) {
pinMode(_col[i], OUTPUT);
digitalWrite(_col[i], HIGH);
}
for (int i = 0; i < _numRows; i++) {
pinMode(_row[i], INPUT_PULLUP);
}
}
- westfw
- Posts: 2010
- Joined: Fri Apr 27, 2007 1:01 pm
Re: Better understanding Qt Py SAMD21 Analog vs Digital pino
Any of the "analog" pins on a SAMD21 can be used as a digital pin instead (and perhaps other functions.)
See the "I/O Multiplexing and Considerations" section of the data sheet.
And/or this spreadsheet: https://docs.google.com/spreadsheets/d/ ... sp=sharing
(QT Py isn't on there, though.)
See the "I/O Multiplexing and Considerations" section of the data sheet.
And/or this spreadsheet: https://docs.google.com/spreadsheets/d/ ... sp=sharing
(QT Py isn't on there, though.)
Please be positive and constructive with your questions and comments.