Firmware integration fixes

This commit is contained in:
Oskar Winkels 2023-04-26 15:06:03 +02:00
parent b20f63608d
commit fd5478a521
Signed by: o.winkels
GPG Key ID: E7484A06E99DAEF1
2 changed files with 18 additions and 13 deletions

View File

@ -190,7 +190,6 @@ int main(void)
Error_Handler(); Error_Handler();
// TODO: Use Filter // TODO: Use Filter
/*
CAN_FilterTypeDef canfilterconfig; CAN_FilterTypeDef canfilterconfig;
canfilterconfig.FilterActivation = CAN_FILTER_ENABLE; canfilterconfig.FilterActivation = CAN_FILTER_ENABLE;
@ -207,7 +206,6 @@ int main(void)
if (HAL_CAN_ConfigFilter(&hcan, &canfilterconfig) != HAL_OK) { if (HAL_CAN_ConfigFilter(&hcan, &canfilterconfig) != HAL_OK) {
Error_Handler(); Error_Handler();
} }
*/
if (HAL_CAN_ActivateNotification(&hcan, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK) if (HAL_CAN_ActivateNotification(&hcan, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK)
Error_Handler(); Error_Handler();
@ -232,19 +230,21 @@ int main(void)
bool pAMC = false; bool pAMC = false;
mission_t new_mission = mission; // By default, don't change mission mission_t new_mission = mission; // By default, don't change mission
HAL_Delay(1000);
while (true) { while (true) {
bool TS_activate_MUXed = HAL_GPIO_ReadPin(TS_activate_MUXed_GPIO_Port, TS_activate_MUXed_Pin) == GPIO_PIN_SET; bool TS_activate_MUXed = HAL_GPIO_ReadPin(TS_activate_MUXed_GPIO_Port, TS_activate_MUXed_Pin) == GPIO_PIN_RESET;
bool ASMS = HAL_GPIO_ReadPin(ASMS_GPIO_Port, ASMS_Pin) == GPIO_PIN_SET; bool ASMS = HAL_GPIO_ReadPin(ASMS_GPIO_Port, ASMS_Pin) == GPIO_PIN_RESET;
bool WD_OK = HAL_GPIO_ReadPin(WD_OK_GPIO_Port, WD_OK_Pin) == GPIO_PIN_SET; //bool WD_OK = HAL_GPIO_ReadPin(WD_OK_GPIO_Port, WD_OK_Pin) == GPIO_PIN_RESET;
bool SDC_is_ready = HAL_GPIO_ReadPin(SDC_is_ready_GPIO_Port, SDC_is_ready_Pin) == GPIO_PIN_SET; bool SDC_is_ready = HAL_GPIO_ReadPin(SDC_is_ready_GPIO_Port, SDC_is_ready_Pin) == GPIO_PIN_SET;
bool SDC_in_3V3 = HAL_GPIO_ReadPin(SDC_in_3V3_GPIO_Port, SDC_in_3V3_Pin) == GPIO_PIN_SET; bool SDC_in_3V3 = HAL_GPIO_ReadPin(SDC_in_3V3_GPIO_Port, SDC_in_3V3_Pin) == GPIO_PIN_SET;
bool LV_SENSE_1 = HAL_GPIO_ReadPin(LV_SENSE_1_GPIO_Port, LV_SENSE_1_Pin) == GPIO_PIN_SET; bool LV_SENSE_1 = HAL_GPIO_ReadPin(LV_SENSE_1_GPIO_Port, LV_SENSE_1_Pin) == GPIO_PIN_SET;
bool LV_SENSE_2 = HAL_GPIO_ReadPin(LV_SENSE_2_GPIO_Port, LV_SENSE_2_Pin) == GPIO_PIN_SET; bool LV_SENSE_2 = HAL_GPIO_ReadPin(LV_SENSE_2_GPIO_Port, LV_SENSE_2_Pin) == GPIO_PIN_SET;
bool INITIAL_OPEN = HAL_GPIO_ReadPin(INITIAL_OPEN_GPIO_Port, INITIAL_OPEN_Pin) == GPIO_PIN_SET; bool INITIAL_OPEN = HAL_GPIO_ReadPin(INITIAL_OPEN_GPIO_Port, INITIAL_OPEN_Pin) == GPIO_PIN_RESET;
bool CLOSED = HAL_GPIO_ReadPin(CLOSED_GPIO_Port, CLOSED_Pin) == GPIO_PIN_SET; 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_SET; bool REOPENED = HAL_GPIO_ReadPin(REOPENED_GPIO_Port, REOPENED_Pin) == GPIO_PIN_RESET;
bool AMC = HAL_GPIO_ReadPin(AMC_GPIO_Port, AMC_Pin) == GPIO_PIN_SET; 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) // On signal edge. Debouncing usually not needed at these polling rates (10Hz)
@ -258,7 +258,10 @@ int main(void)
} }
tx_data_t txData = { // TODO: Depends on STM watchdog
bool WD_OK = true;
txData = (tx_data_t) {
.signals = { .signals = {
.asms_state = ASMS, .asms_state = ASMS,
.sdc_state_1 = LV_SENSE_1, .sdc_state_1 = LV_SENSE_1,
@ -347,8 +350,8 @@ static void MX_CAN_Init(void)
hcan.Init.TimeSeg1 = CAN_BS1_13TQ; hcan.Init.TimeSeg1 = CAN_BS1_13TQ;
hcan.Init.TimeSeg2 = CAN_BS2_2TQ; hcan.Init.TimeSeg2 = CAN_BS2_2TQ;
hcan.Init.TimeTriggeredMode = DISABLE; hcan.Init.TimeTriggeredMode = DISABLE;
hcan.Init.AutoBusOff = DISABLE; hcan.Init.AutoBusOff = ENABLE;
hcan.Init.AutoWakeUp = DISABLE; hcan.Init.AutoWakeUp = ENABLE;
hcan.Init.AutoRetransmission = ENABLE; hcan.Init.AutoRetransmission = ENABLE;
hcan.Init.ReceiveFifoLocked = DISABLE; hcan.Init.ReceiveFifoLocked = DISABLE;
hcan.Init.TransmitFifoPriority = DISABLE; hcan.Init.TransmitFifoPriority = DISABLE;

View File

@ -1,10 +1,12 @@
#MicroXplorer Configuration settings - do not modify #MicroXplorer Configuration settings - do not modify
CAN.ABOM=ENABLE
CAN.AWUM=ENABLE
CAN.BS1=CAN_BS1_13TQ CAN.BS1=CAN_BS1_13TQ
CAN.BS2=CAN_BS2_2TQ CAN.BS2=CAN_BS2_2TQ
CAN.CalculateBaudRate=500000 CAN.CalculateBaudRate=500000
CAN.CalculateTimeBit=2000 CAN.CalculateTimeBit=2000
CAN.CalculateTimeQuantum=125.0 CAN.CalculateTimeQuantum=125.0
CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS1,BS2,SJW,NART CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS1,BS2,SJW,NART,ABOM,AWUM
CAN.NART=ENABLE CAN.NART=ENABLE
CAN.Prescaler=1 CAN.Prescaler=1
CAN.SJW=CAN_SJW_1TQ CAN.SJW=CAN_SJW_1TQ
@ -257,7 +259,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=STM32CubeIDE ProjectManager.TargetToolchain=STM32CubeIDE
ProjectManager.ToolChainLocation= ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=true 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_ADC1_Init-ADC1-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
RCC.ADC12outputFreq_Value=16000000 RCC.ADC12outputFreq_Value=16000000
RCC.AHBFreq_Value=8000000 RCC.AHBFreq_Value=8000000
RCC.APB1Freq_Value=8000000 RCC.APB1Freq_Value=8000000