Index: ctrl/firmware/Main/CubeMX/charger.ioc
===================================================================
--- ctrl/firmware/Main/CubeMX/charger.ioc	(revision 91)
+++ ctrl/firmware/Main/CubeMX/charger.ioc	(revision 92)
@@ -1,19 +1,53 @@
 #MicroXplorer Configuration settings - do not modify
-ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_10
-ADC1.ClockPrescaler=ADC_CLOCK_ASYNC_DIV256
-ADC1.ContinuousConvMode=ENABLE
-ADC1.EOCSelection=ADC_EOC_SEQ_CONV
-ADC1.IPParameters=Rank-0\#ChannelRegularConversion,master,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,OffsetSignedSaturation-0\#ChannelRegularConversion,NbrOfConversionFlag,ContinuousConvMode,EOCSelection,Overrun,OversamplingMode,RightBitShift,Ratio,NbrOfConversion,ClockPrescaler
-ADC1.NbrOfConversion=1
-ADC1.NbrOfConversionFlag=1
-ADC1.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
-ADC1.OffsetSignedSaturation-0\#ChannelRegularConversion=DISABLE
-ADC1.Overrun=ADC_OVR_DATA_OVERWRITTEN
-ADC1.OversamplingMode=ENABLE
-ADC1.Rank-0\#ChannelRegularConversion=1
-ADC1.Ratio=1024
-ADC1.RightBitShift=ADC_RIGHTBITSHIFT_11
-ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_810CYCLES_5
-ADC1.master=1
+ADC3.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_VBAT
+ADC3.Channel-1\#ChannelRegularConversion=ADC_CHANNEL_VREFINT
+ADC3.Channel-2\#ChannelRegularConversion=ADC_CHANNEL_TEMPSENSOR
+ADC3.Channel-3\#ChannelRegularConversion=ADC_CHANNEL_10
+ADC3.ClockPrescalerADC3=ADC_CLOCK_ASYNC_DIV256
+ADC3.ContinuousConvMode=ENABLE
+ADC3.DMAContinuousRequests=ENABLE
+ADC3.EOCSelection=ADC_EOC_SEQ_CONV
+ADC3.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,OffsetSign-0\#ChannelRegularConversion,NbrOfConversionFlag,ContinuousConvMode,DMAContinuousRequests,EOCSelection,Overrun,OversamplingMode,RightBitShift,ClockPrescalerADC3,Ratio,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,OffsetNumber-1\#ChannelRegularConversion,OffsetSign-1\#ChannelRegularConversion,Rank-2\#ChannelRegularConversion,Channel-2\#ChannelRegularConversion,SamplingTime-2\#ChannelRegularConversion,OffsetNumber-2\#ChannelRegularConversion,OffsetSign-2\#ChannelRegularConversion,Rank-3\#ChannelRegularConversion,Channel-3\#ChannelRegularConversion,SamplingTime-3\#ChannelRegularConversion,OffsetNumber-3\#ChannelRegularConversion,OffsetSign-3\#ChannelRegularConversion,NbrOfConversion
+ADC3.NbrOfConversion=4
+ADC3.NbrOfConversionFlag=1
+ADC3.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
+ADC3.OffsetNumber-1\#ChannelRegularConversion=ADC_OFFSET_NONE
+ADC3.OffsetNumber-2\#ChannelRegularConversion=ADC_OFFSET_NONE
+ADC3.OffsetNumber-3\#ChannelRegularConversion=ADC_OFFSET_NONE
+ADC3.OffsetSign-0\#ChannelRegularConversion=ADC3_OFFSET_SIGN_NEGATIVE
+ADC3.OffsetSign-1\#ChannelRegularConversion=ADC3_OFFSET_SIGN_NEGATIVE
+ADC3.OffsetSign-2\#ChannelRegularConversion=ADC3_OFFSET_SIGN_NEGATIVE
+ADC3.OffsetSign-3\#ChannelRegularConversion=ADC3_OFFSET_SIGN_NEGATIVE
+ADC3.Overrun=ADC_OVR_DATA_OVERWRITTEN
+ADC3.OversamplingMode=ENABLE
+ADC3.Rank-0\#ChannelRegularConversion=1
+ADC3.Rank-1\#ChannelRegularConversion=2
+ADC3.Rank-2\#ChannelRegularConversion=3
+ADC3.Rank-3\#ChannelRegularConversion=4
+ADC3.Ratio=ADC3_OVERSAMPLING_RATIO_256
+ADC3.RightBitShift=ADC_RIGHTBITSHIFT_11
+ADC3.SamplingTime-0\#ChannelRegularConversion=ADC3_SAMPLETIME_640CYCLES_5
+ADC3.SamplingTime-1\#ChannelRegularConversion=ADC3_SAMPLETIME_640CYCLES_5
+ADC3.SamplingTime-2\#ChannelRegularConversion=ADC3_SAMPLETIME_640CYCLES_5
+ADC3.SamplingTime-3\#ChannelRegularConversion=ADC3_SAMPLETIME_2CYCLES_5
+Bdma.ADC3.0.Direction=DMA_PERIPH_TO_MEMORY
+Bdma.ADC3.0.EventEnable=DISABLE
+Bdma.ADC3.0.Instance=BDMA_Channel0
+Bdma.ADC3.0.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
+Bdma.ADC3.0.MemInc=DMA_MINC_ENABLE
+Bdma.ADC3.0.Mode=DMA_CIRCULAR
+Bdma.ADC3.0.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
+Bdma.ADC3.0.PeriphInc=DMA_PINC_DISABLE
+Bdma.ADC3.0.Polarity=HAL_DMAMUX_REQ_GEN_RISING
+Bdma.ADC3.0.Priority=DMA_PRIORITY_LOW
+Bdma.ADC3.0.RequestNumber=1
+Bdma.ADC3.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
+Bdma.ADC3.0.SignalID=NONE
+Bdma.ADC3.0.SyncEnable=DISABLE
+Bdma.ADC3.0.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
+Bdma.ADC3.0.SyncRequestNumber=1
+Bdma.ADC3.0.SyncSignalID=NONE
+Bdma.Request0=ADC3
+Bdma.RequestsNb=1
 CAD.formats=[]
 CAD.pinconfig=Dual
