From 0f2c1f6366d371d8b23b2cbef27b1e603ab9bca2 Mon Sep 17 00:00:00 2001 From: Justin Butler Date: Wed, 21 Aug 2024 21:16:32 +1200 Subject: [PATCH 1/2] Fix bug where buffers are not initialised. --- STM32_CAN.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/STM32_CAN.h b/STM32_CAN.h index 410edc4..4575b2c 100644 --- a/STM32_CAN.h +++ b/STM32_CAN.h @@ -193,8 +193,8 @@ class STM32_CAN { uint8_t timeseg2, uint8_t sjw); uint32_t getAPB1Clock(void); - volatile CAN_message_t *rx_buffer; - volatile CAN_message_t *tx_buffer; + volatile CAN_message_t *rx_buffer = nullptr; + volatile CAN_message_t *tx_buffer = nullptr; static constexpr Baudrate_entry_t BAUD_RATE_TABLE_48M[] { { From b000df634d1416661b49ca4a191b487ca2fc84fe Mon Sep 17 00:00:00 2001 From: Justin Butler Date: Wed, 21 Aug 2024 21:35:43 +1200 Subject: [PATCH 2/2] Fix IRQ Handler on STM32F0xx. --- STM32_CAN.h | 1 + 1 file changed, 1 insertion(+) diff --git a/STM32_CAN.h b/STM32_CAN.h index 4575b2c..196445a 100644 --- a/STM32_CAN.h +++ b/STM32_CAN.h @@ -32,6 +32,7 @@ to same folder with sketch and haven #define HAL_CAN_MODULE_ENABLED there. See e #if defined(STM32F0xx) #define CAN1_TX_IRQn CEC_CAN_IRQn #define CAN1_RX0_IRQn CEC_CAN_IRQn + #define CAN1_RX0_IRQHandler CEC_CAN_IRQHandler #endif #include