Skip to content

Commit

Permalink
stm32h7: hack to receive 11bit CAN frames
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes committed Nov 23, 2022
1 parent 6ae751c commit b39310b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion arch/arm/src/stm32h7/hardware/stm32_fdcan.h
Expand Up @@ -687,7 +687,7 @@
/* *************** Bit definition for FDCAN_XIDFC register ****************/
#define FDCAN_XIDFC_FLESA_SHIFT (2U)
#define FDCAN_XIDFC_FLESA_MASK (0x3FFFU << FDCAN_XIDFC_FLESA_SHIFT) /* 0x0000FFFC */
#define FDCAN_XIDFC_FLESA FDCAN_XIDFC_FLESA_MASK /* Filter List Standard Start Address */
#define FDCAN_XIDFC_FLESA FDCAN_XIDFC_FLESA_MASK /* Filter List Extended Start Address */
#define FDCAN_XIDFC_LSE_SHIFT (16U)
#define FDCAN_XIDFC_LSE_MASK (0xFFU << FDCAN_XIDFC_LSE_SHIFT) /* 0x00FF0000 */
#define FDCAN_XIDFC_LSE FDCAN_XIDFC_LSE_MASK /* List Size Extended */
Expand Down
8 changes: 6 additions & 2 deletions arch/arm/src/stm32h7/stm32_fdcan_sock.c
Expand Up @@ -2176,7 +2176,9 @@ int fdcan_initialize(struct fdcan_driver_s *priv)

/* Standard ID Filters: Allow space for 128 filters (128 words) */

const uint8_t n_stdid = 128;
// FIXME: I set this to 0 which fixes a problem where incoming CAN frames
// with the standard 11 bit ID are filtered out.
const uint8_t n_stdid = 0;
priv->message_ram.filt_stdid_addr = gl_ram_base + ram_offset * WORD_LENGTH;

regval = (n_stdid << FDCAN_SIDFC_LSS_SHIFT) & FDCAN_SIDFC_LSS_MASK;
Expand All @@ -2186,7 +2188,9 @@ int fdcan_initialize(struct fdcan_driver_s *priv)

/* Extended ID Filters: Allow space for 128 filters (128 words) */

const uint8_t n_extid = 128;
// FIXME: I do the same here just for consistency. I don't quite understand yet
// what is wrong with this.
const uint8_t n_extid = 0;
priv->message_ram.filt_extid_addr = gl_ram_base + ram_offset * WORD_LENGTH;

regval = (n_extid << FDCAN_XIDFC_LSE_SHIFT) & FDCAN_XIDFC_LSE_MASK;
Expand Down

0 comments on commit b39310b

Please sign in to comment.