Implemented "full" ignition timing system

This is a first implementation of a "full" timing system, with proper
handling for cases wher the ignition charge time overlaps with the
compression pulse, the spark has a more complex state machine system
with the option to defer charge from the intake pulse to the compression
pulse, and further defferal of the spark release schedule to the ISR
that triggers when the output compare triggers for the charge

Preliminary error counters have been put in place, they still require
handling error conditions that would force a soft shutdown on the
ignition IC. Alongside this the code still needs to be verified so that
all non critical errors (ie missed charge schedules) reset the state
machine and increment a global spark miss counter to avoid having these
errors breaking the state machine as they can easily be recovered from

Cases where the coil would already be charging and an error occurs
require as stated above a full recovery procedure with soft shutdown of
the ignition IC and a clean cycle of the state machine to ensure a full
recovery
This commit is contained in:
h3cx committed 2026-09-26 22:11:51 +02:00
1 parent 0ea7b83bea
commit 7502b354dc
15 files changed
+444 -195

No files matched your search

+10 -7
View File
@@ -5,7 +5,7 @@ CAD.provider=
CORTEX_M7.IPParameters=default_mode_Activation
CORTEX_M7.default_mode_Activation=1
CortexM4.IPs=CORTEX_M4\:I,FATFS_M4\:I,FREERTOS_M4\:I,IWDG2\:I,OPENAMP_M4\:I,PDM2PCM_M4\:I,PWR,RCC,RESMGR_UTILITY,SYS_M4\:I,USB_DEVICE_M4\:I,USB_HOST_M4\:I,VREFBUF,WWDG2\:I,GPIO,DMA,BDMA,MDMA,NVIC2\:I
CortexM7.IPs=CORTEX_M7\:I,FATFS_M7\:I,FREERTOS_M7\:I,IWDG1\:I,OPENAMP_M7\:I,PDM2PCM_M7\:I,PWR\:I,RCC\:I,RESMGR_UTILITY\:I,SYS\:I,USB_DEVICE_M7\:I,USB_HOST_M7\:I,VREFBUF\:I,WWDG1\:I,GPIO\:I,DMA\:I,BDMA\:I,MDMA\:I,NVIC1\:I,DEBUG\:I,TIM2\:I
CortexM7.IPs=CORTEX_M7\:I,FATFS_M7\:I,FREERTOS_M7\:I,IWDG1\:I,OPENAMP_M7\:I,PDM2PCM_M7\:I,PWR\:I,RCC\:I,RESMGR_UTILITY\:I,SYS\:I,USB_DEVICE_M7\:I,USB_HOST_M7\:I,VREFBUF\:I,WWDG1\:I,GPIO\:I,DMA\:I,BDMA\:I,MDMA\:I,NVIC1\:I,DEBUG\:I,TIM2\:I,TIM6\:I
CortexM7.Pins=PI12
FREERTOS_M7.FootprintOK=true
FREERTOS_M7.IPParameters=Tasks01,configENABLE_FPU,FootprintOK
@@ -34,7 +34,7 @@ Mcu.Package=TFBGA240
Mcu.Pin0=PA14 (JTCK/SWCLK)
Mcu.Pin1=PC15-OSC32_OUT (OSC32_OUT)
Mcu.Pin10=VP_FREERTOS_M7_VS_CMSIS_V2
Mcu.Pin11=VP_SYS_VS_Systick
Mcu.Pin11=VP_SYS_VS_tim6
Mcu.Pin12=VP_SYS_M4_VS_Systick
Mcu.Pin13=VP_TIM2_VS_ClockSourceINT
Mcu.Pin2=PC14-OSC32_IN (OSC32_IN)
@@ -63,8 +63,11 @@ NVIC1.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false\:false
NVIC1.SavedPendsvIrqHandlerGenerated=true
NVIC1.SavedSvcallIrqHandlerGenerated=true
NVIC1.SavedSystickIrqHandlerGenerated=true
NVIC1.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true\:false\:true\:false
NVIC1.SysTick_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:true\:false
NVIC1.TIM2_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
NVIC1.TIM6_DAC_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true
NVIC1.TimeBase=TIM6_DAC_IRQn
NVIC1.TimeBaseIP=TIM6
NVIC1.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
NVIC2.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC2.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
@@ -257,19 +260,19 @@ SYS.userName=SYS_M7
TIM2.Channel-Input_Capture1_from_TI1=TIM_CHANNEL_1
TIM2.Channel-Input_Capture2_from_TI2=TIM_CHANNEL_2
TIM2.Channel-Output\ Compare3\ CH3=TIM_CHANNEL_3
TIM2.ClockDivision=TIM_CLOCKDIVISION_DIV4
TIM2.ClockDivision=TIM_CLOCKDIVISION_DIV1
TIM2.ICFilter_CH1=10
TIM2.ICFilter_CH2=10
TIM2.ICPolarity_CH1=TIM_INPUTCHANNELPOLARITY_FALLING
TIM2.IPParameters=ClockDivision,Prescaler,Channel-Input_Capture1_from_TI1,ICPolarity_CH1,Channel-Input_Capture2_from_TI2,ICFilter_CH2,ICFilter_CH1,Channel-Output Compare3 CH3,OCMode_3
TIM2.OCMode_3=TIM_OCMODE_TOGGLE
TIM2.Prescaler=0
TIM2.Prescaler=99
VP_FREERTOS_M7_VS_CMSIS_V2.Mode=CMSIS_V2
VP_FREERTOS_M7_VS_CMSIS_V2.Signal=FREERTOS_M7_VS_CMSIS_V2
VP_SYS_M4_VS_Systick.Mode=SysTick
VP_SYS_M4_VS_Systick.Signal=SYS_M4_VS_Systick
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
VP_SYS_VS_tim6.Mode=TIM6
VP_SYS_VS_tim6.Signal=SYS_VS_tim6
VP_TIM2_VS_ClockSourceINT.Mode=Internal
VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT
board=custom