Skip to content

Commit

Permalink
CAN is operational!
Browse files Browse the repository at this point in the history
  • Loading branch information
jr1221 committed Oct 18, 2024
1 parent 1dd6afa commit d85974e
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 36 deletions.
1 change: 0 additions & 1 deletion Core/Inc/stm32f4xx_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ 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
3 changes: 1 addition & 2 deletions Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ static void MX_CAN1_Init(void)

/* USER CODE END CAN1_Init 1 */
hcan1.Instance = CAN1;
hcan1.Init.Prescaler = 1;
hcan1.Init.Prescaler = 2;
hcan1.Init.Mode = CAN_MODE_NORMAL;
hcan1.Init.SyncJumpWidth = CAN_SJW_1TQ;
hcan1.Init.TimeSeg1 = CAN_BS1_13TQ;
Expand All @@ -414,7 +414,6 @@ static void MX_CAN1_Init(void)
Error_Handler();
}
/* USER CODE BEGIN CAN1_Init 2 */
can1_init(&hcan1);

/* USER CODE END CAN1_Init 2 */

Expand Down
5 changes: 0 additions & 5 deletions Core/Src/stm32f4xx_hal_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ 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 @@ -227,8 +224,6 @@ 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: 0 additions & 15 deletions Core/Src/stm32f4xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@

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

/* USER CODE BEGIN EV */
Expand Down Expand Up @@ -161,20 +160,6 @@ 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
2 changes: 1 addition & 1 deletion Drivers/Embedded-Base
Submodule Embedded-Base updated 79 files
+19 −0 .github/workflows/format-check.yml
+4 −1 .gitignore
+10 −0 .pre-commit-config.yaml
+9 −0 cangen/CANField.py
+18 −2 cangen/CANMsg.py
+120 −50 cangen/README.md
+11 −3 cangen/Result.py
+248 −50 cangen/RustSynth.py
+567 −0 cangen/RustSynthFromJSON.py
+2 −1 cangen/YAMLParser.py
+4 −1 cangen/__init__.py
+529 −0 cangen/can-messages/bms.json
+0 −376 cangen/can-messages/bms.yaml
+119 −0 cangen/can-messages/calypso_cmd.json
+182 −0 cangen/can-messages/charger.json
+0 −93 cangen/can-messages/charger.yaml
+961 −0 cangen/can-messages/dti.json
+0 −543 cangen/can-messages/dti.yaml
+629 −0 cangen/can-messages/mpu.json
+0 −278 cangen/can-messages/mpu.yaml
+729 −0 cangen/can-messages/msb.json
+36 −0 cangen/can-messages/wheel.json
+0 −18 cangen/can-messages/wheel.yaml
+130 −0 cangen/jsongen
+16 −0 ftdi_flash.cfg
+1 −0 general/.clang-format-ignore
+28 −30 general/include/LTC4015.h
+7 −5 general/include/ads131m04.h
+43 −36 general/include/lsm6dso.h
+49 −47 general/include/ltc68041.h
+7 −5 general/include/m24c32.h
+16 −14 general/include/max7314.h
+3 −4 general/include/mcp23008.h
+26 −21 general/include/pca9539.h
+12 −12 general/include/pi4ioe.h
+21 −19 general/include/sht30.h
+256 −183 general/include/vl6180x_api.h
+39 −31 general/include/vl6180x_cfg.h
+356 −296 general/include/vl6180x_def.h
+46 −30 general/include/vl6180x_i2c.h
+115 −94 general/include/vl6180x_platform.h
+17 −13 general/include/vl6180x_types.h
+47 −43 general/src/LTC4015.c
+78 −66 general/src/ads131m04.c
+56 −35 general/src/lsm6dso.c
+824 −736 general/src/ltc68041.c
+47 −41 general/src/m24c32.c
+136 −120 general/src/max7314.c
+12 −12 general/src/mcp23008.c
+18 −16 general/src/pca9539.c
+39 −39 general/src/pi4ioe.c
+48 −44 general/src/sht30.c
+2,459 −2,467 general/src/vl6180x_api.c
+163 −165 general/src/vl6180x_i2c.c
+115 −0 launchpad.py
+4 −7 middleware/include/c_utils.h
+17 −23 middleware/include/eepromdirectory.h
+52 −0 middleware/include/i2c_utility.h
+13 −13 middleware/include/pid.h
+13 −13 middleware/include/ringbuffer.h
+10 −11 middleware/include/timer.h
+13 −14 middleware/src/c_utils.c
+66 −75 middleware/src/eepromdirectory.c
+176 −0 middleware/src/i2c_utility.c
+46 −47 middleware/src/pid.c
+60 −60 middleware/src/ringbuffer.c
+16 −17 middleware/src/timer.c
+3 −0 ner_environment/build_system/__init__.py
+295 −0 ner_environment/build_system/build_system.py
+50 −0 ner_environment/build_system/clang_restage.py
+73 −0 ner_environment/build_system/miniterm.py
+168 −0 ner_environment/ner_setup.py
+5 −0 ner_environment/requirements.txt
+19 −0 ner_environment/setup.py
+7 −0 openocd.cfg
+6 −6 platforms/stm32f405/include/can.h
+18 −12 platforms/stm32f405/src/can.c
+3 −3 platforms/stm32g431/include/fdcan.h
+5 −6 platforms/stm32g431/src/fdcan.c
9 changes: 4 additions & 5 deletions MSB-FW.ioc
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ CAD.provider=
CAN1.ABOM=ENABLE
CAN1.BS1=CAN_BS1_13TQ
CAN1.BS2=CAN_BS2_2TQ
CAN1.CalculateBaudRate=1000000
CAN1.CalculateTimeBit=1000
CAN1.CalculateTimeQuantum=62.5
CAN1.CalculateBaudRate=500000
CAN1.CalculateTimeBit=2000
CAN1.CalculateTimeQuantum=125.0
CAN1.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS1,BS2,ABOM,NART
CAN1.NART=DISABLE
CAN1.Prescaler=1
CAN1.Prescaler=2
Dma.ADC1.0.Direction=DMA_PERIPH_TO_MEMORY
Dma.ADC1.0.FIFOMode=DMA_FIFOMODE_DISABLE
Dma.ADC1.0.Instance=DMA2_Stream0
Expand Down Expand Up @@ -104,7 +104,6 @@ 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: [Mon Sep 30 23:00:37 GMT 2024]
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Fri Oct 18 02:28:33 GMT 2024]
##########################################################################################################################

# ------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ services:
ner-gcc-arm:
image: ghcr.io/northeastern-electric-racing/embedded-base:main
build: .
# network_mode: host
network_mode: host
privileged: true

volumes:
- type: bind
source: .
Expand Down
5 changes: 0 additions & 5 deletions flash.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,3 @@ source [find target/${STM_TARGET_NAME}x.cfg]
# Set the adapter speed
adapter speed 5000

# find elf
set elf_file "build/MSB-FW.elf"

# Program the ELF file
program $elf_file verify reset exit

0 comments on commit d85974e

Please sign in to comment.