Compare commits
	
		
			2 Commits
		
	
	
		
			bodgy-mcbo
			...
			bodgy-mcbo
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						a5f9f3019a
	
				 | 
					
					
						|||
| 
						
						
							
						
						e6f77a5e29
	
				 | 
					
					
						
@ -23,8 +23,7 @@
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.1893121708" name="Floating-point unit" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv4-sp-d16" valueType="enumerated"/>
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.2104279709" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.77669292" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.326360180" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F302C8Tx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Drivers/STM32F3xx_HAL_Driver/Inc | ../Drivers/CMSIS/Include | ../Core/Inc | ../Drivers/STM32F3xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F3xx/Include ||  ||  || USE_HAL_DRIVER | STM32F302x8 ||  || Drivers | Core/Startup | Core ||  ||  || ${workspace_loc:/${ProjName}/STM32F302C8TX_FLASH.ld} || true || NonSecure ||  || secure_nsclib.o ||  || None ||  ||  || " valueType="string"/>
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.164461163" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" value="8" valueType="string"/>
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.326360180" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.5 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F302C8Tx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Drivers/STM32F3xx_HAL_Driver/Inc | ../Drivers/CMSIS/Include | ../Core/Inc | ../Drivers/STM32F3xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F3xx/Include ||  ||  || USE_HAL_DRIVER | STM32F302x8 ||  || Drivers | Core/Startup | Core ||  ||  || ${workspace_loc:/${ProjName}/STM32F302C8TX_FLASH.ld} || true || NonSecure ||  || secure_nsclib.o ||  || None || " valueType="string"/>
 | 
			
		||||
							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1970141959" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
 | 
			
		||||
							<builder buildPath="${workspace_loc:/sdcl-firmware}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1431370682" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
 | 
			
		||||
							<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.306874017" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
 | 
			
		||||
@ -103,8 +102,7 @@
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.385019979" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv4-sp-d16" valueType="enumerated"/>
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.860143386" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1618095123" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1170098193" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F302C8Tx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Drivers/STM32F3xx_HAL_Driver/Inc | ../Drivers/CMSIS/Include | ../Core/Inc | ../Drivers/STM32F3xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F3xx/Include ||  ||  || USE_HAL_DRIVER | STM32F302x8 ||  || Drivers | Core/Startup | Core ||  ||  || ${workspace_loc:/${ProjName}/STM32F302C8TX_FLASH.ld} || true || NonSecure ||  || secure_nsclib.o ||  || None ||  ||  || " valueType="string"/>
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.1703375225" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="8" valueType="string"/>
 | 
			
		||||
							<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1170098193" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.5 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F302C8Tx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Drivers/STM32F3xx_HAL_Driver/Inc | ../Drivers/CMSIS/Include | ../Core/Inc | ../Drivers/STM32F3xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F3xx/Include ||  ||  || USE_HAL_DRIVER | STM32F302x8 ||  || Drivers | Core/Startup | Core ||  ||  || ${workspace_loc:/${ProjName}/STM32F302C8TX_FLASH.ld} || true || NonSecure ||  || secure_nsclib.o ||  || None || " valueType="string"/>
 | 
			
		||||
							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.2133501522" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
 | 
			
		||||
							<builder buildPath="${workspace_loc:/sdcl-firmware}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1576103886" managedBuildOn="true" name="Gnu Make Builder.Release" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
 | 
			
		||||
							<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.452758280" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -48,15 +48,6 @@ typedef enum {
 | 
			
		||||
	M_MANUAL		= 7
 | 
			
		||||
} mission_t;
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
	AS_OFF = 0,
 | 
			
		||||
	AS_MANUAL = 1,
 | 
			
		||||
	AS_READY = 2,
 | 
			
		||||
	AS_DRIVING = 3,
 | 
			
		||||
	AS_FINISHED = 4,
 | 
			
		||||
	AS_EMERGENCY = 5,
 | 
			
		||||
} as_state_t;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * BO_ 15 SDCL_rx: 3 ABX
 | 
			
		||||
 * SG_ as_close_sdc : 0|1@1+ (1,0) [0|1] ""  SDCL
 | 
			
		||||
