From d3cd2b71c0092abfaa0799e9dbaf404cd573eced Mon Sep 17 00:00:00 2001 From: Federico Pellegrin <fede@evolware.org> Date: Sun, 2 Sep 2018 12:44:08 +0200 Subject: [PATCH] sam0_common: fix sercom_id return value for SERCOM5 (#9875) --- cpu/sam0_common/include/periph_cpu_common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpu/sam0_common/include/periph_cpu_common.h b/cpu/sam0_common/include/periph_cpu_common.h index e3bb094e5c..ece26bef85 100644 --- a/cpu/sam0_common/include/periph_cpu_common.h +++ b/cpu/sam0_common/include/periph_cpu_common.h @@ -299,7 +299,8 @@ static inline int sercom_id(void *sercom) #if defined(CPU_FAM_SAMD21) return ((((uint32_t)sercom) >> 10) & 0x7) - 2; #elif defined(CPU_FAM_SAML21) - return ((((uint32_t)sercom) >> 10) & 0x7); + /* Left side handles SERCOM0-4 while right side handles unaligned address of SERCOM5 */ + return ((((uint32_t)sercom) >> 10) & 0x7) + ((((uint32_t)sercom) >> 22) & 0x04); #endif } -- GitLab