diff --git a/cpu/sam0_common/include/periph_cpu_common.h b/cpu/sam0_common/include/periph_cpu_common.h index e3bb094e5c2a92dcdf5c94821c4fa137b5d455ed..ece26bef8510114c7c1688cd74dfd6300876f9cd 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 }