Skip to content

Commit

Permalink
Merge branch 'main' into LSM6DSO-to-STM
Browse files Browse the repository at this point in the history
  • Loading branch information
Myers-Ty committed Dec 6, 2024
2 parents e56c715 + ffce6fc commit dc3596a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions Core/Inc/stm32f4xx_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void DebugMon_Handler(void);
void CAN1_RX0_IRQHandler(void);
void TIM5_IRQHandler(void);
void DMA2_Stream0_IRQHandler(void);
/* USER CODE BEGIN EFP */
Expand Down
4 changes: 3 additions & 1 deletion Core/Src/can_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#define CAN_MSG_QUEUE_SIZE 25 /* messages */
static osMessageQueueId_t can_outbound_queue;

static uint32_t id_list[4] = { 0x000, 0x000, 0x000, 0x002 };

extern CAN_HandleTypeDef hcan1;

can_t *can1;
Expand All @@ -32,7 +34,7 @@ void can1_init()
assert(can1);

can1->hcan = &hcan1;

assert(!can_add_filter(can1, id_list));
assert(!can_init(can1));
#endif

Expand Down
2 changes: 1 addition & 1 deletion Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ static void MX_CAN1_Init(void)
hcan1.Init.TimeTriggeredMode = DISABLE;
hcan1.Init.AutoBusOff = ENABLE;
hcan1.Init.AutoWakeUp = DISABLE;
hcan1.Init.AutoRetransmission = DISABLE;
hcan1.Init.AutoRetransmission = ENABLE;
hcan1.Init.ReceiveFifoLocked = DISABLE;
hcan1.Init.TransmitFifoPriority = DISABLE;
if (HAL_CAN_Init(&hcan1) != HAL_OK)
Expand Down
5 changes: 5 additions & 0 deletions Core/Src/stm32f4xx_hal_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan)
GPIO_InitStruct.Alternate = GPIO_AF9_CAN1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/* CAN1 interrupt Init */
HAL_NVIC_SetPriority(CAN1_RX0_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(CAN1_RX0_IRQn);
/* USER CODE BEGIN CAN1_MspInit 1 */

/* USER CODE END CAN1_MspInit 1 */
Expand Down Expand Up @@ -224,6 +227,8 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan)
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12);

/* CAN1 interrupt DeInit */
HAL_NVIC_DisableIRQ(CAN1_RX0_IRQn);
/* USER CODE BEGIN CAN1_MspDeInit 1 */

/* USER CODE END CAN1_MspDeInit 1 */
Expand Down
15 changes: 15 additions & 0 deletions Core/Src/stm32f4xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

/* External variables --------------------------------------------------------*/
extern DMA_HandleTypeDef hdma_adc1;
extern CAN_HandleTypeDef hcan1;
extern TIM_HandleTypeDef htim5;

/* USER CODE BEGIN EV */
Expand Down Expand Up @@ -173,6 +174,20 @@ void DebugMon_Handler(void)
/* please refer to the startup file (startup_stm32f4xx.s). */
/******************************************************************************/

/**
* @brief This function handles CAN1 RX0 interrupts.
*/
void CAN1_RX0_IRQHandler(void)
{
/* USER CODE BEGIN CAN1_RX0_IRQn 0 */

/* USER CODE END CAN1_RX0_IRQn 0 */
HAL_CAN_IRQHandler(&hcan1);
/* USER CODE BEGIN CAN1_RX0_IRQn 1 */

/* USER CODE END CAN1_RX0_IRQn 1 */
}

/**
* @brief This function handles TIM5 global interrupt.
*/
Expand Down
3 changes: 2 additions & 1 deletion MSB-FW.ioc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CAN1.CalculateBaudRate=500000
CAN1.CalculateTimeBit=2000
CAN1.CalculateTimeQuantum=125.0
CAN1.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS1,BS2,ABOM,NART
CAN1.NART=DISABLE
CAN1.NART=ENABLE
CAN1.Prescaler=2
Dma.ADC1.0.Direction=DMA_PERIPH_TO_MEMORY
Dma.ADC1.0.FIFOMode=DMA_FIFOMODE_DISABLE
Expand Down Expand Up @@ -104,6 +104,7 @@ Mcu.UserName=STM32F405RGTx
MxCube.Version=6.11.1
MxDb.Version=DB.6.0.111
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
NVIC.CAN1_RX0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
NVIC.DMA2_Stream0_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
NVIC.ForceEnableDMAVector=true
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Fri Oct 18 02:28:33 GMT 2024]
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Fri Nov 08 02:15:30 GMT 2024]
##########################################################################################################################

# ------------------------------------------------
Expand Down

0 comments on commit dc3596a

Please sign in to comment.