@@ -26,25 +60,7 @@
 CORTEX_M7.Enable_S-Cortex_Memory_Protection_Unit_Region1_Settings_S=MPU_REGION_ENABLE
 CORTEX_M7.IPParameters=default_mode_Activation,CPU_ICache,CPU_DCache,Enable_S-Cortex_Memory_Protection_Unit_Region1_Settings_S,BaseAddress_S-Cortex_Memory_Protection_Unit_Region1_Settings_S,Size_S-Cortex_Memory_Protection_Unit_Region1_Settings_S,TypeExtField_S-Cortex_Memory_Protection_Unit_Region1_Settings_S,AccessPermission_S-Cortex_Memory_Protection_Unit_Region1_Settings_S,DisableExec_S-Cortex_Memory_Protection_Unit_Region1_Settings_S
-CORTEX_M7.Size_S-Cortex_Memory_Protection_Unit_Region1_Settings_S=MPU_REGION_SIZE_128KB
+CORTEX_M7.Size_S-Cortex_Memory_Protection_Unit_Region1_Settings_S=MPU_REGION_SIZE_8KB
 CORTEX_M7.TypeExtField_S-Cortex_Memory_Protection_Unit_Region1_Settings_S=MPU_TEX_LEVEL1
 CORTEX_M7.default_mode_Activation=1
-Dma.ADC1.5.Direction=DMA_PERIPH_TO_MEMORY
-Dma.ADC1.5.EventEnable=DISABLE
-Dma.ADC1.5.FIFOMode=DMA_FIFOMODE_DISABLE
-Dma.ADC1.5.Instance=DMA1_Stream5
-Dma.ADC1.5.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
-Dma.ADC1.5.MemInc=DMA_MINC_ENABLE
-Dma.ADC1.5.Mode=DMA_CIRCULAR
-Dma.ADC1.5.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
-Dma.ADC1.5.PeriphInc=DMA_PINC_DISABLE
-Dma.ADC1.5.Polarity=HAL_DMAMUX_REQ_GEN_RISING
-Dma.ADC1.5.Priority=DMA_PRIORITY_LOW
-Dma.ADC1.5.RequestNumber=1
-Dma.ADC1.5.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
-Dma.ADC1.5.SignalID=NONE
-Dma.ADC1.5.SyncEnable=DISABLE
-Dma.ADC1.5.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
-Dma.ADC1.5.SyncRequestNumber=1
-Dma.ADC1.5.SyncSignalID=NONE
 Dma.Request0=SPI4_TX
 Dma.Request1=USART3_RX
@@ -52,6 +68,5 @@
 Dma.Request3=SPI2_RX
 Dma.Request4=SPI2_TX
-Dma.Request5=ADC1
-Dma.RequestsNb=6
+Dma.RequestsNb=5
 Dma.SPI2_RX.3.Direction=DMA_PERIPH_TO_MEMORY
 Dma.SPI2_RX.3.EventEnable=DISABLE