@ -121,7 +112,6 @@ typedef union {
 | 
			
		||||
 | 
			
		||||
#define CAN_ID_RX 0x00F
 | 
			
		||||
#define CAN_ID_TX 0x010
 | 
			
		||||
#define CAN_ID_JETSON_RX 0x0E0
 | 
			
		||||
 | 
			
		||||
// Defined in DBC?
 | 
			
		||||
#define TX_UPDATE_PERIOD 100
 | 
			
		||||
@ -145,17 +135,15 @@ IWDG_HandleTypeDef hiwdg;
 | 
			
		||||
 | 
			
		||||
/* USER CODE BEGIN PV */
 | 
			
		||||
 | 
			
		||||
// Mission Maps:					NONE		ACCEL			SKIDPAD				AUTOX			EBSTEST				INSPECTION			TRACKDRIVE			MANUAL
 | 
			
		||||
const uint16_t	mission2led[] 	= {0		, AMI_ACCEL_Pin	, AMI_SKIDPAD_Pin	, AMI_AUTOX_Pin	, AMI_TRACKDRIVE_Pin, AMI_EBSTEST_Pin	, AMI_INSPECTION_Pin, AMI_MANUAL_Pin};
 | 
			
		||||
const mission_t	mission2next[] 	= {M_MANUAL	, M_SKIDPAD		, M_AUTOX			, M_EBSTEST			, M_INSPECTION		, M_MANUAL		, M_TRACKDRIVE	, M_ACCEL		};
 | 
			
		||||
// Mission Maps:					NONE		ACCEL			SKIDPAD				TRACKDRIVE			EBSTEST				INSPECTION			AUTOX			MANUAL
 | 
			
		||||
const uint16_t	mission2led[] 	= {0		, AMI_ACCEL_Pin	, AMI_SKIDPAD_Pin	, AMI_TRACKDRIVE_Pin, AMI_EBSTEST_Pin	, AMI_INSPECTION_Pin, AMI_AUTOX_Pin	, AMI_MANUAL_Pin};
 | 
			
		||||
const mission_t	mission2next[] 	= {M_MANUAL	, M_SKIDPAD		, M_AUTOX			, M_EBSTEST			, M_INSPECTION		, M_MANUAL			, M_TRACKDRIVE	, M_ACCEL		};
 | 
			
		||||
 | 
			
		||||
mission_t mission = M_NONE;
 | 
			
		||||
as_state_t state = AS_OFF;
 | 
			
		||||
 | 
			
		||||
bool setup_done = false;
 | 
			
		||||
 | 
			
		||||
#ifdef WATCHDOG_STM
 | 
			
		||||
bool heartbeat_received = false;
 | 
			
		||||
bool pHeartbeat = false;
 | 
			
		||||
bool WD_OK = false;
 | 
			
		||||
bool WD_initialized = false;
 | 
			
		||||
@ -210,7 +198,6 @@ int main(void)
 | 
			
		||||
 | 
			
		||||
#if false
 | 
			
		||||
  /* USER CODE END SysInit */
 | 
			
		||||
 | 
			
		||||
  /* Initialize all configured peripherals */
 | 
			
		||||
  MX_GPIO_Init();
 | 
			
		||||
  MX_CAN_Init();
 | 
			
		||||
@ -222,7 +209,10 @@ int main(void)
 | 
			
		||||
  __HAL_DBGMCU_FREEZE_IWDG();
 | 
			
		||||
 | 
			
		||||
  // Ensure we start with SDC disabled
 | 
			
		||||
  HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, GPIO_PIN_SET);
 | 
			
		||||
  HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, GPIO_PIN_RESET);
 | 
			
		||||
 | 
			
		||||
  // Show ASB Error by default until we receive CAN
 | 
			
		||||
  HAL_GPIO_WritePin(ASB_Error_GPIO_Port, ASB_Error_Pin, GPIO_PIN_SET);
 | 
			
		||||
 | 
			
		||||
  if (HAL_CAN_Start(&hcan) != HAL_OK)
 | 
			
		||||
  	Error_Handler();
 | 
			
		||||
