Skip to content

Commit 0d6b4db

Browse files
Hasnain Virkjanjongboom
authored andcommitted
Swapping I2C pins between original and extended PAD
Looking at the board layout (SAML21 Xplained Pro) we can see that out of three EXT pinouts only two (EXT1 and EXT3) have a set of four pins available on a single SERCOM. For example (PB16, PB17, PB22, PB23) on EXT3 are mapped to SERCOM5. So if we wish to add a peripheral that uses 4 pin SPI like a SX1276 Wing radio, we can only choose EXt3 or EXT1. However, we found out that we can't use radio shield on EXT3 as the pin PB10 used as dio2 interrupt line is also mapped to the LED. For both SPI and I2C peripherlas, HAL chooses Default PAD. This would result in picking up SERCOM0 for I2C pins (PA08 and PA09) which will not work for us as we have attached the secure element to EXT3 and we need to map these pins to SERCOM2. One way of solving the issue is to mark PA08 and PA09 as NC on SERCOM0 by default. Another is to swap the SERCOMx mapping for the PA08 and PA09 between the Default PAD and Extended PAD. A proper fix would probably be to physically cut PB10 and LED connection. This would mean that we don't need to hack the pin map.
1 parent f6d2322 commit 0d6b4db

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

targets/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAML21J18A/PeripheralPins.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ const PinMap PinMap_DAC[] = {
5555
/************SERCOM Pins***********/
5656
const PinMap PinMap_SERCOM_PAD[] = {
5757
{PA04, SERCOM0_PAD0, 3},
58-
{PA08, SERCOM0_PAD0, 2},
58+
{PA08, SERCOM2_PAD0, 3},
5959
{PA05, SERCOM0_PAD1, 3},
60-
{PA09, SERCOM0_PAD1, 2},
60+
{PA09, SERCOM2_PAD1, 3},
6161
{PA06, SERCOM0_PAD2, 3},
6262
{PA10, SERCOM0_PAD2, 2},
6363
{PA07, SERCOM0_PAD3, 3},
@@ -106,8 +106,8 @@ const PinMap PinMap_SERCOM_PAD[] = {
106106

107107
/*******SERCOM Pins extended*******/
108108
const PinMap PinMap_SERCOM_PADEx[] = {
109-
{PA08, SERCOM2_PAD0, 3},
110-
{PA09, SERCOM2_PAD1, 3},
109+
{PA08, SERCOM0_PAD0, 2},
110+
{PA09, SERCOM0_PAD1, 2},
111111
{PA10, SERCOM2_PAD2, 3},
112112
{PA11, SERCOM2_PAD3, 3},
113113
{PA16, SERCOM3_PAD0, 3},

0 commit comments

Comments
 (0)