@@ -247,28 +262,29 @@
 Mcu.CPN=STM32H723ZET6
 Mcu.Family=STM32H7
-Mcu.IP0=ADC1
-Mcu.IP1=CORTEX_M7
-Mcu.IP10=NVIC
-Mcu.IP11=RCC
-Mcu.IP12=RTC
-Mcu.IP13=SDMMC1
-Mcu.IP14=SPI2
-Mcu.IP15=SPI4
-Mcu.IP16=SYS
-Mcu.IP17=TIM3
-Mcu.IP18=TIM6
-Mcu.IP19=TIM8
-Mcu.IP2=DEBUG
-Mcu.IP20=USART2
-Mcu.IP21=USART3
-Mcu.IP22=USART10
-Mcu.IP3=DMA
-Mcu.IP4=FATFS
-Mcu.IP5=FREERTOS
-Mcu.IP6=I2C1
-Mcu.IP7=I2C2
-Mcu.IP8=MDMA
-Mcu.IP9=MEMORYMAP
-Mcu.IPNb=23
+Mcu.IP0=ADC3
+Mcu.IP1=BDMA
+Mcu.IP10=MEMORYMAP
+Mcu.IP11=NVIC
+Mcu.IP12=RCC
+Mcu.IP13=RTC
+Mcu.IP14=SDMMC1
+Mcu.IP15=SPI2
+Mcu.IP16=SPI4
+Mcu.IP17=SYS
+Mcu.IP18=TIM3
+Mcu.IP19=TIM6
+Mcu.IP2=CORTEX_M7
+Mcu.IP20=TIM8
+Mcu.IP21=USART2
+Mcu.IP22=USART3
+Mcu.IP23=USART10
+Mcu.IP3=DEBUG
+Mcu.IP4=DMA
+Mcu.IP5=FATFS
+Mcu.IP6=FREERTOS
+Mcu.IP7=I2C1
+Mcu.IP8=I2C2
+Mcu.IP9=MDMA
+Mcu.IPNb=24
 Mcu.Name=STM32H723ZETx
 Mcu.Package=LQFP144
@@ -326,20 +342,23 @@
 Mcu.Pin55=PB8
 Mcu.Pin56=PB9
-Mcu.Pin57=VP_FATFS_VS_SDIO
-Mcu.Pin58=VP_FREERTOS_VS_CMSIS_V2
-Mcu.Pin59=VP_RTC_VS_RTC_Activate
+Mcu.Pin57=VP_ADC3_TempSens_Input
+Mcu.Pin58=VP_ADC3_Vref_Input
+Mcu.Pin59=VP_ADC3_Vbat_Input
 Mcu.Pin6=PF1
-Mcu.Pin60=VP_RTC_VS_RTC_Calendar
-Mcu.Pin61=VP_SYS_VS_tim7
-Mcu.Pin62=VP_TIM3_VS_ClockSourceINT
-Mcu.Pin63=VP_TIM6_VS_ClockSourceINT
-Mcu.Pin64=VP_TIM8_VS_ControllerModeReset
-Mcu.Pin65=VP_TIM8_VS_ClockSourceINT
-Mcu.Pin66=VP_MEMORYMAP_VS_MEMORYMAP
-Mcu.Pin67=VP_STMicroelectronics.X-CUBE-EEPRMA1_VS_BoardOoPartJjEEPROM_5.1.0_5.1.0
+Mcu.Pin60=VP_FATFS_VS_SDIO
+Mcu.Pin61=VP_FREERTOS_VS_CMSIS_V2
+Mcu.Pin62=VP_RTC_VS_RTC_Activate
+Mcu.Pin63=VP_RTC_VS_RTC_Calendar
+Mcu.Pin64=VP_SYS_VS_tim7
+Mcu.Pin65=VP_TIM3_VS_ClockSourceINT
+Mcu.Pin66=VP_TIM6_VS_ClockSourceINT
+Mcu.Pin67=VP_TIM8_VS_ControllerModeReset
+Mcu.Pin68=VP_TIM8_VS_ClockSourceINT
+Mcu.Pin69=VP_MEMORYMAP_VS_MEMORYMAP
 Mcu.Pin7=PH0-OSC_IN
+Mcu.Pin70=VP_STMicroelectronics.X-CUBE-EEPRMA1_VS_BoardOoPartJjEEPROM_5.1.0_5.1.0
 Mcu.Pin8=PH1-OSC_OUT
 Mcu.Pin9=PC0
