Skip to content

Commit f1cd9f2

Browse files
authored
samd: Add support for SAMC21
1 parent 0425b88 commit f1cd9f2

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/target/samd.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* * SAMD20J18A (rev B)
2929
* * SAMD21J18A (rev B)
3030
* * SAML21J17B (rev B)
31+
* * SAMC21N18A (rev E)
3132
*/
3233

3334
/*
@@ -129,7 +130,7 @@ const command_s samd_cmd_list[] = {
129130
#define SAMD_STATUSB_PROT (1U << 16U)
130131

131132
/* Device Identification Register (DID) */
132-
#define SAMD_DID_MASK 0xff380000U
133+
#define SAMD_DID_MASK 0xfe380000U
133134
#define SAMD_DID_CONST_VALUE 0x10000000U
134135
#define SAMD_DID_DEVSEL_MASK 0xffU
135136
#define SAMD_DID_DEVSEL_POS 0U
@@ -183,6 +184,24 @@ static const samd_part_s samd_d21_parts[] = {
183184
{0xff, 0, 0, 0}, /* Sentinel entry */
184185
};
185186

187+
static const samd_part_s samd_c21_parts[] = {
188+
{0x00, 'J', 18, 'A'}, /* SAMC21J18A */
189+
{0x01, 'J', 17, 'A'}, /* SAMC21J17A */
190+
{0x02, 'J', 16, 'A'}, /* SAMC21J16A */
191+
{0x03, 'J', 15, 'A'}, /* SAMC21J15A */
192+
{0x05, 'G', 18, 'A'}, /* SAMC21G18A */
193+
{0x06, 'G', 17, 'A'}, /* SAMC21G17A */
194+
{0x07, 'G', 16, 'A'}, /* SAMC21G16A */
195+
{0x08, 'G', 15, 'A'}, /* SAMC21G15A */
196+
{0x0a, 'E', 18, 'A'}, /* SAMC21E18A */
197+
{0x0b, 'E', 17, 'A'}, /* SAMC21E17A */
198+
{0x0c, 'E', 16, 'A'}, /* SAMC21E16A */
199+
{0x0d, 'E', 15, 'A'}, /* SAMC21E15A */
200+
{0x20, 'N', 18, 'A'}, /* SAMC21N18A */
201+
{0x21, 'N', 17, 'A'}, /* SAMC21N17A */
202+
{0xff, 0, 0, 0}, /* Sentinel entry */
203+
};
204+
186205
static const samd_part_s samd_l21_parts[] = {
187206
{0x00, 'J', 18, 'A'}, /* SAML21J18A */
188207
{0x01, 'J', 17, 'A'}, /* SAML21J17A */
@@ -379,6 +398,8 @@ samd_descr_s samd_parse_device_id(uint32_t did)
379398
samd.series = 20;
380399
break;
381400
case 1:
401+
if (family == 2)
402+
parts = samd_c21_parts;
382403
samd.series = 21;
383404
break;
384405
case 2:

0 commit comments

Comments
 (0)