@ -239,11 +229,7 @@ int main(void)
 | 
			
		||||
  canfilterconfig.FilterMode = CAN_FILTERMODE_IDMASK;
 | 
			
		||||
  canfilterconfig.FilterScale = CAN_FILTERSCALE_32BIT;
 | 
			
		||||
  canfilterconfig.SlaveStartFilterBank = 14;
 | 
			
		||||
  if (HAL_CAN_ConfigFilter(&hcan, &canfilterconfig) != HAL_OK) {
 | 
			
		||||
    Error_Handler();
 | 
			
		||||
  }
 | 
			
		||||
  canfilterconfig.FilterBank = 1;
 | 
			
		||||
  canfilterconfig.FilterIdHigh = CAN_ID_JETSON_RX << (16 -11);
 | 
			
		||||
 | 
			
		||||
  if (HAL_CAN_ConfigFilter(&hcan, &canfilterconfig) != HAL_OK) {
 | 
			
		||||
    Error_Handler();
 | 
			
		||||
  }
 | 
			
		||||
@ -286,7 +272,6 @@ int main(void)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setup_done = true;
 | 
			
		||||
  uint32_t last_msg = 0;
 | 
			
		||||
 | 
			
		||||
  while (true) {
 | 
			
		||||
 | 
			
		||||
@ -305,54 +290,49 @@ int main(void)
 | 
			
		||||
	bool CLOSED				= HAL_GPIO_ReadPin(CLOSED_GPIO_Port, CLOSED_Pin)						== GPIO_PIN_RESET;
 | 
			
		||||
	bool REOPENED			= HAL_GPIO_ReadPin(REOPENED_GPIO_Port, REOPENED_Pin)					== GPIO_PIN_RESET;
 | 
			
		||||
 | 
			
		||||
	if (HAL_GetTick() - last_msg >= TX_UPDATE_PERIOD) {
 | 
			
		||||
		last_msg = HAL_GetTick();
 | 
			
		||||
		bool AMC = HAL_GPIO_ReadPin(AMC_GPIO_Port, AMC_Pin) == GPIO_PIN_SET;
 | 
			
		||||
		// On signal edge. Debouncing usually not needed at these polling rates (10Hz)
 | 
			
		||||
		if (AMC < pAMC) {
 | 
			
		||||
	bool AMC = HAL_GPIO_ReadPin(AMC_GPIO_Port, AMC_Pin) == GPIO_PIN_SET;
 | 
			
		||||
	// On signal edge. Debouncing usually not needed at these polling rates (10Hz)
 | 
			
		||||
	if (AMC < pAMC) {
 | 
			
		||||
 | 
			
		||||
			// Reset LED to indicate transaction / mission change in progress
 | 
			
		||||
			setMissionLED(mission, GPIO_PIN_RESET);
 | 
			
		||||
		// Reset LED to indicate transaction / mission change in progress
 | 
			
		||||
		setMissionLED(mission, GPIO_PIN_RESET);
 | 
			
		||||
 | 
			
		||||
			new_mission = mission2next[mission];
 | 
			
		||||
			// New LED will be set once response from ABX is received
 | 
			
		||||
		new_mission = mission2next[mission];
 | 
			
		||||
		// New LED will be set once response from ABX is received
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// TEMP: Only enable WD if in autonomous mode because EMI currently messes it up during R2D
 | 
			
		||||
		if (ASMS > pASMS) {
 | 
			
		||||
			MX_IWDG_Init();
 | 
			
		||||
			WD_initialized = true;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		txData = (tx_data_t) {
 | 
			
		||||
			.signals = {
 | 
			
		||||
				.asms_state = ASMS,
 | 
			
		||||
				.sdc_state_1 = LV_SENSE_1,
 | 
			
		||||
				.sdc_state_2 = LV_SENSE_2,
 | 
			
		||||
				.sdc_state_3 = SDC_in_3V3,
 | 
			
		||||
				.heartbeat_ok = WD_OK,
 | 
			
		||||
				.sdc_ready = SDC_is_ready,
 | 
			
		||||
				.ts_start_muxed = TS_activate_MUXed,
 | 
			
		||||
				.latch_init_open = INITIAL_OPEN,
 | 
			
		||||
				.latch_closed = CLOSED,
 | 
			
		||||
				.latch_reopened = REOPENED,
 | 
			
		||||
				.as_mission = new_mission
 | 
			
		||||
			}
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		if (HAL_CAN_AddTxMessage(&hcan, &txHeader, txData.raw, &txMailbox) != HAL_OK)
 | 
			
		||||
			Error_Handler();
 | 
			
		||||
 | 
			
		||||
		// Store previous button value to detect signal edges
 | 
			
		||||
		pAMC = AMC;
 | 
			
		||||
		pASMS = ASMS;
 | 
			
		||||
	}
 | 
			
		||||
	if (state != AS_OFF && state != AS_MANUAL && WD_initialized) {
 | 
			
		||||
		HAL_IWDG_Refresh(&hiwdg);
 | 
			
		||||
		WD_OK = true;
 | 
			
		||||
 | 
			
		||||
	// TEMP: Only enable WD if in autonomous mode because EMI currently messes it up during R2D
 | 
			
		||||
	if (ASMS > pASMS) {
 | 
			
		||||
		MX_IWDG_Init();
 | 
			
		||||
		WD_initialized = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	txData = (tx_data_t) {
 | 
			
		||||
		.signals = {
 | 
			
		||||
			.asms_state = ASMS,
 | 
			
		||||
			.sdc_state_1 = LV_SENSE_1,
 | 
			
		||||
			.sdc_state_2 = LV_SENSE_2,
 | 
			
		||||
			.sdc_state_3 = SDC_in_3V3,
 | 
			
		||||
			.heartbeat_ok = WD_OK,
 | 
			
		||||
			.sdc_ready = SDC_is_ready,
 | 
			
		||||
			.ts_start_muxed = TS_activate_MUXed,
 | 
			
		||||
			.latch_init_open = INITIAL_OPEN,
 | 
			
		||||
			.latch_closed = CLOSED,
 | 
			
		||||
			.latch_reopened = REOPENED,
 | 
			
		||||
			.as_mission = new_mission
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	if (HAL_CAN_AddTxMessage(&hcan, &txHeader, txData.raw, &txMailbox) != HAL_OK)
 | 
			
		||||
		Error_Handler();
 | 
			
		||||
 | 
			
		||||
	// Store previous button value to detect signal edges
 | 
			
		||||
	pAMC = AMC;
 | 
			
		||||
	pASMS = ASMS;
 | 
			
		||||
 | 
			
		||||
	HAL_Delay(TX_UPDATE_PERIOD);
 | 
			
		||||
 | 
			
		||||
    /* USER CODE END WHILE */
 | 
			
		||||
 | 
			
		||||
    /* USER CODE BEGIN 3 */
 | 
			
		||||
@ -481,10 +461,7 @@ static void MX_GPIO_Init(void)
 | 
			
		||||
                          |AMI_AUTOX_Pin|AMI_SKIDPAD_Pin|AMI_ACCEL_Pin|AMI_MANUAL_Pin, GPIO_PIN_RESET);
 | 
			
		||||
 | 
			
		||||
  /*Configure GPIO pin Output Level */
 | 
			
		||||
  HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, GPIO_PIN_SET);
 | 
			
		||||
 | 
			
		||||
  /*Configure GPIO pin Output Level */
 | 
			
		||||
  HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_RESET);
 | 
			
		||||
  HAL_GPIO_WritePin(GPIOA, AS_close_SDC_Pin|Watchdog_Pin, GPIO_PIN_RESET);
 | 
			
		||||
 | 
			
		||||
  /*Configure GPIO pins : TS_activate_MUXed_Pin ASMS_Pin INITIAL_OPEN_Pin CLOSED_Pin
 | 
			
		||||
                           REOPENED_Pin WD_OK_Pin SDC_is_ready_Pin SDC_in_3V3_Pin
 | 
			
		||||
@ -533,46 +510,39 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) {
 | 
			
		||||
    Error_Handler();
 | 
			
		||||
 | 
			
		||||
  // Discard if it's not for us (shouldn't happen thanks to filter, but just to be sure)
 | 
			
		||||
  if (rxHeader.StdId == CAN_ID_RX) {
 | 
			
		||||
//	  return;
 | 
			
		||||
  if (rxHeader.StdId != CAN_ID_RX)
 | 
			
		||||
	  return;
 | 
			
		||||
 | 
			
		||||
#ifdef WATCHDOG_STM
 | 
			
		||||
 | 
			
		||||
	  if (rxData.signals.heartbeat != pHeartbeat) {
 | 
			
		||||
		  if (WD_initialized)
 | 
			
		||||
			  HAL_IWDG_Refresh(&hiwdg);
 | 
			
		||||
		  if (heartbeat_received) {
 | 
			
		||||
			  WD_OK = true;
 | 
			
		||||
		  }
 | 
			
		||||
		  heartbeat_received = true;
 | 
			
		||||
		  //HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_SET);
 | 
			
		||||
	  }
 | 
			
		||||
	  pHeartbeat = rxData.signals.heartbeat;
 | 
			
		||||
 | 
			
		||||
	  bool close_sdc = setup_done && rxData.signals.as_close_sdc && WD_OK;
 | 
			
		||||
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
	#ifdef WATCHDOG_UCC
 | 
			
		||||
	  HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, rxData.signals.heartbeat);
 | 
			
		||||
 | 
			
		||||
	  bool close_sdc = rxData.signals.as_close_sdc;
 | 
			
		||||
	#endif
 | 
			
		||||
 | 
			
		||||
	  // Set whether to close the relay. The port is inverted due to multiple bodges
 | 
			
		||||
	  GPIO_PinState close_sdc_val = close_sdc ? GPIO_PIN_RESET : GPIO_PIN_SET;
 | 
			
		||||
	  HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, close_sdc_val);
 | 
			
		||||
 | 
			
		||||
	  // Reset old mission LED
 | 
			
		||||
	  setMissionLED(mission, GPIO_PIN_RESET);
 | 
			
		||||
	  mission = rxData.signals.as_mission;
 | 
			
		||||
	  setMissionLED(mission, GPIO_PIN_SET);
 | 
			
		||||
 | 
			
		||||
	  // Set ASB Error status
 | 
			
		||||
	  HAL_GPIO_WritePin(ASB_Error_GPIO_Port, ASB_Error_Pin, rxData.signals.asb_error);
 | 
			
		||||
  } else if (rxHeader.StdId == CAN_ID_JETSON_RX) {
 | 
			
		||||
	  state = (rxData.raw[0] >> 3) & 0b111;
 | 
			
		||||
  if (rxData.signals.heartbeat != pHeartbeat) {
 | 
			
		||||
	  if (WD_initialized)
 | 
			
		||||
		  HAL_IWDG_Refresh(&hiwdg);
 | 
			
		||||
	  WD_OK = true;
 | 
			
		||||
  	  //HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, GPIO_PIN_SET);
 | 
			
		||||
  }
 | 
			
		||||
  pHeartbeat = rxData.signals.heartbeat;
 | 
			
		||||
 | 
			
		||||
  bool close_sdc = setup_done && rxData.signals.as_close_sdc;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef WATCHDOG_UCC
 | 
			
		||||
  HAL_GPIO_WritePin(Watchdog_GPIO_Port, Watchdog_Pin, rxData.signals.heartbeat);
 | 
			
		||||
 | 
			
		||||
  bool close_sdc = rxData.signals.as_close_sdc;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  // Set whether to close the relay
 | 
			
		||||
  HAL_GPIO_WritePin(AS_close_SDC_GPIO_Port, AS_close_SDC_Pin, close_sdc);
 | 
			
		||||
 | 
			
		||||
  // Reset old mission LED
 | 
			
		||||
  setMissionLED(mission, GPIO_PIN_RESET);
 | 
			
		||||
  mission = rxData.signals.as_mission;
 | 
			
		||||
  setMissionLED(mission, GPIO_PIN_SET);
 | 
			
		||||
 | 
			
		||||
  // Set ASB Error status
 | 
			
		||||
  HAL_GPIO_WritePin(ASB_Error_GPIO_Port, ASB_Error_Pin, rxData.signals.asb_error);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -38,8 +38,8 @@ ENTRY(Reset_Handler)
 | 
			
		||||
/* Highest address of the user mode stack */
 | 
			
		||||
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
 | 
			
		||||
 | 
			
		||||
_Min_Heap_Size = 0x200; /* required amount of heap */
 | 
			
		||||
_Min_Stack_Size = 0x400; /* required amount of stack */
 | 
			
		||||
_Min_Heap_Size = 0x200 ; /* required amount of heap */
 | 
			
		||||
_Min_Stack_Size = 0x400 ; /* required amount of stack */
 | 
			
		||||
 | 
			
		||||
/* Memories definition */
 | 
			
		||||
MEMORY
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,4 @@
 | 
			
		||||
#MicroXplorer Configuration settings - do not modify
 | 
			
		||||
CAD.formats=
 | 
			
		||||
CAD.pinconfig=
 | 
			
		||||
CAD.provider=
 | 
			
		||||
CAN.ABOM=ENABLE
 | 
			
		||||
CAN.AWUM=ENABLE
 | 
			
		||||
CAN.BS1=CAN_BS1_13TQ
 | 
			
		||||
@ -125,10 +122,9 @@ PA7.GPIOParameters=GPIO_Label
 | 
			
		||||
PA7.GPIO_Label=SDC_in_3V3
 | 
			
		||||
PA7.Locked=true
 | 
			
		||||
PA7.Signal=GPIO_Input
 | 
			
		||||
PA9.GPIOParameters=PinState,GPIO_Label
 | 
			
		||||
PA9.GPIOParameters=GPIO_Label
 | 
			
		||||
PA9.GPIO_Label=AS_close_SDC
 | 
			
		||||
PA9.Locked=true
 | 
			
		||||
PA9.PinState=GPIO_PIN_SET
 | 
			
		||||
PA9.Signal=GPIO_Output
 | 
			
		||||
PB0.GPIOParameters=GPIO_Label
 | 
			
		||||
PB0.GPIO_Label=LV_SENSE_1
 | 
			
		||||
@ -255,7 +251,7 @@ ProjectManager.FreePins=false
 | 
			
		||||
ProjectManager.HalAssertFull=false
 | 
			
		||||
ProjectManager.HeapSize=0x200
 | 
			
		||||
ProjectManager.KeepUserCode=true
 | 
			
		||||
ProjectManager.LastFirmware=true
 | 
			
		||||
ProjectManager.LastFirmware=false
 | 
			
		||||
ProjectManager.LibraryCopy=1
 | 
			
		||||
ProjectManager.MainLocation=Core/Src
 | 
			
		||||
ProjectManager.NoMain=false
 | 
			
		||||
@ -263,13 +259,12 @@ ProjectManager.PreviousToolchain=STM32CubeIDE
 | 
			
		||||
ProjectManager.ProjectBuild=false
 | 
			
		||||
ProjectManager.ProjectFileName=sdcl-firmware.ioc
 | 
			
		||||
ProjectManager.ProjectName=sdcl-firmware
 | 
			
		||||
ProjectManager.ProjectStructure=
 | 
			
		||||
ProjectManager.RegisterCallBack=
 | 
			
		||||
ProjectManager.StackSize=0x400
 | 
			
		||||
ProjectManager.TargetToolchain=STM32CubeIDE
 | 
			
		||||
ProjectManager.ToolChainLocation=
 | 
			
		||||
ProjectManager.UnderRoot=true
 | 
			
		||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_CAN_Init-CAN-false-HAL-true,4-MX_IWDG_Init-IWDG-false-HAL-true
 | 
			
		||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_CAN_Init-CAN-false-HAL-true,4-MX_WWDG_Init-WWDG-false-HAL-true
 | 
			
		||||
RCC.ADC12outputFreq_Value=16000000
 | 
			
		||||
RCC.AHBFreq_Value=8000000
 | 
			
		||||
RCC.APB1Freq_Value=8000000
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user