From 802afaed343dee4cb1209a3cf33675bd9d46f4c2 Mon Sep 17 00:00:00 2001 From: Andrey G Date: Sun, 20 Jun 2021 15:18:16 +0300 Subject: [PATCH] Fixes eg33 (#2838) * CAN HW: use designated initizalization * board subaru eg33: set CAN transceiver EN to active state constantly While FW does not handle CAN transceiver's EN signal --- firmware/config/boards/subaru_eg33/board_io.h | 2 +- firmware/hw_layer/drivers/can/can_hw.cpp | 55 ++++++++++--------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/firmware/config/boards/subaru_eg33/board_io.h b/firmware/config/boards/subaru_eg33/board_io.h index 54b75b0a75..27961a9274 100644 --- a/firmware/config/boards/subaru_eg33/board_io.h +++ b/firmware/config/boards/subaru_eg33/board_io.h @@ -767,7 +767,7 @@ PIN_PUPDR_PULLUP(13) | \ PIN_PUPDR_FLOATING(14) | \ PIN_PUPDR_PULLUP(15)) -#define VAL_GPIOG_ODR (PIN_ODR_LOW(0) | \ +#define VAL_GPIOG_ODR (PIN_ODR_HIGH(0) | \ PIN_ODR_LOW(2) | \ PIN_ODR_HIGH(3) | \ PIN_ODR_HIGH(6) | \ diff --git a/firmware/hw_layer/drivers/can/can_hw.cpp b/firmware/hw_layer/drivers/can/can_hw.cpp index ba307e33c2..6119c2da5f 100644 --- a/firmware/hw_layer/drivers/can/can_hw.cpp +++ b/firmware/hw_layer/drivers/can/can_hw.cpp @@ -78,51 +78,54 @@ static bool isCanEnabled = false; */ #if defined(STM32F4XX) || defined(STM32F7XX) static const CANConfig canConfig100 = { -CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP, -CAN_BTR_100 }; + .mcr = CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP, + .btr = CAN_BTR_100 +}; static const CANConfig canConfig250 = { -CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP, -CAN_BTR_250 }; + .mcr = CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP, + .btr = CAN_BTR_250 +}; static const CANConfig canConfig500 = { -CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP, -CAN_BTR_500 }; + .mcr = CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP, + .btr = CAN_BTR_500 +}; static const CANConfig canConfig1000 = { CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP, CAN_BTR_1k0 }; #elif defined(STM32H7XX) static const CANConfig canConfig100 = { - CAN_NBTP_100, - CAN_DBTP_100, - 0, // CCCR - 0, // TEST - 0, + .NBTP = CAN_NBTP_100, + .DBTP = CAN_DBTP_100, + .CCCR = 0, + .TEST = 0, + .RXGFC = 0, }; static const CANConfig canConfig250 = { - CAN_NBTP_250, - CAN_DBTP_250, - 0, // CCCR - 0, // TEST - 0, + .NBTP = CAN_NBTP_250, + .DBTP = CAN_DBTP_250, + .CCCR = 0, + .TEST = 0, + .RXGFC = 0, }; static const CANConfig canConfig500 = { - CAN_NBTP_500, - CAN_DBTP_500, - 0, // CCCR - 0, // TEST - 0, + .NBTP = CAN_NBTP_500, + .DBTP = CAN_DBTP_500, + .CCCR = 0, + .TEST = 0, + .RXGFC = 0, }; static const CANConfig canConfig1000 = { - CAN_NBTP_1k0, - CAN_DBTP_1k0, - 0, // CCCR - 0, // TEST - 0, + .NBTP = CAN_NBTP_1k0, + .DBTP = CAN_DBTP_1k0, + .CCCR = 0, + .TEST = 0, + .RXGFC = 0, }; #endif