-Mcu.PinsNb=68
+Mcu.PinsNb=71
 Mcu.ThirdParty0=STMicroelectronics.X-CUBE-AZRTOS-H7.3.3.0
 Mcu.ThirdParty1=STMicroelectronics.X-CUBE-EEPRMA1.5.1.0
@@ -376,4 +395,5 @@
 MxCube.Version=6.13.0
 MxDb.Version=DB.6.0.130
+NVIC.BDMA_Channel0_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
 NVIC.DMA1_Stream0_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
@@ -382,5 +402,4 @@
 NVIC.DMA1_Stream3_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
 NVIC.DMA1_Stream4_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
-NVIC.DMA1_Stream5_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.EXTI9_5_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
@@ -464,4 +483,6 @@
 PB9.Locked=true
 PB9.Signal=GPIO_Output
+PC0.GPIOParameters=GPIO_Label
+PC0.GPIO_Label=U_BAT
 PC0.Locked=true
 PC0.Signal=ADCx_INP10
@@ -659,5 +680,5 @@
 ProjectManager.UAScriptBeforePath=
 ProjectManager.UnderRoot=true
-ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-MX_MDMA_Init-MDMA-false-HAL-true,4-MX_RTC_Init-RTC-false-HAL-true,5-MX_SPI4_Init-SPI4-false-HAL-true,6-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true,7-MX_USART3_UART_Init-USART3-false-HAL-true,8-MX_TIM3_Init-TIM3-false-HAL-true,9-SystemClock_Config-RCC-false-HAL-false,10-MX_FATFS_Init-FATFS-false-HAL-false,11-MX_TIM8_Init-TIM8-false-HAL-true,12-MX_SPI2_Init-SPI2-false-HAL-true,13-MX_USART2_UART_Init-USART2-false-HAL-true,14-MX_USART10_UART_Init-USART10-false-HAL-true,15-MX_TIM6_Init-TIM6-false-HAL-true,16-MX_I2C1_Init-I2C1-false-HAL-true,17-MX_I2C2_Init-I2C2-false-HAL-true,18-MX_ADC1_Init-ADC1-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
+ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-MX_MDMA_Init-MDMA-false-HAL-true,4-MX_BDMA_Init-BDMA-false-HAL-true,5-MX_RTC_Init-RTC-false-HAL-true,6-MX_SPI4_Init-SPI4-false-HAL-true,7-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true,8-MX_USART3_UART_Init-USART3-false-HAL-true,9-SystemClock_Config-RCC-false-HAL-false,10-MX_FATFS_Init-FATFS-false-HAL-false,11-MX_TIM8_Init-TIM8-false-HAL-true,12-MX_SPI2_Init-SPI2-false-HAL-true,13-MX_USART2_UART_Init-USART2-false-HAL-true,14-MX_USART10_UART_Init-USART10-false-HAL-true,15-MX_TIM6_Init-TIM6-false-HAL-true,16-MX_I2C2_Init-I2C2-false-HAL-true,17-MX_ADC3_Init-ADC3-false-HAL-true,18-MX_I2C1_Init-I2C1-false-HAL-true,19-MX_TIM3_Init-TIM3-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
 RCC.ADCCLockSelection=RCC_ADCCLKSOURCE_PLL3
 RCC.ADCFreq_Value=60000000
@@ -754,5 +775,5 @@
 SDMMC1.HardwareFlowControl=SDMMC_HARDWARE_FLOW_CONTROL_ENABLE
 SDMMC1.IPParameters=ClockPowerSave,HardwareFlowControl,ClockDiv
-SH.ADCx_INP10.0=ADC1_INP10,IN10-Single-Ended
+SH.ADCx_INP10.0=ADC3_INP10,IN10-Single-Ended
 SH.ADCx_INP10.ConfNb=1
 SH.GPXTI8.0=GPIO_EXTI8
@@ -834,4 +855,10 @@
 USART3.SwapParam=ADVFEATURE_SWAP_ENABLE
 USART3.VirtualMode-Asynchronous=VM_ASYNC
+VP_ADC3_TempSens_Input.Mode=IN-TempSens
+VP_ADC3_TempSens_Input.Signal=ADC3_TempSens_Input
+VP_ADC3_Vbat_Input.Mode=IN-Vbat
+VP_ADC3_Vbat_Input.Signal=ADC3_Vbat_Input
+VP_ADC3_Vref_Input.Mode=IN-Vrefint
+VP_ADC3_Vref_Input.Signal=ADC3_Vref_Input
 VP_FATFS_VS_SDIO.Mode=SDIO
 VP_FATFS_VS_SDIO.Signal=FATFS_VS_SDIO
