From f6c1108bdf444ba9aef1113ec39c7fc814dab85e Mon Sep 17 00:00:00 2001 From: Philipp Scheff Date: Fri, 16 Jun 2023 14:56:28 +0200 Subject: [PATCH] fix extended can id --- embassy-stm32/src/can/bxcan.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/embassy-stm32/src/can/bxcan.rs b/embassy-stm32/src/can/bxcan.rs index 08ba783ff..1ab4dc1fc 100644 --- a/embassy-stm32/src/can/bxcan.rs +++ b/embassy-stm32/src/can/bxcan.rs @@ -226,7 +226,10 @@ impl<'d, T: Instance> Can<'d, T> { let id = if rir.ide() == RirIde::STANDARD { Id::from(StandardId::new_unchecked(rir.stid())) } else { - Id::from(ExtendedId::new_unchecked(rir.exid())) + let stid = (rir.stid() & 0x7FF) as u32; + let exid = rir.exid() & 0x3FFFF; + let id = (stid << 18) | (exid as u32); + Id::from(ExtendedId::new_unchecked(id)) }; let data_len = fifo.rdtr().read().dlc() as usize; let mut data: [u8; 8] = [0; 8];