├── .gitignore
├── .project
├── LICENSE
├── MPPT_ID32+0-4.dbc
├── Measurements
├── eff 50V.png
├── eff 64V.png
├── eff 72V.png
├── power loss 50V.png
├── power loss 64V.png
└── power loss 72V.png
├── Open-SEC Bootloader
├── .cproject
├── .project
├── .settings
│ └── language.settings.xml
├── Drivers
│ ├── CMSIS
│ │ ├── Device
│ │ │ └── ST
│ │ │ │ └── STM32G4xx
│ │ │ │ └── Include
│ │ │ │ ├── stm32g474xx.h
│ │ │ │ ├── stm32g4xx.h
│ │ │ │ └── system_stm32g4xx.h
│ │ └── Include
│ │ │ ├── cmsis_armcc.h
│ │ │ ├── cmsis_armclang.h
│ │ │ ├── cmsis_armclang_ltm.h
│ │ │ ├── cmsis_compiler.h
│ │ │ ├── cmsis_gcc.h
│ │ │ ├── cmsis_iccarm.h
│ │ │ ├── cmsis_version.h
│ │ │ ├── core_armv81mml.h
│ │ │ ├── core_armv8mbl.h
│ │ │ ├── core_armv8mml.h
│ │ │ ├── core_cm0.h
│ │ │ ├── core_cm0plus.h
│ │ │ ├── core_cm1.h
│ │ │ ├── core_cm23.h
│ │ │ ├── core_cm3.h
│ │ │ ├── core_cm33.h
│ │ │ ├── core_cm35p.h
│ │ │ ├── core_cm4.h
│ │ │ ├── core_cm7.h
│ │ │ ├── core_sc000.h
│ │ │ ├── core_sc300.h
│ │ │ ├── mpu_armv7.h
│ │ │ ├── mpu_armv8.h
│ │ │ └── tz_context.h
│ └── STM32G4xx_HAL_Driver
│ │ ├── Inc
│ │ ├── Legacy
│ │ │ └── stm32_hal_legacy.h
│ │ ├── stm32_assert_template.h
│ │ ├── stm32g4xx_hal.h
│ │ ├── stm32g4xx_hal_adc.h
│ │ ├── stm32g4xx_hal_adc_ex.h
│ │ ├── stm32g4xx_hal_comp.h
│ │ ├── stm32g4xx_hal_conf_template.h
│ │ ├── stm32g4xx_hal_cordic.h
│ │ ├── stm32g4xx_hal_cortex.h
│ │ ├── stm32g4xx_hal_crc.h
│ │ ├── stm32g4xx_hal_crc_ex.h
│ │ ├── stm32g4xx_hal_cryp.h
│ │ ├── stm32g4xx_hal_cryp_ex.h
│ │ ├── stm32g4xx_hal_dac.h
│ │ ├── stm32g4xx_hal_dac_ex.h
│ │ ├── stm32g4xx_hal_def.h
│ │ ├── stm32g4xx_hal_dma.h
│ │ ├── stm32g4xx_hal_dma_ex.h
│ │ ├── stm32g4xx_hal_exti.h
│ │ ├── stm32g4xx_hal_fdcan.h
│ │ ├── stm32g4xx_hal_flash.h
│ │ ├── stm32g4xx_hal_flash_ex.h
│ │ ├── stm32g4xx_hal_flash_ramfunc.h
│ │ ├── stm32g4xx_hal_fmac.h
│ │ ├── stm32g4xx_hal_gpio.h
│ │ ├── stm32g4xx_hal_gpio_ex.h
│ │ ├── stm32g4xx_hal_hrtim.h
│ │ ├── stm32g4xx_hal_i2c.h
│ │ ├── stm32g4xx_hal_i2c_ex.h
│ │ ├── stm32g4xx_hal_i2s.h
│ │ ├── stm32g4xx_hal_irda.h
│ │ ├── stm32g4xx_hal_irda_ex.h
│ │ ├── stm32g4xx_hal_iwdg.h
│ │ ├── stm32g4xx_hal_lptim.h
│ │ ├── stm32g4xx_hal_nand.h
│ │ ├── stm32g4xx_hal_nor.h
│ │ ├── stm32g4xx_hal_opamp.h
│ │ ├── stm32g4xx_hal_opamp_ex.h
│ │ ├── stm32g4xx_hal_pcd.h
│ │ ├── stm32g4xx_hal_pcd_ex.h
│ │ ├── stm32g4xx_hal_pwr.h
│ │ ├── stm32g4xx_hal_pwr_ex.h
│ │ ├── stm32g4xx_hal_qspi.h
│ │ ├── stm32g4xx_hal_rcc.h
│ │ ├── stm32g4xx_hal_rcc_ex.h
│ │ ├── stm32g4xx_hal_rng.h
│ │ ├── stm32g4xx_hal_rtc.h
│ │ ├── stm32g4xx_hal_rtc_ex.h
│ │ ├── stm32g4xx_hal_sai.h
│ │ ├── stm32g4xx_hal_sai_ex.h
│ │ ├── stm32g4xx_hal_smartcard.h
│ │ ├── stm32g4xx_hal_smartcard_ex.h
│ │ ├── stm32g4xx_hal_smbus.h
│ │ ├── stm32g4xx_hal_smbus_ex.h
│ │ ├── stm32g4xx_hal_spi.h
│ │ ├── stm32g4xx_hal_spi_ex.h
│ │ ├── stm32g4xx_hal_sram.h
│ │ ├── stm32g4xx_hal_tim.h
│ │ ├── stm32g4xx_hal_tim_ex.h
│ │ ├── stm32g4xx_hal_uart.h
│ │ ├── stm32g4xx_hal_uart_ex.h
│ │ ├── stm32g4xx_hal_usart.h
│ │ ├── stm32g4xx_hal_usart_ex.h
│ │ ├── stm32g4xx_hal_wwdg.h
│ │ ├── stm32g4xx_ll_adc.h
│ │ ├── stm32g4xx_ll_bus.h
│ │ ├── stm32g4xx_ll_comp.h
│ │ ├── stm32g4xx_ll_cordic.h
│ │ ├── stm32g4xx_ll_cortex.h
│ │ ├── stm32g4xx_ll_crc.h
│ │ ├── stm32g4xx_ll_crs.h
│ │ ├── stm32g4xx_ll_dac.h
│ │ ├── stm32g4xx_ll_dma.h
│ │ ├── stm32g4xx_ll_dmamux.h
│ │ ├── stm32g4xx_ll_exti.h
│ │ ├── stm32g4xx_ll_fmac.h
│ │ ├── stm32g4xx_ll_fmc.h
│ │ ├── stm32g4xx_ll_gpio.h
│ │ ├── stm32g4xx_ll_hrtim.h
│ │ ├── stm32g4xx_ll_i2c.h
│ │ ├── stm32g4xx_ll_iwdg.h
│ │ ├── stm32g4xx_ll_lptim.h
│ │ ├── stm32g4xx_ll_lpuart.h
│ │ ├── stm32g4xx_ll_opamp.h
│ │ ├── stm32g4xx_ll_pwr.h
│ │ ├── stm32g4xx_ll_rcc.h
│ │ ├── stm32g4xx_ll_rng.h
│ │ ├── stm32g4xx_ll_rtc.h
│ │ ├── stm32g4xx_ll_spi.h
│ │ ├── stm32g4xx_ll_system.h
│ │ ├── stm32g4xx_ll_tim.h
│ │ ├── stm32g4xx_ll_ucpd.h
│ │ ├── stm32g4xx_ll_usart.h
│ │ ├── stm32g4xx_ll_usb.h
│ │ ├── stm32g4xx_ll_utils.h
│ │ └── stm32g4xx_ll_wwdg.h
│ │ ├── License.md
│ │ └── Src
│ │ ├── stm32g4xx_hal.c
│ │ ├── stm32g4xx_hal_adc.c
│ │ ├── stm32g4xx_hal_adc_ex.c
│ │ ├── stm32g4xx_hal_comp.c
│ │ ├── stm32g4xx_hal_cordic.c
│ │ ├── stm32g4xx_hal_cortex.c
│ │ ├── stm32g4xx_hal_crc.c
│ │ ├── stm32g4xx_hal_crc_ex.c
│ │ ├── stm32g4xx_hal_cryp.c
│ │ ├── stm32g4xx_hal_cryp_ex.c
│ │ ├── stm32g4xx_hal_dac.c
│ │ ├── stm32g4xx_hal_dac_ex.c
│ │ ├── stm32g4xx_hal_dma.c
│ │ ├── stm32g4xx_hal_dma_ex.c
│ │ ├── stm32g4xx_hal_exti.c
│ │ ├── stm32g4xx_hal_fdcan.c
│ │ ├── stm32g4xx_hal_flash.c
│ │ ├── stm32g4xx_hal_flash_ex.c
│ │ ├── stm32g4xx_hal_flash_ramfunc.c
│ │ ├── stm32g4xx_hal_fmac.c
│ │ ├── stm32g4xx_hal_gpio.c
│ │ ├── stm32g4xx_hal_hrtim.c
│ │ ├── stm32g4xx_hal_i2c.c
│ │ ├── stm32g4xx_hal_i2c_ex.c
│ │ ├── stm32g4xx_hal_i2s.c
│ │ ├── stm32g4xx_hal_irda.c
│ │ ├── stm32g4xx_hal_iwdg.c
│ │ ├── stm32g4xx_hal_lptim.c
│ │ ├── stm32g4xx_hal_nand.c
│ │ ├── stm32g4xx_hal_nor.c
│ │ ├── stm32g4xx_hal_opamp.c
│ │ ├── stm32g4xx_hal_opamp_ex.c
│ │ ├── stm32g4xx_hal_pcd.c
│ │ ├── stm32g4xx_hal_pcd_ex.c
│ │ ├── stm32g4xx_hal_pwr.c
│ │ ├── stm32g4xx_hal_pwr_ex.c
│ │ ├── stm32g4xx_hal_qspi.c
│ │ ├── stm32g4xx_hal_rcc.c
│ │ ├── stm32g4xx_hal_rcc_ex.c
│ │ ├── stm32g4xx_hal_rng.c
│ │ ├── stm32g4xx_hal_rtc.c
│ │ ├── stm32g4xx_hal_rtc_ex.c
│ │ ├── stm32g4xx_hal_sai.c
│ │ ├── stm32g4xx_hal_sai_ex.c
│ │ ├── stm32g4xx_hal_smartcard.c
│ │ ├── stm32g4xx_hal_smartcard_ex.c
│ │ ├── stm32g4xx_hal_smbus.c
│ │ ├── stm32g4xx_hal_smbus_ex.c
│ │ ├── stm32g4xx_hal_spi.c
│ │ ├── stm32g4xx_hal_spi_ex.c
│ │ ├── stm32g4xx_hal_sram.c
│ │ ├── stm32g4xx_hal_tim.c
│ │ ├── stm32g4xx_hal_tim_ex.c
│ │ ├── stm32g4xx_hal_uart.c
│ │ ├── stm32g4xx_hal_uart_ex.c
│ │ ├── stm32g4xx_hal_usart.c
│ │ ├── stm32g4xx_hal_usart_ex.c
│ │ ├── stm32g4xx_hal_wwdg.c
│ │ ├── stm32g4xx_ll_adc.c
│ │ ├── stm32g4xx_ll_comp.c
│ │ ├── stm32g4xx_ll_cordic.c
│ │ ├── stm32g4xx_ll_crc.c
│ │ ├── stm32g4xx_ll_crs.c
│ │ ├── stm32g4xx_ll_dac.c
│ │ ├── stm32g4xx_ll_dma.c
│ │ ├── stm32g4xx_ll_exti.c
│ │ ├── stm32g4xx_ll_fmac.c
│ │ ├── stm32g4xx_ll_fmc.c
│ │ ├── stm32g4xx_ll_gpio.c
│ │ ├── stm32g4xx_ll_hrtim.c
│ │ ├── stm32g4xx_ll_i2c.c
│ │ ├── stm32g4xx_ll_lptim.c
│ │ ├── stm32g4xx_ll_lpuart.c
│ │ ├── stm32g4xx_ll_opamp.c
│ │ ├── stm32g4xx_ll_pwr.c
│ │ ├── stm32g4xx_ll_rcc.c
│ │ ├── stm32g4xx_ll_rng.c
│ │ ├── stm32g4xx_ll_rtc.c
│ │ ├── stm32g4xx_ll_spi.c
│ │ ├── stm32g4xx_ll_tim.c
│ │ ├── stm32g4xx_ll_ucpd.c
│ │ ├── stm32g4xx_ll_usart.c
│ │ ├── stm32g4xx_ll_usb.c
│ │ └── stm32g4xx_ll_utils.c
├── STM32G474CEUX_FLASH.ld
└── src
│ ├── buffer.c
│ ├── buffer.c.bak
│ ├── buffer.h
│ ├── buffer.h.bak
│ ├── crc.c
│ ├── crc.c.bak
│ ├── crc.h
│ ├── crc.h.bak
│ ├── delay.c
│ ├── delay.c.bak
│ ├── delay.h
│ ├── delay.h.bak
│ ├── flash.c
│ ├── flash.c.bak
│ ├── flash.h
│ ├── flash.h.bak
│ ├── main.c
│ ├── main.c.bak
│ ├── startup_stm32g474ceux.s
│ ├── stm32g4xx_hal_conf.h
│ └── system_stm32g4xx.c
├── Open-SEC Firmware
├── .cproject
├── .project
├── .settings
│ ├── com.st.stm32cube.ide.mcu.sfrview.prefs
│ ├── language.settings.xml
│ ├── org.eclipse.cdt.core.prefs
│ ├── org.eclipse.ltk.core.refactoring.prefs
│ └── stm32cubeide.project.prefs
├── Drivers
│ ├── CMSIS
│ │ ├── Device
│ │ │ └── ST
│ │ │ │ └── STM32G4xx
│ │ │ │ └── Include
│ │ │ │ ├── stm32g474xx.h
│ │ │ │ ├── stm32g4xx.h
│ │ │ │ └── system_stm32g4xx.h
│ │ └── Include
│ │ │ ├── cmsis_armcc.h
│ │ │ ├── cmsis_armclang.h
│ │ │ ├── cmsis_armclang_ltm.h
│ │ │ ├── cmsis_compiler.h
│ │ │ ├── cmsis_gcc.h
│ │ │ ├── cmsis_iccarm.h
│ │ │ ├── cmsis_version.h
│ │ │ ├── core_armv81mml.h
│ │ │ ├── core_armv8mbl.h
│ │ │ ├── core_armv8mml.h
│ │ │ ├── core_cm0.h
│ │ │ ├── core_cm0plus.h
│ │ │ ├── core_cm1.h
│ │ │ ├── core_cm23.h
│ │ │ ├── core_cm3.h
│ │ │ ├── core_cm33.h
│ │ │ ├── core_cm35p.h
│ │ │ ├── core_cm4.h
│ │ │ ├── core_cm7.h
│ │ │ ├── core_sc000.h
│ │ │ ├── core_sc300.h
│ │ │ ├── mpu_armv7.h
│ │ │ ├── mpu_armv8.h
│ │ │ └── tz_context.h
│ └── STM32G4xx_HAL_Driver
│ │ ├── Inc
│ │ ├── Legacy
│ │ │ └── stm32_hal_legacy.h
│ │ ├── stm32_assert_template.h
│ │ ├── stm32g4xx_hal.h
│ │ ├── stm32g4xx_hal_adc.h
│ │ ├── stm32g4xx_hal_adc_ex.h
│ │ ├── stm32g4xx_hal_comp.h
│ │ ├── stm32g4xx_hal_conf_template.h
│ │ ├── stm32g4xx_hal_cordic.h
│ │ ├── stm32g4xx_hal_cortex.h
│ │ ├── stm32g4xx_hal_crc.h
│ │ ├── stm32g4xx_hal_crc_ex.h
│ │ ├── stm32g4xx_hal_cryp.h
│ │ ├── stm32g4xx_hal_cryp_ex.h
│ │ ├── stm32g4xx_hal_dac.h
│ │ ├── stm32g4xx_hal_dac_ex.h
│ │ ├── stm32g4xx_hal_def.h
│ │ ├── stm32g4xx_hal_dma.h
│ │ ├── stm32g4xx_hal_dma_ex.h
│ │ ├── stm32g4xx_hal_exti.h
│ │ ├── stm32g4xx_hal_fdcan.h
│ │ ├── stm32g4xx_hal_flash.h
│ │ ├── stm32g4xx_hal_flash_ex.h
│ │ ├── stm32g4xx_hal_flash_ramfunc.h
│ │ ├── stm32g4xx_hal_fmac.h
│ │ ├── stm32g4xx_hal_gpio.h
│ │ ├── stm32g4xx_hal_gpio_ex.h
│ │ ├── stm32g4xx_hal_hrtim.h
│ │ ├── stm32g4xx_hal_i2c.h
│ │ ├── stm32g4xx_hal_i2c_ex.h
│ │ ├── stm32g4xx_hal_i2s.h
│ │ ├── stm32g4xx_hal_irda.h
│ │ ├── stm32g4xx_hal_irda_ex.h
│ │ ├── stm32g4xx_hal_iwdg.h
│ │ ├── stm32g4xx_hal_lptim.h
│ │ ├── stm32g4xx_hal_nand.h
│ │ ├── stm32g4xx_hal_nor.h
│ │ ├── stm32g4xx_hal_opamp.h
│ │ ├── stm32g4xx_hal_opamp_ex.h
│ │ ├── stm32g4xx_hal_pcd.h
│ │ ├── stm32g4xx_hal_pcd_ex.h
│ │ ├── stm32g4xx_hal_pwr.h
│ │ ├── stm32g4xx_hal_pwr_ex.h
│ │ ├── stm32g4xx_hal_qspi.h
│ │ ├── stm32g4xx_hal_rcc.h
│ │ ├── stm32g4xx_hal_rcc_ex.h
│ │ ├── stm32g4xx_hal_rng.h
│ │ ├── stm32g4xx_hal_rtc.h
│ │ ├── stm32g4xx_hal_rtc_ex.h
│ │ ├── stm32g4xx_hal_sai.h
│ │ ├── stm32g4xx_hal_sai_ex.h
│ │ ├── stm32g4xx_hal_smartcard.h
│ │ ├── stm32g4xx_hal_smartcard_ex.h
│ │ ├── stm32g4xx_hal_smbus.h
│ │ ├── stm32g4xx_hal_smbus_ex.h
│ │ ├── stm32g4xx_hal_spi.h
│ │ ├── stm32g4xx_hal_spi_ex.h
│ │ ├── stm32g4xx_hal_sram.h
│ │ ├── stm32g4xx_hal_tim.h
│ │ ├── stm32g4xx_hal_tim_ex.h
│ │ ├── stm32g4xx_hal_uart.h
│ │ ├── stm32g4xx_hal_uart_ex.h
│ │ ├── stm32g4xx_hal_usart.h
│ │ ├── stm32g4xx_hal_usart_ex.h
│ │ ├── stm32g4xx_hal_wwdg.h
│ │ ├── stm32g4xx_ll_adc.h
│ │ ├── stm32g4xx_ll_bus.h
│ │ ├── stm32g4xx_ll_comp.h
│ │ ├── stm32g4xx_ll_cordic.h
│ │ ├── stm32g4xx_ll_cortex.h
│ │ ├── stm32g4xx_ll_crc.h
│ │ ├── stm32g4xx_ll_crs.h
│ │ ├── stm32g4xx_ll_dac.h
│ │ ├── stm32g4xx_ll_dma.h
│ │ ├── stm32g4xx_ll_dmamux.h
│ │ ├── stm32g4xx_ll_exti.h
│ │ ├── stm32g4xx_ll_fmac.h
│ │ ├── stm32g4xx_ll_fmc.h
│ │ ├── stm32g4xx_ll_gpio.h
│ │ ├── stm32g4xx_ll_hrtim.h
│ │ ├── stm32g4xx_ll_i2c.h
│ │ ├── stm32g4xx_ll_iwdg.h
│ │ ├── stm32g4xx_ll_lptim.h
│ │ ├── stm32g4xx_ll_lpuart.h
│ │ ├── stm32g4xx_ll_opamp.h
│ │ ├── stm32g4xx_ll_pwr.h
│ │ ├── stm32g4xx_ll_rcc.h
│ │ ├── stm32g4xx_ll_rng.h
│ │ ├── stm32g4xx_ll_rtc.h
│ │ ├── stm32g4xx_ll_spi.h
│ │ ├── stm32g4xx_ll_system.h
│ │ ├── stm32g4xx_ll_tim.h
│ │ ├── stm32g4xx_ll_ucpd.h
│ │ ├── stm32g4xx_ll_usart.h
│ │ ├── stm32g4xx_ll_usb.h
│ │ ├── stm32g4xx_ll_utils.h
│ │ └── stm32g4xx_ll_wwdg.h
│ │ ├── License.md
│ │ └── Src
│ │ ├── stm32g4xx_hal.c
│ │ ├── stm32g4xx_hal_adc.c
│ │ ├── stm32g4xx_hal_adc_ex.c
│ │ ├── stm32g4xx_hal_comp.c
│ │ ├── stm32g4xx_hal_cordic.c
│ │ ├── stm32g4xx_hal_cortex.c
│ │ ├── stm32g4xx_hal_crc.c
│ │ ├── stm32g4xx_hal_crc_ex.c
│ │ ├── stm32g4xx_hal_cryp.c
│ │ ├── stm32g4xx_hal_cryp_ex.c
│ │ ├── stm32g4xx_hal_dac.c
│ │ ├── stm32g4xx_hal_dac_ex.c
│ │ ├── stm32g4xx_hal_dma.c
│ │ ├── stm32g4xx_hal_dma_ex.c
│ │ ├── stm32g4xx_hal_exti.c
│ │ ├── stm32g4xx_hal_fdcan.c
│ │ ├── stm32g4xx_hal_flash.c
│ │ ├── stm32g4xx_hal_flash_ex.c
│ │ ├── stm32g4xx_hal_flash_ramfunc.c
│ │ ├── stm32g4xx_hal_fmac.c
│ │ ├── stm32g4xx_hal_gpio.c
│ │ ├── stm32g4xx_hal_hrtim.c
│ │ ├── stm32g4xx_hal_i2c.c
│ │ ├── stm32g4xx_hal_i2c_ex.c
│ │ ├── stm32g4xx_hal_i2s.c
│ │ ├── stm32g4xx_hal_irda.c
│ │ ├── stm32g4xx_hal_iwdg.c
│ │ ├── stm32g4xx_hal_lptim.c
│ │ ├── stm32g4xx_hal_nand.c
│ │ ├── stm32g4xx_hal_nor.c
│ │ ├── stm32g4xx_hal_opamp.c
│ │ ├── stm32g4xx_hal_opamp_ex.c
│ │ ├── stm32g4xx_hal_pcd.c
│ │ ├── stm32g4xx_hal_pcd_ex.c
│ │ ├── stm32g4xx_hal_pwr.c
│ │ ├── stm32g4xx_hal_pwr_ex.c
│ │ ├── stm32g4xx_hal_qspi.c
│ │ ├── stm32g4xx_hal_rcc.c
│ │ ├── stm32g4xx_hal_rcc_ex.c
│ │ ├── stm32g4xx_hal_rng.c
│ │ ├── stm32g4xx_hal_rtc.c
│ │ ├── stm32g4xx_hal_rtc_ex.c
│ │ ├── stm32g4xx_hal_sai.c
│ │ ├── stm32g4xx_hal_sai_ex.c
│ │ ├── stm32g4xx_hal_smartcard.c
│ │ ├── stm32g4xx_hal_smartcard_ex.c
│ │ ├── stm32g4xx_hal_smbus.c
│ │ ├── stm32g4xx_hal_smbus_ex.c
│ │ ├── stm32g4xx_hal_spi.c
│ │ ├── stm32g4xx_hal_spi_ex.c
│ │ ├── stm32g4xx_hal_sram.c
│ │ ├── stm32g4xx_hal_tim.c
│ │ ├── stm32g4xx_hal_tim_ex.c
│ │ ├── stm32g4xx_hal_uart.c
│ │ ├── stm32g4xx_hal_uart_ex.c
│ │ ├── stm32g4xx_hal_usart.c
│ │ ├── stm32g4xx_hal_usart_ex.c
│ │ ├── stm32g4xx_hal_wwdg.c
│ │ ├── stm32g4xx_ll_adc.c
│ │ ├── stm32g4xx_ll_comp.c
│ │ ├── stm32g4xx_ll_cordic.c
│ │ ├── stm32g4xx_ll_crc.c
│ │ ├── stm32g4xx_ll_crs.c
│ │ ├── stm32g4xx_ll_dac.c
│ │ ├── stm32g4xx_ll_dma.c
│ │ ├── stm32g4xx_ll_exti.c
│ │ ├── stm32g4xx_ll_fmac.c
│ │ ├── stm32g4xx_ll_fmc.c
│ │ ├── stm32g4xx_ll_gpio.c
│ │ ├── stm32g4xx_ll_hrtim.c
│ │ ├── stm32g4xx_ll_i2c.c
│ │ ├── stm32g4xx_ll_lptim.c
│ │ ├── stm32g4xx_ll_lpuart.c
│ │ ├── stm32g4xx_ll_opamp.c
│ │ ├── stm32g4xx_ll_pwr.c
│ │ ├── stm32g4xx_ll_rcc.c
│ │ ├── stm32g4xx_ll_rng.c
│ │ ├── stm32g4xx_ll_rtc.c
│ │ ├── stm32g4xx_ll_spi.c
│ │ ├── stm32g4xx_ll_tim.c
│ │ ├── stm32g4xx_ll_ucpd.c
│ │ ├── stm32g4xx_ll_usart.c
│ │ ├── stm32g4xx_ll_usb.c
│ │ └── stm32g4xx_ll_utils.c
├── OpenSEC SEC-B175-10A SIM.launch
├── OpenSEC SEC-B175-10A.launch
├── OpenSEC SEC-B175-4A-SIM.launch
├── OpenSEC SEC-B175-4B-SIM.launch
├── OpenSEC SEC-B175-4B.launch
├── OpenSEC SEC-B175-7A.launch
├── OpenSEC SEC-B80-8A.launch
├── OpenSEC_SEC-B175-7A-SIM_default.launch
├── STM32G474CEUX_FLASH.ld
└── src
│ ├── analog.c
│ ├── analog.h
│ ├── buffer.c
│ ├── buffer.h
│ ├── can.c
│ ├── can.h
│ ├── commands.c
│ ├── commands.h
│ ├── config.c
│ ├── config.h
│ ├── control.c
│ ├── control.h
│ ├── crc.c
│ ├── crc.h
│ ├── delay.c
│ ├── delay.h
│ ├── dma.c
│ ├── dma.h
│ ├── eeprom.c
│ ├── eeprom.h
│ ├── flash.c
│ ├── flash.h
│ ├── hardware
│ ├── hardware.c
│ ├── hardware.h
│ ├── hw_reboost.c
│ ├── hw_reboost.h
│ ├── secb17510a.c
│ ├── secb17510a.h
│ ├── secb1754a.c
│ ├── secb1754a.h
│ ├── secb1754b.c
│ ├── secb1754b.h
│ ├── secb1757a.c
│ └── secb1757a.h
│ ├── leds.c
│ ├── leds.h
│ ├── main.c
│ ├── main.h
│ ├── mppt.c
│ ├── mppt.h
│ ├── packet.c
│ ├── packet.h
│ ├── pwm.c
│ ├── pwm.h
│ ├── startup_stm32g474ceux.s
│ ├── stm32g4xx_hal_conf.h
│ ├── syscalls.c
│ ├── sysmem.c
│ ├── system_stm32g4xx.c
│ ├── terminal.c
│ ├── terminal.h
│ ├── testing.c
│ ├── testing.h
│ ├── uart.c
│ └── uart.h
├── Pictures
├── 20210831_111327.jpg
├── 20210907_143401.jpg
├── 20211026_080104.jpg
├── Efficiency40V_0-6A_50-70V.png
├── IMG_20210124_115808.jpg
├── IMG_20210127_121656.jpg
├── IMG_20210128_111823.jpg
├── IMG_20210210_154253.jpg
├── IMG_20210210_154258.jpg
├── IMG_20210211_132339.jpg
├── IMG_20210212_160706.jpg
├── IMG_20210212_160715.jpg
├── IMG_20210212_160718.jpg
├── IMG_20210407_174357.jpg
├── IMG_20210621_180132.jpg
├── MPPT-STRAIGHT.png
├── Power_Losses_40V_0-6A_50-70V.png
├── tool.png
└── tool02.png
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Object files
5 | *.o
6 | *.ko
7 | *.obj
8 | *.elf
9 | *.bin
10 |
11 | # Linker output
12 | *.ilk
13 | *.map
14 | *.exp
15 |
16 | # Precompiled Headers
17 | *.gch
18 | *.pch
19 |
20 | # Libraries
21 | *.lib
22 | *.a
23 | *.la
24 | *.lo
25 |
26 | *.bak
27 |
28 | /Open-SEC Firmware/SEC-B175-4A
29 | /Open-SEC Firmware/SEC-B175-4A/*
30 | /Open-SEC Firmware/SEC-B175-4A-SIM/
31 | /Open-SEC Firmware/SEC-B175-4A-SIM/*
32 | /Open-SEC Firmware/SEC-B175-4B
33 | /Open-SEC Firmware/SEC-B175-4B/*
34 | /Open-SEC Firmware/SEC-B175-4B-SIM/
35 | /Open-SEC Firmware/SEC-B175-4B-SIM/*
36 | /Open-SEC Firmware/SEC-B175-7A
37 | /Open-SEC Firmware/SEC-B175-7A/*
38 | /Open-SEC Firmware/SEC-B175-7A-SIM/
39 | /Open-SEC Firmware/SEC-B175-7A-SIM/*
40 | /Open-SEC Firmware/SEC-B175-10A
41 | /Open-SEC Firmware/SEC-B175-10A/*
42 | /Open-SEC Firmware/SEC-B175-10A-SIM/
43 | /Open-SEC Firmware/SEC-B175-10A-SIM/*
44 | /Open-SEC Firmware/SEC-B80-8A
45 | /Open-SEC Firmware/SEC-B80-8A/*
46 | /Open-SEC Firmware/SEC-B80-8A-SIM/
47 | /Open-SEC Firmware/SEC-B80-8A-SIM/*
48 |
49 | /Open-SEC Bootloader/Debug
50 | /Open-SEC Bootloader/Debug/*
51 | /Open-SEC Bootloader/Release
52 | /Open-SEC Bootloader/Release/*
53 |
54 | PackBinaries.bat
55 | *.zip
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | OpenSmartEnergyConverter
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MPPT_ID32+0-4.dbc:
--------------------------------------------------------------------------------
1 | VERSION ""
2 |
3 |
4 | NS_ :
5 | NS_DESC_
6 | CM_
7 | BA_DEF_
8 | BA_
9 | VAL_
10 | CAT_DEF_
11 | CAT_
12 | FILTER
13 | BA_DEF_DEF_
14 | EV_DATA_
15 | ENVVAR_DATA_
16 | SGTYPE_
17 | SGTYPE_VAL_
18 | BA_DEF_SGTYPE_
19 | BA_SGTYPE_
20 | SIG_TYPE_REF_
21 | VAL_TABLE_
22 | SIG_GROUP_
23 | SIG_VALTYPE_
24 | SIGTYPE_VALTYPE_
25 | BO_TX_BU_
26 | BA_DEF_REL_
27 | BA_REL_
28 | BA_DEF_DEF_REL_
29 | BU_SG_REL_
30 | BU_EV_REL_
31 | BU_BO_REL_
32 | SG_MUL_VAL_
33 |
34 | BS_:
35 |
36 | BU_:
37 | VAL_TABLE_ MPPT_Enabled 1 "Enabled" 0 "Disabled" ;
38 | VAL_TABLE_ MPPT_Mode 6 "Fault" 5 "Temperature De-rating" 4 "Constant Output Current" 3 "Constand Output Voltage" 2 "Minimum Input Current" 1 "Constand Input Current" 0 "Constand Input Voltage" ;
39 | VAL_TABLE_ MPPT_Fault 8 "Fault" 7 "Phase Over Current" 6 "Input Under Current" 5 "Input Over Current" 4 "Output Over Current" 3 "Output Over Voltage" 2 "Input Over Voltage" 1 "Configuration Error" 0 "OK(No Fault)" ;
40 |
41 |
42 | BO_ 513 MPPT_32_0_Status: 5 Vector__XXX
43 | SG_ MPPT_Enabled : 16|8@1- (1,0) [0|0] "" Vector__XXX
44 | SG_ MPPT_HeatsinkTemperature : 39|8@0- (1,0) [-128|127] "C" Vector__XXX
45 | SG_ MPPT_AmbientTemperature : 31|8@0- (1,0) [-128|127] "C" Vector__XXX
46 | SG_ MPPT_Fault : 8|8@1+ (1,0) [0|0] "" Vector__XXX
47 | SG_ MPPT_Mode : 0|8@1+ (1,0) [0|0] "" Vector__XXX
48 |
49 | BO_ 512 MPPT_32_0_Power: 8 Vector__XXX
50 | SG_ MPPT_Iout : 55|16@0- (0.0005,0) [0|0] "A" Vector__XXX
51 | SG_ MPPT_Vout : 39|16@0- (0.01,0) [-327.68|327.67] "V" Vector__XXX
52 | SG_ MPPT_Iin : 23|16@0- (0.0005,0) [-16.384|16.3835] "A" Vector__XXX
53 | SG_ MPPT_Vin : 7|16@0- (0.01,0) [-327.68|327.67] "V" Vector__XXX
54 |
55 |
56 |
57 | BA_DEF_ "MultiplexExtEnabled" ENUM "No","Yes";
58 | BA_DEF_ "BusType" STRING ;
59 | BA_DEF_DEF_ "MultiplexExtEnabled" "No";
60 | BA_DEF_DEF_ "BusType" "";
61 | VAL_ 513 MPPT_Enabled 1 "Enabled" 0 "Disabled" ;
62 | VAL_ 513 MPPT_Fault 6 "Fault" 5 "Temperature De-rating" 4 "Constant Output Current" 3 "Constand Output Voltage" 2 "Minimum Input Current" 1 "Constand Input Current" 0 "Constand Input Voltage" ;
63 | VAL_ 513 MPPT_Mode 8 "Fault" 7 "Phase Over Current" 6 "Input Under Current" 5 "Input Over Current" 4 "Output Over Current" 3 "Output Over Voltage" 2 "Input Over Voltage" 1 "Configuration Error" 0 "OK(No Fault)" ;
64 |
65 |
--------------------------------------------------------------------------------
/Measurements/eff 50V.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Measurements/eff 50V.png
--------------------------------------------------------------------------------
/Measurements/eff 64V.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Measurements/eff 64V.png
--------------------------------------------------------------------------------
/Measurements/eff 72V.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Measurements/eff 72V.png
--------------------------------------------------------------------------------
/Measurements/power loss 50V.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Measurements/power loss 50V.png
--------------------------------------------------------------------------------
/Measurements/power loss 64V.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Measurements/power loss 64V.png
--------------------------------------------------------------------------------
/Measurements/power loss 72V.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Measurements/power loss 72V.png
--------------------------------------------------------------------------------
/Open-SEC Bootloader/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | SEC-BOOT
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g474xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Open-SEC Bootloader/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g474xx.h
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Open-SEC Bootloader/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g4xx.h
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/CMSIS/Device/ST/STM32G4xx/Include/system_stm32g4xx.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32g4xx.h
4 | * @author MCD Application Team
5 | * @brief CMSIS Cortex-M4 Device System Source File for STM32G4xx devices.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | *
© Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /** @addtogroup CMSIS
21 | * @{
22 | */
23 |
24 | /** @addtogroup stm32g4xx_system
25 | * @{
26 | */
27 |
28 | /**
29 | * @brief Define to prevent recursive inclusion
30 | */
31 | #ifndef __SYSTEM_STM32G4XX_H
32 | #define __SYSTEM_STM32G4XX_H
33 |
34 | #ifdef __cplusplus
35 | extern "C" {
36 | #endif
37 |
38 | /** @addtogroup STM32G4xx_System_Includes
39 | * @{
40 | */
41 |
42 | /**
43 | * @}
44 | */
45 |
46 |
47 | /** @addtogroup STM32G4xx_System_Exported_Variables
48 | * @{
49 | */
50 | /* The SystemCoreClock variable is updated in three ways:
51 | 1) by calling CMSIS function SystemCoreClockUpdate()
52 | 2) by calling HAL API function HAL_RCC_GetSysClockFreq()
53 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
54 | Note: If you use this function to configure the system clock; then there
55 | is no need to call the 2 first functions listed above, since SystemCoreClock
56 | variable is updated automatically.
57 | */
58 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
59 |
60 | extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
61 | extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
62 |
63 | /**
64 | * @}
65 | */
66 |
67 | /** @addtogroup STM32G4xx_System_Exported_Constants
68 | * @{
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /** @addtogroup STM32G4xx_System_Exported_Macros
76 | * @{
77 | */
78 |
79 | /**
80 | * @}
81 | */
82 |
83 | /** @addtogroup STM32G4xx_System_Exported_Functions
84 | * @{
85 | */
86 |
87 | extern void SystemInit(void);
88 | extern void SystemCoreClockUpdate(void);
89 | /**
90 | * @}
91 | */
92 |
93 | #ifdef __cplusplus
94 | }
95 | #endif
96 |
97 | #endif /*__SYSTEM_STM32G4XX_H */
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | /**
104 | * @}
105 | */
106 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
107 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/CMSIS/Include/cmsis_version.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file cmsis_version.h
3 | * @brief CMSIS Core(M) Version definitions
4 | * @version V5.0.3
5 | * @date 24. June 2019
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2009-2019 ARM Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef __CMSIS_VERSION_H
32 | #define __CMSIS_VERSION_H
33 |
34 | /* CMSIS Version definitions */
35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
36 | #define __CM_CMSIS_VERSION_SUB ( 3U) /*!< [15:0] CMSIS Core(M) sub version */
37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
39 | #endif
40 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/CMSIS/Include/tz_context.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file tz_context.h
3 | * @brief Context Management for Armv8-M TrustZone
4 | * @version V1.0.1
5 | * @date 10. January 2018
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef TZ_CONTEXT_H
32 | #define TZ_CONTEXT_H
33 |
34 | #include
35 |
36 | #ifndef TZ_MODULEID_T
37 | #define TZ_MODULEID_T
38 | /// \details Data type that identifies secure software modules called by a process.
39 | typedef uint32_t TZ_ModuleId_t;
40 | #endif
41 |
42 | /// \details TZ Memory ID identifies an allocated memory slot.
43 | typedef uint32_t TZ_MemoryId_t;
44 |
45 | /// Initialize secure context memory system
46 | /// \return execution status (1: success, 0: error)
47 | uint32_t TZ_InitContextSystem_S (void);
48 |
49 | /// Allocate context memory for calling secure software modules in TrustZone
50 | /// \param[in] module identifies software modules called from non-secure mode
51 | /// \return value != 0 id TrustZone memory slot identifier
52 | /// \return value 0 no memory available or internal error
53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
54 |
55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
56 | /// \param[in] id TrustZone memory slot identifier
57 | /// \return execution status (1: success, 0: error)
58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
59 |
60 | /// Load secure context (called on RTOS thread context switch)
61 | /// \param[in] id TrustZone memory slot identifier
62 | /// \return execution status (1: success, 0: error)
63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
64 |
65 | /// Store secure context (called on RTOS thread context switch)
66 | /// \param[in] id TrustZone memory slot identifier
67 | /// \return execution status (1: success, 0: error)
68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
69 |
70 | #endif // TZ_CONTEXT_H
71 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Inc/stm32_assert_template.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32_assert.h
4 | * @author MCD Application Team
5 | * @brief STM32 assert template file.
6 | * This file should be copied to the application folder and renamed
7 | * to stm32_assert.h.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © Copyright (c) 2019 STMicroelectronics.
12 | * All rights reserved.
13 | *
14 | * This software component is licensed by ST under BSD 3-Clause license,
15 | * the "License"; You may not use this file except in compliance with the
16 | * License. You may obtain a copy of the License at:
17 | * opensource.org/licenses/BSD-3-Clause
18 | *
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef STM32_ASSERT_H
24 | #define STM32_ASSERT_H
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Exported types ------------------------------------------------------------*/
31 | /* Exported constants --------------------------------------------------------*/
32 | /* Includes ------------------------------------------------------------------*/
33 | /* Exported macro ------------------------------------------------------------*/
34 | #ifdef USE_FULL_ASSERT
35 | /**
36 | * @brief The assert_param macro is used for function's parameters check.
37 | * @param expr: If expr is false, it calls assert_failed function
38 | * which reports the name of the source file and the source
39 | * line number of the call that failed.
40 | * If expr is true, it returns no value.
41 | * @retval None
42 | */
43 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
44 | /* Exported functions ------------------------------------------------------- */
45 | void assert_failed(uint8_t *file, uint32_t line);
46 | #else
47 | #define assert_param(expr) ((void)0U)
48 | #endif /* USE_FULL_ASSERT */
49 |
50 | #ifdef __cplusplus
51 | }
52 | #endif
53 |
54 | #endif /* STM32_ASSERT_H */
55 |
56 |
57 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
58 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_cryp_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_cryp_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of CRYPEx HAL module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_CRYP_EX_H
22 | #define STM32G4xx_HAL_CRYP_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32G4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | #if defined(AES)
36 |
37 | /** @defgroup CRYPEx CRYPEx
38 | * @brief CRYP Extension HAL module driver.
39 | * @{
40 | */
41 |
42 | /* Exported types ------------------------------------------------------------*/
43 | /* Exported constants --------------------------------------------------------*/
44 | /* Private types -------------------------------------------------------------*/
45 | /** @defgroup CRYPEx_Private_Types CRYPEx Private Types
46 | * @{
47 | */
48 |
49 | /**
50 | * @}
51 | */
52 |
53 | /* Private variables ---------------------------------------------------------*/
54 | /** @defgroup CRYPEx_Private_Variables CRYPEx Private Variables
55 | * @{
56 | */
57 |
58 | /**
59 | * @}
60 | */
61 |
62 | /* Private constants ---------------------------------------------------------*/
63 | /** @defgroup CRYPEx_Private_Constants CRYPEx Private Constants
64 | * @{
65 | */
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | /* Private macros ------------------------------------------------------------*/
72 | /** @defgroup CRYPEx_Private_Macros CRYPEx Private Macros
73 | * @{
74 | */
75 |
76 | /**
77 | * @}
78 | */
79 |
80 | /* Private functions ---------------------------------------------------------*/
81 | /** @defgroup CRYPEx_Private_Functions CRYPEx Private Functions
82 | * @{
83 | */
84 |
85 | /**
86 | * @}
87 | */
88 |
89 | /* Exported functions --------------------------------------------------------*/
90 | /** @defgroup CRYPEx_Exported_Functions CRYPEx Exported Functions
91 | * @{
92 | */
93 |
94 | /** @addtogroup CRYPEx_Exported_Functions_Group1
95 | * @{
96 | */
97 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_GenerateAuthTAG(CRYP_HandleTypeDef *hcryp, uint32_t *AuthTag, uint32_t Timeout);
98 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_GenerateAuthTAG(CRYP_HandleTypeDef *hcryp, uint32_t *AuthTag, uint32_t Timeout);
99 |
100 | /**
101 | * @}
102 | */
103 |
104 | /** @addtogroup CRYPEx_Exported_Functions_Group2
105 | * @{
106 | */
107 | void HAL_CRYPEx_EnableAutoKeyDerivation(CRYP_HandleTypeDef *hcryp);
108 | void HAL_CRYPEx_DisableAutoKeyDerivation(CRYP_HandleTypeDef *hcryp);
109 |
110 | /**
111 | * @}
112 | */
113 |
114 | /**
115 | * @}
116 | */
117 |
118 | /**
119 | * @}
120 | */
121 | #endif /* AES */
122 |
123 | /**
124 | * @}
125 | */
126 |
127 | #ifdef __cplusplus
128 | }
129 | #endif
130 |
131 | #endif /* STM32G4xx_HAL_CRYP_EX_H */
132 |
133 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
134 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_flash_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_flash_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of FLASH HAL Extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2019 STMicroelectronics
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef STM32G4xx_HAL_FLASH_EX_H
21 | #define STM32G4xx_HAL_FLASH_EX_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "stm32g4xx_hal_def.h"
29 |
30 | /** @addtogroup STM32G4xx_HAL_Driver
31 | * @{
32 | */
33 |
34 | /** @addtogroup FLASHEx
35 | * @{
36 | */
37 |
38 | /* Exported types ------------------------------------------------------------*/
39 |
40 | /* Exported constants --------------------------------------------------------*/
41 |
42 | /* Exported macro ------------------------------------------------------------*/
43 |
44 | /* Exported functions --------------------------------------------------------*/
45 | /** @addtogroup FLASHEx_Exported_Functions
46 | * @{
47 | */
48 |
49 | /* Extended Program operation functions *************************************/
50 | /** @addtogroup FLASHEx_Exported_Functions_Group1
51 | * @{
52 | */
53 | HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
54 | HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
55 | HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
56 | void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
57 | HAL_StatusTypeDef HAL_FLASHEx_EnableSecMemProtection(uint32_t Bank);
58 | void HAL_FLASHEx_EnableDebugger(void);
59 | void HAL_FLASHEx_DisableDebugger(void);
60 | /**
61 | * @}
62 | */
63 |
64 | /**
65 | * @}
66 | */
67 |
68 | /** @addtogroup FLASHEx_Private_Functions
69 | * @{
70 | */
71 | void FLASH_PageErase(uint32_t Page, uint32_t Banks);
72 | void FLASH_FlushCaches(void);
73 | /**
74 | * @}
75 | */
76 |
77 | /**
78 | * @}
79 | */
80 |
81 | /**
82 | * @}
83 | */
84 |
85 | #ifdef __cplusplus
86 | }
87 | #endif
88 |
89 | #endif /* STM32G4xx_HAL_FLASH_EX_H */
90 |
91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
92 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_flash_ramfunc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_flash_ramfunc.h
4 | * @author MCD Application Team
5 | * @brief Header file of FLASH RAMFUNC driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2019 STMicroelectronics
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef STM32G4xx_FLASH_RAMFUNC_H
21 | #define STM32G4xx_FLASH_RAMFUNC_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "stm32g4xx_hal_def.h"
29 |
30 | /** @addtogroup STM32G4xx_HAL_Driver
31 | * @{
32 | */
33 |
34 | /** @addtogroup FLASH_RAMFUNC
35 | * @{
36 | */
37 |
38 | /* Exported types ------------------------------------------------------------*/
39 | /* Exported macro ------------------------------------------------------------*/
40 | /* Exported functions --------------------------------------------------------*/
41 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions
42 | * @{
43 | */
44 |
45 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1
46 | * @{
47 | */
48 | /* Peripheral Control functions ************************************************/
49 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableRunPowerDown(void);
50 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableRunPowerDown(void);
51 | #if defined (FLASH_OPTR_DBANK)
52 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_OB_DBankConfig(uint32_t DBankConfig);
53 | #endif
54 | /**
55 | * @}
56 | */
57 |
58 | /**
59 | * @}
60 | */
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | /**
67 | * @}
68 | */
69 |
70 | #ifdef __cplusplus
71 | }
72 | #endif
73 |
74 | #endif /* STM32G4xx_FLASH_RAMFUNC_H */
75 |
76 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
77 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_opamp_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_opamp_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of OPAMP HAL Extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_OPAMP_EX_H
22 | #define STM32G4xx_HAL_OPAMP_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32G4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | /** @addtogroup OPAMPEx OPAMPEx
36 | * @{
37 | */
38 | /* Exported types ------------------------------------------------------------*/
39 | /* Exported constants --------------------------------------------------------*/
40 | /* Exported macro ------------------------------------------------------------*/
41 | /* Exported functions --------------------------------------------------------*/
42 | /** @addtogroup OPAMPEx_Exported_Functions OPAMP Extended Exported Functions
43 | * @{
44 | */
45 |
46 | /** @addtogroup OPAMPEx_Exported_Functions_Group1 Extended Input and Output operation functions
47 | * @{
48 | */
49 |
50 | /* I/O operation functions *****************************************************/
51 |
52 | #if defined(STM32G473xx) || defined(STM32G474xx) || defined(STM32G483xx) || defined(STM32G484xx)
53 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2,
54 | OPAMP_HandleTypeDef *hopamp3, OPAMP_HandleTypeDef *hopamp4, OPAMP_HandleTypeDef *hopamp5, OPAMP_HandleTypeDef *hopamp6);
55 | #elif defined(STM32GBK1CB) || defined(STM32G431xx) || defined(STM32G441xx) || defined(STM32G471xx)
56 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2,
57 | OPAMP_HandleTypeDef *hopamp3);
58 | #elif defined(STM32G491xx) || defined(STM32G4A1xx)
59 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2,
60 | OPAMP_HandleTypeDef *hopamp3, OPAMP_HandleTypeDef *hopamp6);
61 | #endif
62 |
63 | /**
64 | * @}
65 | */
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /**
76 | * @}
77 | */
78 |
79 |
80 | #ifdef __cplusplus
81 | }
82 | #endif
83 |
84 |
85 | #endif /* STM32G4xx_HAL_OPAMP_EX_H */
86 |
87 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
88 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_pcd_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_pcd_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of PCD HAL Extension module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_PCD_EX_H
22 | #define STM32G4xx_HAL_PCD_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | #if defined (USB)
32 | /** @addtogroup STM32G4xx_HAL_Driver
33 | * @{
34 | */
35 |
36 | /** @addtogroup PCDEx
37 | * @{
38 | */
39 | /* Exported types ------------------------------------------------------------*/
40 | /* Exported constants --------------------------------------------------------*/
41 | /* Exported macros -----------------------------------------------------------*/
42 | /* Exported functions --------------------------------------------------------*/
43 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions
44 | * @{
45 | */
46 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
47 | * @{
48 | */
49 |
50 |
51 |
52 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr,
53 | uint16_t ep_kind, uint32_t pmaadress);
54 |
55 |
56 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd);
57 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd);
58 |
59 |
60 | HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd);
61 | HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd);
62 | void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd);
63 |
64 | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg);
65 | void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg);
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /**
76 | * @}
77 | */
78 |
79 | /**
80 | * @}
81 | */
82 | #endif /* defined (USB) */
83 |
84 | #ifdef __cplusplus
85 | }
86 | #endif
87 |
88 |
89 | #endif /* STM32G4xx_HAL_PCD_EX_H */
90 |
91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
92 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_sai_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_sai_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of SAI HAL extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_SAI_EX_H
22 | #define STM32G4xx_HAL_SAI_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32G4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | /** @addtogroup SAIEx
36 | * @{
37 | */
38 |
39 | /* Exported types ------------------------------------------------------------*/
40 | /** @defgroup SAIEx_Exported_Types SAIEx Exported Types
41 | * @{
42 | */
43 |
44 | /**
45 | * @brief PDM microphone delay structure definition
46 | */
47 | typedef struct
48 | {
49 | uint32_t MicPair; /*!< Specifies which pair of microphones is selected.
50 | This parameter must be a number between Min_Data = 1 and Max_Data = 3. */
51 |
52 | uint32_t LeftDelay; /*!< Specifies the delay in PDM clock unit to apply on left microphone.
53 | This parameter must be a number between Min_Data = 0 and Max_Data = 7. */
54 |
55 | uint32_t RightDelay; /*!< Specifies the delay in PDM clock unit to apply on right microphone.
56 | This parameter must be a number between Min_Data = 0 and Max_Data = 7. */
57 | } SAIEx_PdmMicDelayParamTypeDef;
58 |
59 | /**
60 | * @}
61 | */
62 |
63 | /* Exported constants --------------------------------------------------------*/
64 | /* Exported macros -----------------------------------------------------------*/
65 | /* Exported functions --------------------------------------------------------*/
66 | /** @addtogroup SAIEx_Exported_Functions SAIEx Extended Exported Functions
67 | * @{
68 | */
69 |
70 | /** @addtogroup SAIEx_Exported_Functions_Group1 Peripheral Control functions
71 | * @{
72 | */
73 | HAL_StatusTypeDef HAL_SAIEx_ConfigPdmMicDelay(SAI_HandleTypeDef *hsai, SAIEx_PdmMicDelayParamTypeDef *pdmMicDelay);
74 | /**
75 | * @}
76 | */
77 |
78 | /**
79 | * @}
80 | */
81 |
82 | /* Private macros ------------------------------------------------------------*/
83 | /** @addtogroup SAIEx_Private_Macros SAIEx Extended Private Macros
84 | * @{
85 | */
86 | #define IS_SAI_PDM_MIC_DELAY(VALUE) ((VALUE) <= 7U)
87 | /**
88 | * @}
89 | */
90 |
91 | /**
92 | * @}
93 | */
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | #ifdef __cplusplus
100 | }
101 | #endif
102 |
103 | #endif /* STM32G4xx_HAL_SAI_EX_H */
104 |
105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
106 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_spi_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_spi_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of SPI HAL Extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_SPI_EX_H
22 | #define STM32G4xx_HAL_SPI_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32G4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | /** @addtogroup SPIEx
36 | * @{
37 | */
38 |
39 | /* Exported types ------------------------------------------------------------*/
40 | /* Exported constants --------------------------------------------------------*/
41 | /* Exported macros -----------------------------------------------------------*/
42 | /* Exported functions --------------------------------------------------------*/
43 | /** @addtogroup SPIEx_Exported_Functions
44 | * @{
45 | */
46 |
47 | /* Initialization and de-initialization functions ****************************/
48 | /* IO operation functions *****************************************************/
49 | /** @addtogroup SPIEx_Exported_Functions_Group1
50 | * @{
51 | */
52 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi);
53 | /**
54 | * @}
55 | */
56 |
57 | /**
58 | * @}
59 | */
60 |
61 | /**
62 | * @}
63 | */
64 |
65 | /**
66 | * @}
67 | */
68 |
69 | #ifdef __cplusplus
70 | }
71 | #endif
72 |
73 | #endif /* STM32G4xx_HAL_SPI_EX_H */
74 |
75 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
76 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/License.md:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2017 STMicroelectronics
2 |
3 | This software component is licensed by STMicroelectronics under the **BSD 3-Clause** license. You may not use this file except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_spi_ex.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_spi_ex.c
4 | * @author MCD Application Team
5 | * @brief Extended SPI HAL module driver.
6 | * This file provides firmware functions to manage the following
7 | * SPI peripheral extended functionalities :
8 | * + IO operation functions
9 | *
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * © Copyright (c) 2019 STMicroelectronics.
14 | * All rights reserved.
15 | *
16 | * This software component is licensed by ST under BSD 3-Clause license,
17 | * the "License"; You may not use this file except in compliance with the
18 | * License. You may obtain a copy of the License at:
19 | * opensource.org/licenses/BSD-3-Clause
20 | *
21 | ******************************************************************************
22 | */
23 |
24 | /* Includes ------------------------------------------------------------------*/
25 | #include "stm32g4xx_hal.h"
26 |
27 | /** @addtogroup STM32G4xx_HAL_Driver
28 | * @{
29 | */
30 |
31 | /** @defgroup SPIEx SPIEx
32 | * @brief SPI Extended HAL module driver
33 | * @{
34 | */
35 | #ifdef HAL_SPI_MODULE_ENABLED
36 |
37 | /* Private typedef -----------------------------------------------------------*/
38 | /* Private defines -----------------------------------------------------------*/
39 | /** @defgroup SPIEx_Private_Constants SPIEx Private Constants
40 | * @{
41 | */
42 | #define SPI_FIFO_SIZE 4UL
43 | /**
44 | * @}
45 | */
46 |
47 | /* Private macros ------------------------------------------------------------*/
48 | /* Private variables ---------------------------------------------------------*/
49 | /* Private function prototypes -----------------------------------------------*/
50 | /* Exported functions --------------------------------------------------------*/
51 |
52 | /** @defgroup SPIEx_Exported_Functions SPIEx Exported Functions
53 | * @{
54 | */
55 |
56 | /** @defgroup SPIEx_Exported_Functions_Group1 IO operation functions
57 | * @brief Data transfers functions
58 | *
59 | @verbatim
60 | ==============================================================================
61 | ##### IO operation functions #####
62 | ===============================================================================
63 | [..]
64 | This subsection provides a set of extended functions to manage the SPI
65 | data transfers.
66 |
67 | (#) Rx data flush function:
68 | (++) HAL_SPIEx_FlushRxFifo()
69 |
70 | @endverbatim
71 | * @{
72 | */
73 |
74 | /**
75 | * @brief Flush the RX fifo.
76 | * @param hspi pointer to a SPI_HandleTypeDef structure that contains
77 | * the configuration information for the specified SPI module.
78 | * @retval HAL status
79 | */
80 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi)
81 | {
82 | __IO uint32_t tmpreg;
83 | uint8_t count = 0U;
84 | while ((hspi->Instance->SR & SPI_FLAG_FRLVL) != SPI_FRLVL_EMPTY)
85 | {
86 | count++;
87 | tmpreg = hspi->Instance->DR;
88 | UNUSED(tmpreg); /* To avoid GCC warning */
89 | if (count == SPI_FIFO_SIZE)
90 | {
91 | return HAL_TIMEOUT;
92 | }
93 | }
94 | return HAL_OK;
95 | }
96 |
97 | /**
98 | * @}
99 | */
100 |
101 | /**
102 | * @}
103 | */
104 |
105 | #endif /* HAL_SPI_MODULE_ENABLED */
106 |
107 | /**
108 | * @}
109 | */
110 |
111 | /**
112 | * @}
113 | */
114 |
115 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
116 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_wwdg.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_wwdg.c
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_cordic.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_cordic.c
4 | * @author MCD Application Team
5 | * @brief CORDIC LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_cordic.h"
23 | #include "stm32g4xx_ll_bus.h"
24 | #ifdef USE_FULL_ASSERT
25 | #include "stm32_assert.h"
26 | #else
27 | #define assert_param(expr) ((void)0U)
28 | #endif /* USE_FULL_ASSERT */
29 |
30 | /** @addtogroup STM32G4xx_LL_Driver
31 | * @{
32 | */
33 |
34 | #if defined(CORDIC)
35 |
36 | /** @addtogroup CORDIC_LL
37 | * @{
38 | */
39 |
40 | /* Private types -------------------------------------------------------------*/
41 | /* Private variables ---------------------------------------------------------*/
42 | /* Private constants ---------------------------------------------------------*/
43 | /* Private macros ------------------------------------------------------------*/
44 | /* Private function prototypes -----------------------------------------------*/
45 |
46 | /* Exported functions --------------------------------------------------------*/
47 | /** @addtogroup CORDIC_LL_Exported_Functions
48 | * @{
49 | */
50 |
51 | /** @addtogroup CORDIC_LL_EF_Init
52 | * @{
53 | */
54 |
55 | /**
56 | * @brief De-Initialize CORDIC peripheral registers to their default reset values.
57 | * @param CORDICx CORDIC Instance
58 | * @retval An ErrorStatus enumeration value:
59 | * - SUCCESS: CORDIC registers are de-initialized
60 | * - ERROR: CORDIC registers are not de-initialized
61 | */
62 | ErrorStatus LL_CORDIC_DeInit(CORDIC_TypeDef *CORDICx)
63 | {
64 | ErrorStatus status = SUCCESS;
65 |
66 | /* Check the parameters */
67 | assert_param(IS_CORDIC_ALL_INSTANCE(CORDICx));
68 |
69 | if (CORDICx == CORDIC)
70 | {
71 | /* Force CORDIC reset */
72 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_CORDIC);
73 |
74 | /* Release CORDIC reset */
75 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_CORDIC);
76 | }
77 | else
78 | {
79 | status = ERROR;
80 | }
81 |
82 | return (status);
83 | }
84 |
85 | /**
86 | * @}
87 | */
88 |
89 | /**
90 | * @}
91 | */
92 |
93 | /**
94 | * @}
95 | */
96 |
97 | #endif /* defined(CORDIC) */
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | #endif /* USE_FULL_LL_DRIVER */
104 |
105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
106 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_crc.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_crc.c
4 | * @author MCD Application Team
5 | * @brief CRC LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_crc.h"
23 | #include "stm32g4xx_ll_bus.h"
24 |
25 | #ifdef USE_FULL_ASSERT
26 | #include "stm32_assert.h"
27 | #else
28 | #define assert_param(expr) ((void)0U)
29 | #endif
30 |
31 | /** @addtogroup STM32G4xx_LL_Driver
32 | * @{
33 | */
34 |
35 | #if defined (CRC)
36 |
37 | /** @addtogroup CRC_LL
38 | * @{
39 | */
40 |
41 | /* Private types -------------------------------------------------------------*/
42 | /* Private variables ---------------------------------------------------------*/
43 | /* Private constants ---------------------------------------------------------*/
44 | /* Private macros ------------------------------------------------------------*/
45 | /* Private function prototypes -----------------------------------------------*/
46 |
47 | /* Exported functions --------------------------------------------------------*/
48 | /** @addtogroup CRC_LL_Exported_Functions
49 | * @{
50 | */
51 |
52 | /** @addtogroup CRC_LL_EF_Init
53 | * @{
54 | */
55 |
56 | /**
57 | * @brief De-initialize CRC registers (Registers restored to their default values).
58 | * @param CRCx CRC Instance
59 | * @retval An ErrorStatus enumeration value:
60 | * - SUCCESS: CRC registers are de-initialized
61 | * - ERROR: CRC registers are not de-initialized
62 | */
63 | ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx)
64 | {
65 | ErrorStatus status = SUCCESS;
66 |
67 | /* Check the parameters */
68 | assert_param(IS_CRC_ALL_INSTANCE(CRCx));
69 |
70 | if (CRCx == CRC)
71 | {
72 | /* Force CRC reset */
73 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_CRC);
74 |
75 | /* Release CRC reset */
76 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_CRC);
77 | }
78 | else
79 | {
80 | status = ERROR;
81 | }
82 |
83 | return (status);
84 | }
85 |
86 | /**
87 | * @}
88 | */
89 |
90 | /**
91 | * @}
92 | */
93 |
94 | /**
95 | * @}
96 | */
97 |
98 | #endif /* defined (CRC) */
99 |
100 | /**
101 | * @}
102 | */
103 |
104 | #endif /* USE_FULL_LL_DRIVER */
105 |
106 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
107 |
108 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_crs.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_crs.h
4 | * @author MCD Application Team
5 | * @brief CRS LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2018 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_crs.h"
23 | #include "stm32g4xx_ll_bus.h"
24 |
25 | /** @addtogroup STM32G4xx_LL_Driver
26 | * @{
27 | */
28 |
29 | #if defined(CRS)
30 |
31 | /** @defgroup CRS_LL CRS
32 | * @{
33 | */
34 |
35 | /* Private types -------------------------------------------------------------*/
36 | /* Private variables ---------------------------------------------------------*/
37 | /* Private constants ---------------------------------------------------------*/
38 | /* Private macros ------------------------------------------------------------*/
39 | /* Private function prototypes -----------------------------------------------*/
40 |
41 | /* Exported functions --------------------------------------------------------*/
42 | /** @addtogroup CRS_LL_Exported_Functions
43 | * @{
44 | */
45 |
46 | /** @addtogroup CRS_LL_EF_Init
47 | * @{
48 | */
49 |
50 | /**
51 | * @brief De-Initializes CRS peripheral registers to their default reset values.
52 | * @retval An ErrorStatus enumeration value:
53 | * - SUCCESS: CRS registers are de-initialized
54 | * - ERROR: not applicable
55 | */
56 | ErrorStatus LL_CRS_DeInit(void)
57 | {
58 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_CRS);
59 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_CRS);
60 |
61 | return SUCCESS;
62 | }
63 |
64 |
65 |
66 | /**
67 | * @}
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | /**
75 | * @}
76 | */
77 |
78 | #endif /* defined(CRS) */
79 |
80 | /**
81 | * @}
82 | */
83 |
84 | #endif /* USE_FULL_LL_DRIVER */
85 |
86 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
87 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_fmac.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_fmac.c
4 | * @author MCD Application Team
5 | * @brief Header for stm32g4xx_ll_fmac.c module
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_fmac.h"
23 | #include "stm32g4xx_ll_bus.h"
24 | #ifdef USE_FULL_ASSERT
25 | #include "stm32_assert.h"
26 | #else
27 | #define assert_param(expr) ((void)0U)
28 | #endif /* USE_FULL_ASSERT */
29 |
30 | /** @addtogroup STM32G4xx_LL_Driver
31 | * @{
32 | */
33 |
34 | #if defined(FMAC)
35 |
36 | /** @addtogroup FMAC_LL
37 | * @{
38 | */
39 |
40 | /* Private typedef -----------------------------------------------------------*/
41 | /* Private defines -----------------------------------------------------------*/
42 | /* Private macros ------------------------------------------------------------*/
43 | /* Private variables ---------------------------------------------------------*/
44 | /* Global variables ----------------------------------------------------------*/
45 | /* Private function prototypes -----------------------------------------------*/
46 | /* Functions Definition ------------------------------------------------------*/
47 | /** @addtogroup FMAC_LL_Exported_Functions
48 | * @{
49 | */
50 |
51 | /** @addtogroup FMAC_LL_EF_Init
52 | * @{
53 | */
54 |
55 | /**
56 | * @brief Initialize FMAC peripheral registers to their default reset values.
57 | * @param FMACx FMAC Instance
58 | * @retval ErrorStatus enumeration value:
59 | * - SUCCESS: FMAC registers are initialized
60 | * - ERROR: FMAC registers are not initialized
61 | */
62 | ErrorStatus LL_FMAC_Init(FMAC_TypeDef *FMACx)
63 | {
64 | ErrorStatus status = SUCCESS;
65 |
66 | /* Check the parameters */
67 | assert_param(IS_FMAC_ALL_INSTANCE(FMACx));
68 |
69 | if (FMACx == FMAC)
70 | {
71 | /* Perform the reset */
72 | LL_FMAC_EnableReset(FMACx);
73 |
74 | /* Wait until flag is reset */
75 | while (LL_FMAC_IsEnabledReset(FMACx) != 0UL)
76 | {
77 | }
78 | }
79 | else
80 | {
81 | status = ERROR;
82 | }
83 |
84 | return (status);
85 | }
86 |
87 | /**
88 | * @brief De-Initialize FMAC peripheral registers to their default reset values.
89 | * @param FMACx FMAC Instance
90 | * @retval An ErrorStatus enumeration value:
91 | * - SUCCESS: FMAC registers are de-initialized
92 | * - ERROR: FMAC registers are not de-initialized
93 | */
94 | ErrorStatus LL_FMAC_DeInit(FMAC_TypeDef *FMACx)
95 | {
96 | ErrorStatus status = SUCCESS;
97 |
98 | /* Check the parameters */
99 | assert_param(IS_FMAC_ALL_INSTANCE(FMACx));
100 |
101 | if (FMACx == FMAC)
102 | {
103 | /* Force FMAC reset */
104 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_FMAC);
105 |
106 | /* Release FMAC reset */
107 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_FMAC);
108 | }
109 | else
110 | {
111 | status = ERROR;
112 | }
113 |
114 | return (status);
115 | }
116 |
117 |
118 |
119 | /**
120 | * @}
121 | */
122 |
123 | /**
124 | * @}
125 | */
126 |
127 | /**
128 | * @}
129 | */
130 |
131 | #endif /* defined(FMAC) */
132 |
133 | /**
134 | * @}
135 | */
136 |
137 | #endif /* USE_FULL_LL_DRIVER */
138 |
139 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
140 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_hrtim.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_hrtim.c
4 | * @author MCD Application Team
5 | * @brief HRTIM LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_hrtim.h"
23 | #include "stm32g4xx_ll_bus.h"
24 |
25 | #ifdef USE_FULL_ASSERT
26 | #include "stm32_assert.h"
27 | #else
28 | #define assert_param(expr) ((void)0U)
29 | #endif
30 |
31 | /** @addtogroup STM32G4xx_LL_Driver
32 | * @{
33 | */
34 |
35 | #if defined (HRTIM1)
36 |
37 | /** @addtogroup HRTIM_LL
38 | * @{
39 | */
40 |
41 | /* Private types -------------------------------------------------------------*/
42 | /* Private variables ---------------------------------------------------------*/
43 | /* Private constants ---------------------------------------------------------*/
44 | /* Private macros ------------------------------------------------------------*/
45 | /* Private function prototypes -----------------------------------------------*/
46 | /* Exported functions --------------------------------------------------------*/
47 | /** @addtogroup HRTIM_LL_Exported_Functions
48 | * @{
49 | */
50 | /**
51 | * @brief Set HRTIM instance registers to their reset values.
52 | * @param HRTIMx High Resolution Timer instance
53 | * @retval ErrorStatus enumeration value:
54 | * - SUCCESS: HRTIMx registers are de-initialized
55 | * - ERROR: invalid HRTIMx instance
56 | */
57 | ErrorStatus LL_HRTIM_DeInit(HRTIM_TypeDef *HRTIMx)
58 | {
59 | ErrorStatus result = SUCCESS;
60 |
61 | /* Check the parameters */
62 | assert_param(IS_HRTIM_ALL_INSTANCE(HRTIMx));
63 | LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_HRTIM1);
64 | LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_HRTIM1);
65 | return result;
66 | }
67 | /**
68 | * @}
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | #endif /* HRTIM1 */
76 |
77 | /**
78 | * @}
79 | */
80 |
81 | #endif /* USE_FULL_LL_DRIVER */
82 |
83 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
84 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_pwr.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_pwr.c
4 | * @author MCD Application Team
5 | * @brief PWR LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_pwr.h"
23 | #include "stm32g4xx_ll_bus.h"
24 |
25 | /** @addtogroup STM32G4xx_LL_Driver
26 | * @{
27 | */
28 |
29 | #if defined(PWR)
30 |
31 | /** @defgroup PWR_LL PWR
32 | * @{
33 | */
34 |
35 | /* Private types -------------------------------------------------------------*/
36 | /* Private variables ---------------------------------------------------------*/
37 | /* Private constants ---------------------------------------------------------*/
38 | /* Private macros ------------------------------------------------------------*/
39 | /* Private function prototypes -----------------------------------------------*/
40 |
41 | /* Exported functions --------------------------------------------------------*/
42 | /** @addtogroup PWR_LL_Exported_Functions
43 | * @{
44 | */
45 |
46 | /** @addtogroup PWR_LL_EF_Init
47 | * @{
48 | */
49 |
50 | /**
51 | * @brief De-initialize the PWR registers to their default reset values.
52 | * @retval An ErrorStatus enumeration value:
53 | * - SUCCESS: PWR registers are de-initialized
54 | * - ERROR: not applicable
55 | */
56 | ErrorStatus LL_PWR_DeInit(void)
57 | {
58 | /* Force reset of PWR clock */
59 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_PWR);
60 |
61 | /* Release reset of PWR clock */
62 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_PWR);
63 |
64 | return SUCCESS;
65 | }
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /**
76 | * @}
77 | */
78 | #endif /* defined(PWR) */
79 | /**
80 | * @}
81 | */
82 |
83 | #endif /* USE_FULL_LL_DRIVER */
84 |
85 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
86 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/buffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef BUFFER_H_
19 | #define BUFFER_H_
20 |
21 | #include
22 |
23 | void buffer_append_int8(uint8_t* buffer, int8_t number, int32_t *index);
24 | void buffer_append_uint8(uint8_t* buffer, uint8_t number, int32_t *index);
25 | void buffer_append_int16(uint8_t* buffer, int16_t number, int32_t *index);
26 | void buffer_append_uint16(uint8_t* buffer, uint16_t number, int32_t *index);
27 | void buffer_append_int32(uint8_t* buffer, int32_t number, int32_t *index);
28 | void buffer_append_uint32(uint8_t* buffer, uint32_t number, int32_t *index);
29 | void buffer_append_float16(uint8_t* buffer, float number, float scale, int32_t *index);
30 | void buffer_append_float32(uint8_t* buffer, float number, float scale, int32_t *index);
31 | void buffer_append_float32_auto(uint8_t* buffer, float number, int32_t *index);
32 | int8_t buffer_get_int8(const uint8_t *buffer, int32_t *index);
33 | uint8_t buffer_get_uint8(const uint8_t *buffer, int32_t *index);
34 | int16_t buffer_get_int16(const uint8_t *buffer, int32_t *index);
35 | uint16_t buffer_get_uint16(const uint8_t *buffer, int32_t *index);
36 | int32_t buffer_get_int32(const uint8_t *buffer, int32_t *index);
37 | uint32_t buffer_get_uint32(const uint8_t *buffer, int32_t *index);
38 | float buffer_get_float16(const uint8_t *buffer, float scale, int32_t *index);
39 | float buffer_get_float32(const uint8_t *buffer, float scale, int32_t *index);
40 | float buffer_get_float32_auto(const uint8_t *buffer, int32_t *index);
41 |
42 | #endif /* BUFFER_H_ */
43 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/buffer.h.bak:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 Benjamin Vedder benjamin@vedder.se
3 |
4 | This file is part of the VESC firmware.
5 |
6 | The VESC firmware is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | The VESC firmware is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #ifndef BUFFER_H_
21 | #define BUFFER_H_
22 |
23 | #include
24 |
25 | void buffer_append_int8(uint8_t* buffer, int8_t number, int32_t *index);
26 | void buffer_append_uint8(uint8_t* buffer, uint8_t number, int32_t *index);
27 | void buffer_append_int16(uint8_t* buffer, int16_t number, int32_t *index);
28 | void buffer_append_uint16(uint8_t* buffer, uint16_t number, int32_t *index);
29 | void buffer_append_int32(uint8_t* buffer, int32_t number, int32_t *index);
30 | void buffer_append_uint32(uint8_t* buffer, uint32_t number, int32_t *index);
31 | void buffer_append_float16(uint8_t* buffer, float number, float scale, int32_t *index);
32 | void buffer_append_float32(uint8_t* buffer, float number, float scale, int32_t *index);
33 | void buffer_append_float32_auto(uint8_t* buffer, float number, int32_t *index);
34 | int8_t buffer_get_int8(const uint8_t *buffer, int32_t *index);
35 | uint8_t buffer_get_uint8(const uint8_t *buffer, int32_t *index);
36 | int16_t buffer_get_int16(const uint8_t *buffer, int32_t *index);
37 | uint16_t buffer_get_uint16(const uint8_t *buffer, int32_t *index);
38 | int32_t buffer_get_int32(const uint8_t *buffer, int32_t *index);
39 | uint32_t buffer_get_uint32(const uint8_t *buffer, int32_t *index);
40 | float buffer_get_float16(const uint8_t *buffer, float scale, int32_t *index);
41 | float buffer_get_float32(const uint8_t *buffer, float scale, int32_t *index);
42 | float buffer_get_float32_auto(const uint8_t *buffer, int32_t *index);
43 |
44 | #endif /* BUFFER_H_ */
45 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/crc.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #include "crc.h"
19 |
20 | // CRC Table
21 | const unsigned short libCRCLookupTable[] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084,
22 | 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad,
23 | 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7,
24 | 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
25 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a,
26 | 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672,
27 | 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719,
28 | 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7,
29 | 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948,
30 | 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50,
31 | 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b,
32 | 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
33 | 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97,
34 | 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe,
35 | 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca,
36 | 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3,
37 | 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d,
38 | 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214,
39 | 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c,
40 | 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
41 | 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3,
42 | 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d,
43 | 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806,
44 | 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e,
45 | 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1,
46 | 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b,
47 | 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0,
48 | 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
49 | 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 };
50 |
51 | unsigned short libCRCCalcCRC16(unsigned char *buf, unsigned int len) {
52 | unsigned int i;
53 | unsigned short cksum = 0;
54 | for (i = 0; i < len; i++) {
55 | cksum = libCRCLookupTable[(((cksum >> 8) ^ *buf++) & 0xFF)] ^ (cksum << 8);
56 | }
57 | return cksum;
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/crc.c.bak:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 Benjamin Vedder benjamin@vedder.se
3 |
4 | This file is part of the VESC firmware.
5 |
6 | The VESC firmware is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | The VESC firmware is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #include "crc.h"
21 |
22 | // CRC Table
23 | const unsigned short libCRCLookupTable[] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084,
24 | 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad,
25 | 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7,
26 | 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
27 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a,
28 | 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672,
29 | 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719,
30 | 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7,
31 | 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948,
32 | 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50,
33 | 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b,
34 | 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
35 | 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97,
36 | 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe,
37 | 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca,
38 | 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3,
39 | 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d,
40 | 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214,
41 | 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c,
42 | 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
43 | 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3,
44 | 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d,
45 | 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806,
46 | 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e,
47 | 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1,
48 | 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b,
49 | 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0,
50 | 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
51 | 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 };
52 |
53 | unsigned short libCRCCalcCRC16(unsigned char *buf, unsigned int len) {
54 | unsigned int i;
55 | unsigned short cksum = 0;
56 | for (i = 0; i < len; i++) {
57 | cksum = libCRCLookupTable[(((cksum >> 8) ^ *buf++) & 0xFF)] ^ (cksum << 8);
58 | }
59 | return cksum;
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/crc.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef CRC_H_
19 | #define CRC_H_
20 |
21 | /*
22 | * Functions
23 | */
24 | unsigned short libCRCCalcCRC16(unsigned char *buf, unsigned int len);
25 |
26 | #endif /* CRC_H_ */
27 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/crc.h.bak:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 Benjamin Vedder benjamin@vedder.se
3 |
4 | This file is part of the VESC firmware.
5 |
6 | The VESC firmware is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | The VESC firmware is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #ifndef CRC_H_
21 | #define CRC_H_
22 |
23 | /*
24 | * Functions
25 | */
26 | unsigned short libCRCCalcCRC16(unsigned char *buf, unsigned int len);
27 |
28 | #endif /* CRC_H_ */
29 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/delay.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #include "delay.h"
18 |
19 | static uint32_t hmsCnt = 0;
20 |
21 | void modDelayInit(void) {
22 | SystemCoreClockUpdate();
23 |
24 | //SystemCoreClock / 1000
25 | if(SysTick_Config(SystemCoreClock / 1000)){
26 | while(1); //Error setting SysTick.
27 | }
28 | }
29 |
30 | uint8_t modDelayTick1ms(uint32_t *last, uint32_t ticks) {
31 | if((uint32_t)(HAL_GetTick() - *last) >= ticks)
32 | {
33 | *last = HAL_GetTick();
34 | return true;
35 | }
36 |
37 | return false;
38 | }
39 |
40 | uint8_t modDelayTick100ms(uint32_t *last, uint32_t ticks) {
41 | static uint32_t msTicks = 0;
42 |
43 | if(modDelayTick1ms(&msTicks,99))
44 | hmsCnt++;
45 |
46 | if((uint32_t)(hmsCnt - *last) >= ticks)
47 | {
48 | *last = hmsCnt;
49 | return true;
50 | }
51 |
52 | return false;
53 | }
54 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/delay.c.bak:
--------------------------------------------------------------------------------
1 | #include "delay.h"
2 |
3 | static uint32_t hmsCnt = 0;
4 |
5 | void modDelayInit(void) {
6 | SystemCoreClockUpdate();
7 |
8 | //SystemCoreClock / 1000
9 | if(SysTick_Config(SystemCoreClock / 1000)){
10 | while(1); //Error setting SysTick.
11 | }
12 | }
13 |
14 | uint8_t modDelayTick1ms(uint32_t *last, uint32_t ticks) {
15 | if((uint32_t)(HAL_GetTick() - *last) >= ticks)
16 | {
17 | *last = HAL_GetTick();
18 | return true;
19 | }
20 |
21 | return false;
22 | }
23 |
24 | uint8_t modDelayTick100ms(uint32_t *last, uint32_t ticks) {
25 | static uint32_t msTicks = 0;
26 |
27 | if(modDelayTick1ms(&msTicks,99))
28 | hmsCnt++;
29 |
30 | if((uint32_t)(hmsCnt - *last) >= ticks)
31 | {
32 | *last = hmsCnt;
33 | return true;
34 | }
35 |
36 | return false;
37 | }
38 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/delay.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #include "stm32g4xx_hal.h"
18 | #include "stdbool.h"
19 |
20 | void modDelayInit(void);
21 | uint8_t modDelayTick1ms(uint32_t *last, uint32_t ticks);
22 | uint8_t modDelayTick100ms(uint32_t *last, uint32_t ticks);
23 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/delay.h.bak:
--------------------------------------------------------------------------------
1 | #include "stm32g4xx_hal.h"
2 | #include "stdbool.h"
3 |
4 | void modDelayInit(void);
5 | uint8_t modDelayTick1ms(uint32_t *last, uint32_t ticks);
6 | uint8_t modDelayTick100ms(uint32_t *last, uint32_t ticks);
7 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/flash.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef SRC_FLASH_H_
19 | #define SRC_FLASH_H_
20 |
21 | #include "stm32g4xx_hal.h"
22 | #include "stdbool.h"
23 | #include "stdint.h"
24 |
25 | //#define FLASH_PAGES 100
26 | //#define BOOTLOADER_BASE 100
27 | //#define MAIN_APP_BASE 0
28 | //#define NEW_APP_BASE 50
29 | //#define NEW_APP_SECTORS 50
30 | //#define NEW_APP_MAX_SIZE (NEW_APP_SECTORS * (1 << 11))
31 |
32 | #define MAIN_BASE 0x08000000
33 | #define APP_BASE 0x0803d800
34 | #define EROM_BASE 0x0807b800
35 | #define BOOT_BASE 0x0807c000
36 |
37 |
38 |
39 | uint16_t modFlashEraseNewAppData(uint32_t new_app_size);
40 | uint16_t modFlashEraseMainAppData(uint32_t new_app_size);
41 | uint16_t modFlashWriteNewAppData(uint32_t offset, uint8_t *data, uint32_t len);
42 | uint16_t modFlashCopyNewAppToMainApp(uint64_t *data, uint32_t len);
43 | void modFlashJumpToBootloader(void);
44 | void modFlashJumpToMainApplication(void);
45 |
46 | #endif /* SRC_FLASH_H_ */
47 |
--------------------------------------------------------------------------------
/Open-SEC Bootloader/src/flash.h.bak:
--------------------------------------------------------------------------------
1 | /*
2 | * flash.h
3 | *
4 | * Created on: Jan 3, 2023
5 | * Author: Tjitte van der Ploeg
6 | */
7 |
8 | #ifndef SRC_FLASH_H_
9 | #define SRC_FLASH_H_
10 |
11 | #include "stm32g4xx_hal.h"
12 | #include "stdbool.h"
13 | #include "stdint.h"
14 |
15 | //#define FLASH_PAGES 100
16 | //#define BOOTLOADER_BASE 100
17 | //#define MAIN_APP_BASE 0
18 | //#define NEW_APP_BASE 50
19 | //#define NEW_APP_SECTORS 50
20 | //#define NEW_APP_MAX_SIZE (NEW_APP_SECTORS * (1 << 11))
21 |
22 | #define MAIN_BASE 0x08000000
23 | #define APP_BASE 0x0803d800
24 | #define EROM_BASE 0x0807b800
25 | #define BOOT_BASE 0x0807c000
26 |
27 |
28 |
29 | uint16_t modFlashEraseNewAppData(uint32_t new_app_size);
30 | uint16_t modFlashEraseMainAppData(uint32_t new_app_size);
31 | uint16_t modFlashWriteNewAppData(uint32_t offset, uint8_t *data, uint32_t len);
32 | uint16_t modFlashCopyNewAppToMainApp(uint64_t *data, uint32_t len);
33 | void modFlashJumpToBootloader(void);
34 | void modFlashJumpToMainApplication(void);
35 |
36 | #endif /* SRC_FLASH_H_ */
37 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | OpenSEC
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | com.st.stm32cube.ide.mcu.MCUProjectNature
23 | com.st.stm32cube.ide.mcu.MCUCubeProjectNature
24 | org.eclipse.cdt.core.cnature
25 | com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAProjectNature
26 | com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature
27 | com.st.stm32cube.ide.mcu.MCUEndUserDisabledTrustZoneProjectNature
28 | com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature
29 | com.st.stm32cube.ide.mcu.MCURootProjectNature
30 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
31 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
32 | com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/.settings/com.st.stm32cube.ide.mcu.sfrview.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | sfrviewstate={"fFavorites"\:{"fLists"\:{}},"fProperties"\:{"fNodeProperties"\:{}}}
3 | svd_custom_file_path=
4 | svd_file_path=platform\:/plugin/com.st.stm32cube.ide.mcu.productdb.debug/resources/cmsis/STMicroelectronics_CMSIS_SVD/STM32G474xx.svd
5 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/.settings/org.eclipse.cdt.core.prefs:
--------------------------------------------------------------------------------
1 | doxygen/doxygen_new_line_after_brief=true
2 | doxygen/doxygen_use_brief_tag=false
3 | doxygen/doxygen_use_javadoc_tags=true
4 | doxygen/doxygen_use_pre_tag=false
5 | doxygen/doxygen_use_structural_commands=false
6 | eclipse.preferences.version=1
7 | environment/project/com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1016973501/append=true
8 | environment/project/com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1016973501/appendContributed=true
9 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/.settings/stm32cubeide.project.prefs:
--------------------------------------------------------------------------------
1 | 2F62501ED4689FB349E356AB974DBE57=3A545B372CE90C56B1FEF884DC08D23B
2 | 8DF89ED150041C4CBC7CB9A9CAA90856=3A545B372CE90C56B1FEF884DC08D23B
3 | DC22A860405A8BF2F2C095E5B6529F12=B08EB0058EA743DEA2E87DFA9B1D6E90
4 | eclipse.preferences.version=1
5 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g474xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Open-SEC Firmware/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g474xx.h
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Open-SEC Firmware/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g4xx.h
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/CMSIS/Device/ST/STM32G4xx/Include/system_stm32g4xx.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32g4xx.h
4 | * @author MCD Application Team
5 | * @brief CMSIS Cortex-M4 Device System Source File for STM32G4xx devices.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /** @addtogroup CMSIS
21 | * @{
22 | */
23 |
24 | /** @addtogroup stm32g4xx_system
25 | * @{
26 | */
27 |
28 | /**
29 | * @brief Define to prevent recursive inclusion
30 | */
31 | #ifndef __SYSTEM_STM32G4XX_H
32 | #define __SYSTEM_STM32G4XX_H
33 |
34 | #ifdef __cplusplus
35 | extern "C" {
36 | #endif
37 |
38 | /** @addtogroup STM32G4xx_System_Includes
39 | * @{
40 | */
41 |
42 | /**
43 | * @}
44 | */
45 |
46 |
47 | /** @addtogroup STM32G4xx_System_Exported_Variables
48 | * @{
49 | */
50 | /* The SystemCoreClock variable is updated in three ways:
51 | 1) by calling CMSIS function SystemCoreClockUpdate()
52 | 2) by calling HAL API function HAL_RCC_GetSysClockFreq()
53 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
54 | Note: If you use this function to configure the system clock; then there
55 | is no need to call the 2 first functions listed above, since SystemCoreClock
56 | variable is updated automatically.
57 | */
58 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
59 |
60 | extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
61 | extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
62 |
63 | /**
64 | * @}
65 | */
66 |
67 | /** @addtogroup STM32G4xx_System_Exported_Constants
68 | * @{
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /** @addtogroup STM32G4xx_System_Exported_Macros
76 | * @{
77 | */
78 |
79 | /**
80 | * @}
81 | */
82 |
83 | /** @addtogroup STM32G4xx_System_Exported_Functions
84 | * @{
85 | */
86 |
87 | extern void SystemInit(void);
88 | extern void SystemCoreClockUpdate(void);
89 | /**
90 | * @}
91 | */
92 |
93 | #ifdef __cplusplus
94 | }
95 | #endif
96 |
97 | #endif /*__SYSTEM_STM32G4XX_H */
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | /**
104 | * @}
105 | */
106 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
107 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/CMSIS/Include/cmsis_version.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file cmsis_version.h
3 | * @brief CMSIS Core(M) Version definitions
4 | * @version V5.0.3
5 | * @date 24. June 2019
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2009-2019 ARM Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef __CMSIS_VERSION_H
32 | #define __CMSIS_VERSION_H
33 |
34 | /* CMSIS Version definitions */
35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
36 | #define __CM_CMSIS_VERSION_SUB ( 3U) /*!< [15:0] CMSIS Core(M) sub version */
37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
39 | #endif
40 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/CMSIS/Include/tz_context.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file tz_context.h
3 | * @brief Context Management for Armv8-M TrustZone
4 | * @version V1.0.1
5 | * @date 10. January 2018
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef TZ_CONTEXT_H
32 | #define TZ_CONTEXT_H
33 |
34 | #include
35 |
36 | #ifndef TZ_MODULEID_T
37 | #define TZ_MODULEID_T
38 | /// \details Data type that identifies secure software modules called by a process.
39 | typedef uint32_t TZ_ModuleId_t;
40 | #endif
41 |
42 | /// \details TZ Memory ID identifies an allocated memory slot.
43 | typedef uint32_t TZ_MemoryId_t;
44 |
45 | /// Initialize secure context memory system
46 | /// \return execution status (1: success, 0: error)
47 | uint32_t TZ_InitContextSystem_S (void);
48 |
49 | /// Allocate context memory for calling secure software modules in TrustZone
50 | /// \param[in] module identifies software modules called from non-secure mode
51 | /// \return value != 0 id TrustZone memory slot identifier
52 | /// \return value 0 no memory available or internal error
53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
54 |
55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
56 | /// \param[in] id TrustZone memory slot identifier
57 | /// \return execution status (1: success, 0: error)
58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
59 |
60 | /// Load secure context (called on RTOS thread context switch)
61 | /// \param[in] id TrustZone memory slot identifier
62 | /// \return execution status (1: success, 0: error)
63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
64 |
65 | /// Store secure context (called on RTOS thread context switch)
66 | /// \param[in] id TrustZone memory slot identifier
67 | /// \return execution status (1: success, 0: error)
68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
69 |
70 | #endif // TZ_CONTEXT_H
71 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Inc/stm32_assert_template.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32_assert.h
4 | * @author MCD Application Team
5 | * @brief STM32 assert template file.
6 | * This file should be copied to the application folder and renamed
7 | * to stm32_assert.h.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © Copyright (c) 2019 STMicroelectronics.
12 | * All rights reserved.
13 | *
14 | * This software component is licensed by ST under BSD 3-Clause license,
15 | * the "License"; You may not use this file except in compliance with the
16 | * License. You may obtain a copy of the License at:
17 | * opensource.org/licenses/BSD-3-Clause
18 | *
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef STM32_ASSERT_H
24 | #define STM32_ASSERT_H
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Exported types ------------------------------------------------------------*/
31 | /* Exported constants --------------------------------------------------------*/
32 | /* Includes ------------------------------------------------------------------*/
33 | /* Exported macro ------------------------------------------------------------*/
34 | #ifdef USE_FULL_ASSERT
35 | /**
36 | * @brief The assert_param macro is used for function's parameters check.
37 | * @param expr: If expr is false, it calls assert_failed function
38 | * which reports the name of the source file and the source
39 | * line number of the call that failed.
40 | * If expr is true, it returns no value.
41 | * @retval None
42 | */
43 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
44 | /* Exported functions ------------------------------------------------------- */
45 | void assert_failed(uint8_t *file, uint32_t line);
46 | #else
47 | #define assert_param(expr) ((void)0U)
48 | #endif /* USE_FULL_ASSERT */
49 |
50 | #ifdef __cplusplus
51 | }
52 | #endif
53 |
54 | #endif /* STM32_ASSERT_H */
55 |
56 |
57 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
58 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_cryp_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_cryp_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of CRYPEx HAL module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_CRYP_EX_H
22 | #define STM32G4xx_HAL_CRYP_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32G4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | #if defined(AES)
36 |
37 | /** @defgroup CRYPEx CRYPEx
38 | * @brief CRYP Extension HAL module driver.
39 | * @{
40 | */
41 |
42 | /* Exported types ------------------------------------------------------------*/
43 | /* Exported constants --------------------------------------------------------*/
44 | /* Private types -------------------------------------------------------------*/
45 | /** @defgroup CRYPEx_Private_Types CRYPEx Private Types
46 | * @{
47 | */
48 |
49 | /**
50 | * @}
51 | */
52 |
53 | /* Private variables ---------------------------------------------------------*/
54 | /** @defgroup CRYPEx_Private_Variables CRYPEx Private Variables
55 | * @{
56 | */
57 |
58 | /**
59 | * @}
60 | */
61 |
62 | /* Private constants ---------------------------------------------------------*/
63 | /** @defgroup CRYPEx_Private_Constants CRYPEx Private Constants
64 | * @{
65 | */
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | /* Private macros ------------------------------------------------------------*/
72 | /** @defgroup CRYPEx_Private_Macros CRYPEx Private Macros
73 | * @{
74 | */
75 |
76 | /**
77 | * @}
78 | */
79 |
80 | /* Private functions ---------------------------------------------------------*/
81 | /** @defgroup CRYPEx_Private_Functions CRYPEx Private Functions
82 | * @{
83 | */
84 |
85 | /**
86 | * @}
87 | */
88 |
89 | /* Exported functions --------------------------------------------------------*/
90 | /** @defgroup CRYPEx_Exported_Functions CRYPEx Exported Functions
91 | * @{
92 | */
93 |
94 | /** @addtogroup CRYPEx_Exported_Functions_Group1
95 | * @{
96 | */
97 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_GenerateAuthTAG(CRYP_HandleTypeDef *hcryp, uint32_t *AuthTag, uint32_t Timeout);
98 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_GenerateAuthTAG(CRYP_HandleTypeDef *hcryp, uint32_t *AuthTag, uint32_t Timeout);
99 |
100 | /**
101 | * @}
102 | */
103 |
104 | /** @addtogroup CRYPEx_Exported_Functions_Group2
105 | * @{
106 | */
107 | void HAL_CRYPEx_EnableAutoKeyDerivation(CRYP_HandleTypeDef *hcryp);
108 | void HAL_CRYPEx_DisableAutoKeyDerivation(CRYP_HandleTypeDef *hcryp);
109 |
110 | /**
111 | * @}
112 | */
113 |
114 | /**
115 | * @}
116 | */
117 |
118 | /**
119 | * @}
120 | */
121 | #endif /* AES */
122 |
123 | /**
124 | * @}
125 | */
126 |
127 | #ifdef __cplusplus
128 | }
129 | #endif
130 |
131 | #endif /* STM32G4xx_HAL_CRYP_EX_H */
132 |
133 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
134 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_flash_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_flash_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of FLASH HAL Extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2019 STMicroelectronics
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef STM32G4xx_HAL_FLASH_EX_H
21 | #define STM32G4xx_HAL_FLASH_EX_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "stm32g4xx_hal_def.h"
29 |
30 | /** @addtogroup STM32G4xx_HAL_Driver
31 | * @{
32 | */
33 |
34 | /** @addtogroup FLASHEx
35 | * @{
36 | */
37 |
38 | /* Exported types ------------------------------------------------------------*/
39 |
40 | /* Exported constants --------------------------------------------------------*/
41 |
42 | /* Exported macro ------------------------------------------------------------*/
43 |
44 | /* Exported functions --------------------------------------------------------*/
45 | /** @addtogroup FLASHEx_Exported_Functions
46 | * @{
47 | */
48 |
49 | /* Extended Program operation functions *************************************/
50 | /** @addtogroup FLASHEx_Exported_Functions_Group1
51 | * @{
52 | */
53 | HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError);
54 | HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit);
55 | HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit);
56 | void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit);
57 | HAL_StatusTypeDef HAL_FLASHEx_EnableSecMemProtection(uint32_t Bank);
58 | void HAL_FLASHEx_EnableDebugger(void);
59 | void HAL_FLASHEx_DisableDebugger(void);
60 | /**
61 | * @}
62 | */
63 |
64 | /**
65 | * @}
66 | */
67 |
68 | /** @addtogroup FLASHEx_Private_Functions
69 | * @{
70 | */
71 | void FLASH_PageErase(uint32_t Page, uint32_t Banks);
72 | void FLASH_FlushCaches(void);
73 | /**
74 | * @}
75 | */
76 |
77 | /**
78 | * @}
79 | */
80 |
81 | /**
82 | * @}
83 | */
84 |
85 | #ifdef __cplusplus
86 | }
87 | #endif
88 |
89 | #endif /* STM32G4xx_HAL_FLASH_EX_H */
90 |
91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
92 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_flash_ramfunc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_flash_ramfunc.h
4 | * @author MCD Application Team
5 | * @brief Header file of FLASH RAMFUNC driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2019 STMicroelectronics
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef STM32G4xx_FLASH_RAMFUNC_H
21 | #define STM32G4xx_FLASH_RAMFUNC_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "stm32g4xx_hal_def.h"
29 |
30 | /** @addtogroup STM32G4xx_HAL_Driver
31 | * @{
32 | */
33 |
34 | /** @addtogroup FLASH_RAMFUNC
35 | * @{
36 | */
37 |
38 | /* Exported types ------------------------------------------------------------*/
39 | /* Exported macro ------------------------------------------------------------*/
40 | /* Exported functions --------------------------------------------------------*/
41 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions
42 | * @{
43 | */
44 |
45 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1
46 | * @{
47 | */
48 | /* Peripheral Control functions ************************************************/
49 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableRunPowerDown(void);
50 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableRunPowerDown(void);
51 | #if defined (FLASH_OPTR_DBANK)
52 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_OB_DBankConfig(uint32_t DBankConfig);
53 | #endif
54 | /**
55 | * @}
56 | */
57 |
58 | /**
59 | * @}
60 | */
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | /**
67 | * @}
68 | */
69 |
70 | #ifdef __cplusplus
71 | }
72 | #endif
73 |
74 | #endif /* STM32G4xx_FLASH_RAMFUNC_H */
75 |
76 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
77 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_opamp_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_opamp_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of OPAMP HAL Extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_OPAMP_EX_H
22 | #define STM32G4xx_HAL_OPAMP_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32G4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | /** @addtogroup OPAMPEx OPAMPEx
36 | * @{
37 | */
38 | /* Exported types ------------------------------------------------------------*/
39 | /* Exported constants --------------------------------------------------------*/
40 | /* Exported macro ------------------------------------------------------------*/
41 | /* Exported functions --------------------------------------------------------*/
42 | /** @addtogroup OPAMPEx_Exported_Functions OPAMP Extended Exported Functions
43 | * @{
44 | */
45 |
46 | /** @addtogroup OPAMPEx_Exported_Functions_Group1 Extended Input and Output operation functions
47 | * @{
48 | */
49 |
50 | /* I/O operation functions *****************************************************/
51 |
52 | #if defined(STM32G473xx) || defined(STM32G474xx) || defined(STM32G483xx) || defined(STM32G484xx)
53 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2,
54 | OPAMP_HandleTypeDef *hopamp3, OPAMP_HandleTypeDef *hopamp4, OPAMP_HandleTypeDef *hopamp5, OPAMP_HandleTypeDef *hopamp6);
55 | #elif defined(STM32GBK1CB) || defined(STM32G431xx) || defined(STM32G441xx) || defined(STM32G471xx)
56 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2,
57 | OPAMP_HandleTypeDef *hopamp3);
58 | #elif defined(STM32G491xx) || defined(STM32G4A1xx)
59 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2,
60 | OPAMP_HandleTypeDef *hopamp3, OPAMP_HandleTypeDef *hopamp6);
61 | #endif
62 |
63 | /**
64 | * @}
65 | */
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /**
76 | * @}
77 | */
78 |
79 |
80 | #ifdef __cplusplus
81 | }
82 | #endif
83 |
84 |
85 | #endif /* STM32G4xx_HAL_OPAMP_EX_H */
86 |
87 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
88 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_pcd_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_pcd_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of PCD HAL Extension module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_PCD_EX_H
22 | #define STM32G4xx_HAL_PCD_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | #if defined (USB)
32 | /** @addtogroup STM32G4xx_HAL_Driver
33 | * @{
34 | */
35 |
36 | /** @addtogroup PCDEx
37 | * @{
38 | */
39 | /* Exported types ------------------------------------------------------------*/
40 | /* Exported constants --------------------------------------------------------*/
41 | /* Exported macros -----------------------------------------------------------*/
42 | /* Exported functions --------------------------------------------------------*/
43 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions
44 | * @{
45 | */
46 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
47 | * @{
48 | */
49 |
50 |
51 |
52 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr,
53 | uint16_t ep_kind, uint32_t pmaadress);
54 |
55 |
56 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd);
57 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd);
58 |
59 |
60 | HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd);
61 | HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd);
62 | void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd);
63 |
64 | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg);
65 | void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg);
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /**
76 | * @}
77 | */
78 |
79 | /**
80 | * @}
81 | */
82 | #endif /* defined (USB) */
83 |
84 | #ifdef __cplusplus
85 | }
86 | #endif
87 |
88 |
89 | #endif /* STM32G4xx_HAL_PCD_EX_H */
90 |
91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
92 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_sai_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_sai_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of SAI HAL extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_SAI_EX_H
22 | #define STM32G4xx_HAL_SAI_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32G4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | /** @addtogroup SAIEx
36 | * @{
37 | */
38 |
39 | /* Exported types ------------------------------------------------------------*/
40 | /** @defgroup SAIEx_Exported_Types SAIEx Exported Types
41 | * @{
42 | */
43 |
44 | /**
45 | * @brief PDM microphone delay structure definition
46 | */
47 | typedef struct
48 | {
49 | uint32_t MicPair; /*!< Specifies which pair of microphones is selected.
50 | This parameter must be a number between Min_Data = 1 and Max_Data = 3. */
51 |
52 | uint32_t LeftDelay; /*!< Specifies the delay in PDM clock unit to apply on left microphone.
53 | This parameter must be a number between Min_Data = 0 and Max_Data = 7. */
54 |
55 | uint32_t RightDelay; /*!< Specifies the delay in PDM clock unit to apply on right microphone.
56 | This parameter must be a number between Min_Data = 0 and Max_Data = 7. */
57 | } SAIEx_PdmMicDelayParamTypeDef;
58 |
59 | /**
60 | * @}
61 | */
62 |
63 | /* Exported constants --------------------------------------------------------*/
64 | /* Exported macros -----------------------------------------------------------*/
65 | /* Exported functions --------------------------------------------------------*/
66 | /** @addtogroup SAIEx_Exported_Functions SAIEx Extended Exported Functions
67 | * @{
68 | */
69 |
70 | /** @addtogroup SAIEx_Exported_Functions_Group1 Peripheral Control functions
71 | * @{
72 | */
73 | HAL_StatusTypeDef HAL_SAIEx_ConfigPdmMicDelay(SAI_HandleTypeDef *hsai, SAIEx_PdmMicDelayParamTypeDef *pdmMicDelay);
74 | /**
75 | * @}
76 | */
77 |
78 | /**
79 | * @}
80 | */
81 |
82 | /* Private macros ------------------------------------------------------------*/
83 | /** @addtogroup SAIEx_Private_Macros SAIEx Extended Private Macros
84 | * @{
85 | */
86 | #define IS_SAI_PDM_MIC_DELAY(VALUE) ((VALUE) <= 7U)
87 | /**
88 | * @}
89 | */
90 |
91 | /**
92 | * @}
93 | */
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | #ifdef __cplusplus
100 | }
101 | #endif
102 |
103 | #endif /* STM32G4xx_HAL_SAI_EX_H */
104 |
105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
106 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_spi_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_spi_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of SPI HAL Extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_SPI_EX_H
22 | #define STM32G4xx_HAL_SPI_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32G4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | /** @addtogroup SPIEx
36 | * @{
37 | */
38 |
39 | /* Exported types ------------------------------------------------------------*/
40 | /* Exported constants --------------------------------------------------------*/
41 | /* Exported macros -----------------------------------------------------------*/
42 | /* Exported functions --------------------------------------------------------*/
43 | /** @addtogroup SPIEx_Exported_Functions
44 | * @{
45 | */
46 |
47 | /* Initialization and de-initialization functions ****************************/
48 | /* IO operation functions *****************************************************/
49 | /** @addtogroup SPIEx_Exported_Functions_Group1
50 | * @{
51 | */
52 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi);
53 | /**
54 | * @}
55 | */
56 |
57 | /**
58 | * @}
59 | */
60 |
61 | /**
62 | * @}
63 | */
64 |
65 | /**
66 | * @}
67 | */
68 |
69 | #ifdef __cplusplus
70 | }
71 | #endif
72 |
73 | #endif /* STM32G4xx_HAL_SPI_EX_H */
74 |
75 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
76 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/License.md:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2017 STMicroelectronics
2 |
3 | This software component is licensed by STMicroelectronics under the **BSD 3-Clause** license. You may not use this file except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_spi_ex.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_spi_ex.c
4 | * @author MCD Application Team
5 | * @brief Extended SPI HAL module driver.
6 | * This file provides firmware functions to manage the following
7 | * SPI peripheral extended functionalities :
8 | * + IO operation functions
9 | *
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * © Copyright (c) 2019 STMicroelectronics.
14 | * All rights reserved.
15 | *
16 | * This software component is licensed by ST under BSD 3-Clause license,
17 | * the "License"; You may not use this file except in compliance with the
18 | * License. You may obtain a copy of the License at:
19 | * opensource.org/licenses/BSD-3-Clause
20 | *
21 | ******************************************************************************
22 | */
23 |
24 | /* Includes ------------------------------------------------------------------*/
25 | #include "stm32g4xx_hal.h"
26 |
27 | /** @addtogroup STM32G4xx_HAL_Driver
28 | * @{
29 | */
30 |
31 | /** @defgroup SPIEx SPIEx
32 | * @brief SPI Extended HAL module driver
33 | * @{
34 | */
35 | #ifdef HAL_SPI_MODULE_ENABLED
36 |
37 | /* Private typedef -----------------------------------------------------------*/
38 | /* Private defines -----------------------------------------------------------*/
39 | /** @defgroup SPIEx_Private_Constants SPIEx Private Constants
40 | * @{
41 | */
42 | #define SPI_FIFO_SIZE 4UL
43 | /**
44 | * @}
45 | */
46 |
47 | /* Private macros ------------------------------------------------------------*/
48 | /* Private variables ---------------------------------------------------------*/
49 | /* Private function prototypes -----------------------------------------------*/
50 | /* Exported functions --------------------------------------------------------*/
51 |
52 | /** @defgroup SPIEx_Exported_Functions SPIEx Exported Functions
53 | * @{
54 | */
55 |
56 | /** @defgroup SPIEx_Exported_Functions_Group1 IO operation functions
57 | * @brief Data transfers functions
58 | *
59 | @verbatim
60 | ==============================================================================
61 | ##### IO operation functions #####
62 | ===============================================================================
63 | [..]
64 | This subsection provides a set of extended functions to manage the SPI
65 | data transfers.
66 |
67 | (#) Rx data flush function:
68 | (++) HAL_SPIEx_FlushRxFifo()
69 |
70 | @endverbatim
71 | * @{
72 | */
73 |
74 | /**
75 | * @brief Flush the RX fifo.
76 | * @param hspi pointer to a SPI_HandleTypeDef structure that contains
77 | * the configuration information for the specified SPI module.
78 | * @retval HAL status
79 | */
80 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi)
81 | {
82 | __IO uint32_t tmpreg;
83 | uint8_t count = 0U;
84 | while ((hspi->Instance->SR & SPI_FLAG_FRLVL) != SPI_FRLVL_EMPTY)
85 | {
86 | count++;
87 | tmpreg = hspi->Instance->DR;
88 | UNUSED(tmpreg); /* To avoid GCC warning */
89 | if (count == SPI_FIFO_SIZE)
90 | {
91 | return HAL_TIMEOUT;
92 | }
93 | }
94 | return HAL_OK;
95 | }
96 |
97 | /**
98 | * @}
99 | */
100 |
101 | /**
102 | * @}
103 | */
104 |
105 | #endif /* HAL_SPI_MODULE_ENABLED */
106 |
107 | /**
108 | * @}
109 | */
110 |
111 | /**
112 | * @}
113 | */
114 |
115 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
116 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_wwdg.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_wwdg.c
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_cordic.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_cordic.c
4 | * @author MCD Application Team
5 | * @brief CORDIC LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_cordic.h"
23 | #include "stm32g4xx_ll_bus.h"
24 | #ifdef USE_FULL_ASSERT
25 | #include "stm32_assert.h"
26 | #else
27 | #define assert_param(expr) ((void)0U)
28 | #endif /* USE_FULL_ASSERT */
29 |
30 | /** @addtogroup STM32G4xx_LL_Driver
31 | * @{
32 | */
33 |
34 | #if defined(CORDIC)
35 |
36 | /** @addtogroup CORDIC_LL
37 | * @{
38 | */
39 |
40 | /* Private types -------------------------------------------------------------*/
41 | /* Private variables ---------------------------------------------------------*/
42 | /* Private constants ---------------------------------------------------------*/
43 | /* Private macros ------------------------------------------------------------*/
44 | /* Private function prototypes -----------------------------------------------*/
45 |
46 | /* Exported functions --------------------------------------------------------*/
47 | /** @addtogroup CORDIC_LL_Exported_Functions
48 | * @{
49 | */
50 |
51 | /** @addtogroup CORDIC_LL_EF_Init
52 | * @{
53 | */
54 |
55 | /**
56 | * @brief De-Initialize CORDIC peripheral registers to their default reset values.
57 | * @param CORDICx CORDIC Instance
58 | * @retval An ErrorStatus enumeration value:
59 | * - SUCCESS: CORDIC registers are de-initialized
60 | * - ERROR: CORDIC registers are not de-initialized
61 | */
62 | ErrorStatus LL_CORDIC_DeInit(CORDIC_TypeDef *CORDICx)
63 | {
64 | ErrorStatus status = SUCCESS;
65 |
66 | /* Check the parameters */
67 | assert_param(IS_CORDIC_ALL_INSTANCE(CORDICx));
68 |
69 | if (CORDICx == CORDIC)
70 | {
71 | /* Force CORDIC reset */
72 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_CORDIC);
73 |
74 | /* Release CORDIC reset */
75 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_CORDIC);
76 | }
77 | else
78 | {
79 | status = ERROR;
80 | }
81 |
82 | return (status);
83 | }
84 |
85 | /**
86 | * @}
87 | */
88 |
89 | /**
90 | * @}
91 | */
92 |
93 | /**
94 | * @}
95 | */
96 |
97 | #endif /* defined(CORDIC) */
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | #endif /* USE_FULL_LL_DRIVER */
104 |
105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
106 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_crc.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_crc.c
4 | * @author MCD Application Team
5 | * @brief CRC LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_crc.h"
23 | #include "stm32g4xx_ll_bus.h"
24 |
25 | #ifdef USE_FULL_ASSERT
26 | #include "stm32_assert.h"
27 | #else
28 | #define assert_param(expr) ((void)0U)
29 | #endif
30 |
31 | /** @addtogroup STM32G4xx_LL_Driver
32 | * @{
33 | */
34 |
35 | #if defined (CRC)
36 |
37 | /** @addtogroup CRC_LL
38 | * @{
39 | */
40 |
41 | /* Private types -------------------------------------------------------------*/
42 | /* Private variables ---------------------------------------------------------*/
43 | /* Private constants ---------------------------------------------------------*/
44 | /* Private macros ------------------------------------------------------------*/
45 | /* Private function prototypes -----------------------------------------------*/
46 |
47 | /* Exported functions --------------------------------------------------------*/
48 | /** @addtogroup CRC_LL_Exported_Functions
49 | * @{
50 | */
51 |
52 | /** @addtogroup CRC_LL_EF_Init
53 | * @{
54 | */
55 |
56 | /**
57 | * @brief De-initialize CRC registers (Registers restored to their default values).
58 | * @param CRCx CRC Instance
59 | * @retval An ErrorStatus enumeration value:
60 | * - SUCCESS: CRC registers are de-initialized
61 | * - ERROR: CRC registers are not de-initialized
62 | */
63 | ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx)
64 | {
65 | ErrorStatus status = SUCCESS;
66 |
67 | /* Check the parameters */
68 | assert_param(IS_CRC_ALL_INSTANCE(CRCx));
69 |
70 | if (CRCx == CRC)
71 | {
72 | /* Force CRC reset */
73 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_CRC);
74 |
75 | /* Release CRC reset */
76 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_CRC);
77 | }
78 | else
79 | {
80 | status = ERROR;
81 | }
82 |
83 | return (status);
84 | }
85 |
86 | /**
87 | * @}
88 | */
89 |
90 | /**
91 | * @}
92 | */
93 |
94 | /**
95 | * @}
96 | */
97 |
98 | #endif /* defined (CRC) */
99 |
100 | /**
101 | * @}
102 | */
103 |
104 | #endif /* USE_FULL_LL_DRIVER */
105 |
106 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
107 |
108 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_crs.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_crs.h
4 | * @author MCD Application Team
5 | * @brief CRS LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2018 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_crs.h"
23 | #include "stm32g4xx_ll_bus.h"
24 |
25 | /** @addtogroup STM32G4xx_LL_Driver
26 | * @{
27 | */
28 |
29 | #if defined(CRS)
30 |
31 | /** @defgroup CRS_LL CRS
32 | * @{
33 | */
34 |
35 | /* Private types -------------------------------------------------------------*/
36 | /* Private variables ---------------------------------------------------------*/
37 | /* Private constants ---------------------------------------------------------*/
38 | /* Private macros ------------------------------------------------------------*/
39 | /* Private function prototypes -----------------------------------------------*/
40 |
41 | /* Exported functions --------------------------------------------------------*/
42 | /** @addtogroup CRS_LL_Exported_Functions
43 | * @{
44 | */
45 |
46 | /** @addtogroup CRS_LL_EF_Init
47 | * @{
48 | */
49 |
50 | /**
51 | * @brief De-Initializes CRS peripheral registers to their default reset values.
52 | * @retval An ErrorStatus enumeration value:
53 | * - SUCCESS: CRS registers are de-initialized
54 | * - ERROR: not applicable
55 | */
56 | ErrorStatus LL_CRS_DeInit(void)
57 | {
58 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_CRS);
59 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_CRS);
60 |
61 | return SUCCESS;
62 | }
63 |
64 |
65 |
66 | /**
67 | * @}
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | /**
75 | * @}
76 | */
77 |
78 | #endif /* defined(CRS) */
79 |
80 | /**
81 | * @}
82 | */
83 |
84 | #endif /* USE_FULL_LL_DRIVER */
85 |
86 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
87 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_fmac.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_fmac.c
4 | * @author MCD Application Team
5 | * @brief Header for stm32g4xx_ll_fmac.c module
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_fmac.h"
23 | #include "stm32g4xx_ll_bus.h"
24 | #ifdef USE_FULL_ASSERT
25 | #include "stm32_assert.h"
26 | #else
27 | #define assert_param(expr) ((void)0U)
28 | #endif /* USE_FULL_ASSERT */
29 |
30 | /** @addtogroup STM32G4xx_LL_Driver
31 | * @{
32 | */
33 |
34 | #if defined(FMAC)
35 |
36 | /** @addtogroup FMAC_LL
37 | * @{
38 | */
39 |
40 | /* Private typedef -----------------------------------------------------------*/
41 | /* Private defines -----------------------------------------------------------*/
42 | /* Private macros ------------------------------------------------------------*/
43 | /* Private variables ---------------------------------------------------------*/
44 | /* Global variables ----------------------------------------------------------*/
45 | /* Private function prototypes -----------------------------------------------*/
46 | /* Functions Definition ------------------------------------------------------*/
47 | /** @addtogroup FMAC_LL_Exported_Functions
48 | * @{
49 | */
50 |
51 | /** @addtogroup FMAC_LL_EF_Init
52 | * @{
53 | */
54 |
55 | /**
56 | * @brief Initialize FMAC peripheral registers to their default reset values.
57 | * @param FMACx FMAC Instance
58 | * @retval ErrorStatus enumeration value:
59 | * - SUCCESS: FMAC registers are initialized
60 | * - ERROR: FMAC registers are not initialized
61 | */
62 | ErrorStatus LL_FMAC_Init(FMAC_TypeDef *FMACx)
63 | {
64 | ErrorStatus status = SUCCESS;
65 |
66 | /* Check the parameters */
67 | assert_param(IS_FMAC_ALL_INSTANCE(FMACx));
68 |
69 | if (FMACx == FMAC)
70 | {
71 | /* Perform the reset */
72 | LL_FMAC_EnableReset(FMACx);
73 |
74 | /* Wait until flag is reset */
75 | while (LL_FMAC_IsEnabledReset(FMACx) != 0UL)
76 | {
77 | }
78 | }
79 | else
80 | {
81 | status = ERROR;
82 | }
83 |
84 | return (status);
85 | }
86 |
87 | /**
88 | * @brief De-Initialize FMAC peripheral registers to their default reset values.
89 | * @param FMACx FMAC Instance
90 | * @retval An ErrorStatus enumeration value:
91 | * - SUCCESS: FMAC registers are de-initialized
92 | * - ERROR: FMAC registers are not de-initialized
93 | */
94 | ErrorStatus LL_FMAC_DeInit(FMAC_TypeDef *FMACx)
95 | {
96 | ErrorStatus status = SUCCESS;
97 |
98 | /* Check the parameters */
99 | assert_param(IS_FMAC_ALL_INSTANCE(FMACx));
100 |
101 | if (FMACx == FMAC)
102 | {
103 | /* Force FMAC reset */
104 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_FMAC);
105 |
106 | /* Release FMAC reset */
107 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_FMAC);
108 | }
109 | else
110 | {
111 | status = ERROR;
112 | }
113 |
114 | return (status);
115 | }
116 |
117 |
118 |
119 | /**
120 | * @}
121 | */
122 |
123 | /**
124 | * @}
125 | */
126 |
127 | /**
128 | * @}
129 | */
130 |
131 | #endif /* defined(FMAC) */
132 |
133 | /**
134 | * @}
135 | */
136 |
137 | #endif /* USE_FULL_LL_DRIVER */
138 |
139 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
140 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_hrtim.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_hrtim.c
4 | * @author MCD Application Team
5 | * @brief HRTIM LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_hrtim.h"
23 | #include "stm32g4xx_ll_bus.h"
24 |
25 | #ifdef USE_FULL_ASSERT
26 | #include "stm32_assert.h"
27 | #else
28 | #define assert_param(expr) ((void)0U)
29 | #endif
30 |
31 | /** @addtogroup STM32G4xx_LL_Driver
32 | * @{
33 | */
34 |
35 | #if defined (HRTIM1)
36 |
37 | /** @addtogroup HRTIM_LL
38 | * @{
39 | */
40 |
41 | /* Private types -------------------------------------------------------------*/
42 | /* Private variables ---------------------------------------------------------*/
43 | /* Private constants ---------------------------------------------------------*/
44 | /* Private macros ------------------------------------------------------------*/
45 | /* Private function prototypes -----------------------------------------------*/
46 | /* Exported functions --------------------------------------------------------*/
47 | /** @addtogroup HRTIM_LL_Exported_Functions
48 | * @{
49 | */
50 | /**
51 | * @brief Set HRTIM instance registers to their reset values.
52 | * @param HRTIMx High Resolution Timer instance
53 | * @retval ErrorStatus enumeration value:
54 | * - SUCCESS: HRTIMx registers are de-initialized
55 | * - ERROR: invalid HRTIMx instance
56 | */
57 | ErrorStatus LL_HRTIM_DeInit(HRTIM_TypeDef *HRTIMx)
58 | {
59 | ErrorStatus result = SUCCESS;
60 |
61 | /* Check the parameters */
62 | assert_param(IS_HRTIM_ALL_INSTANCE(HRTIMx));
63 | LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_HRTIM1);
64 | LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_HRTIM1);
65 | return result;
66 | }
67 | /**
68 | * @}
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | #endif /* HRTIM1 */
76 |
77 | /**
78 | * @}
79 | */
80 |
81 | #endif /* USE_FULL_LL_DRIVER */
82 |
83 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
84 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_ll_pwr.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_ll_pwr.c
4 | * @author MCD Application Team
5 | * @brief PWR LL module driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2019 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | #if defined(USE_FULL_LL_DRIVER)
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32g4xx_ll_pwr.h"
23 | #include "stm32g4xx_ll_bus.h"
24 |
25 | /** @addtogroup STM32G4xx_LL_Driver
26 | * @{
27 | */
28 |
29 | #if defined(PWR)
30 |
31 | /** @defgroup PWR_LL PWR
32 | * @{
33 | */
34 |
35 | /* Private types -------------------------------------------------------------*/
36 | /* Private variables ---------------------------------------------------------*/
37 | /* Private constants ---------------------------------------------------------*/
38 | /* Private macros ------------------------------------------------------------*/
39 | /* Private function prototypes -----------------------------------------------*/
40 |
41 | /* Exported functions --------------------------------------------------------*/
42 | /** @addtogroup PWR_LL_Exported_Functions
43 | * @{
44 | */
45 |
46 | /** @addtogroup PWR_LL_EF_Init
47 | * @{
48 | */
49 |
50 | /**
51 | * @brief De-initialize the PWR registers to their default reset values.
52 | * @retval An ErrorStatus enumeration value:
53 | * - SUCCESS: PWR registers are de-initialized
54 | * - ERROR: not applicable
55 | */
56 | ErrorStatus LL_PWR_DeInit(void)
57 | {
58 | /* Force reset of PWR clock */
59 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_PWR);
60 |
61 | /* Release reset of PWR clock */
62 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_PWR);
63 |
64 | return SUCCESS;
65 | }
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /**
76 | * @}
77 | */
78 | #endif /* defined(PWR) */
79 | /**
80 | * @}
81 | */
82 |
83 | #endif /* USE_FULL_LL_DRIVER */
84 |
85 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
86 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/analog.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2021 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The OpenBoost firmware firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The VESC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #ifndef ANALOG_H_
18 | #define ANALOG_H_
19 |
20 | #include "hardware.h"
21 |
22 | uint32_t adc5data[6];
23 |
24 | void analog_init(void);
25 |
26 |
27 | #endif /* ANALOG_H_ */
28 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/buffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 Benjamin Vedder benjamin@vedder.se
3 |
4 | This file is part of the VESC firmware.
5 |
6 | The VESC firmware is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | The VESC firmware is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #ifndef BUFFER_H_
21 | #define BUFFER_H_
22 |
23 | #include
24 |
25 | void buffer_append_str(uint8_t* buffer, char* str, int len, int32_t *index);
26 | void buffer_append_int8(uint8_t* buffer, int8_t number, int32_t *index);
27 | void buffer_append_uint8(uint8_t* buffer, uint8_t number, int32_t *index);
28 | void buffer_append_int16(uint8_t* buffer, int16_t number, int32_t *index);
29 | void buffer_append_uint16(uint8_t* buffer, uint16_t number, int32_t *index);
30 | void buffer_append_int32(uint8_t* buffer, int32_t number, int32_t *index);
31 | void buffer_append_uint32(uint8_t* buffer, uint32_t number, int32_t *index);
32 | void buffer_append_float16(uint8_t* buffer, float number, float scale, int32_t *index);
33 | void buffer_append_float32(uint8_t* buffer, float number, float scale, int32_t *index);
34 | void buffer_append_float32_auto(uint8_t* buffer, float number, int32_t *index);
35 | int8_t buffer_get_int8(const uint8_t *buffer, int32_t *index);
36 | uint8_t buffer_get_uint8(const uint8_t *buffer, int32_t *index);
37 | int16_t buffer_get_int16(const uint8_t *buffer, int32_t *index);
38 | uint16_t buffer_get_uint16(const uint8_t *buffer, int32_t *index);
39 | int32_t buffer_get_int32(const uint8_t *buffer, int32_t *index);
40 | uint32_t buffer_get_uint32(const uint8_t *buffer, int32_t *index);
41 | float buffer_get_float16(const uint8_t *buffer, float scale, int32_t *index);
42 | float buffer_get_float32(const uint8_t *buffer, float scale, int32_t *index);
43 | float buffer_get_float32_auto(const uint8_t *buffer, int32_t *index);
44 |
45 | #endif /* BUFFER_H_ */
46 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/can.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #ifndef SRC_CAN_H_
18 | #define SRC_CAN_H_
19 |
20 | #include "hardware.h"
21 | #include "stdbool.h"
22 | #include "string.h"
23 | #include "delay.h"
24 | #include "crc.h"
25 | #include "packet.h"
26 | #include "buffer.h"
27 | #include "control.h"
28 | #include "mppt.h"
29 |
30 |
31 |
32 | // Settings
33 | #define CAN_STATUS_MSG_INT_MS 1
34 | #define RX_CAN_FRAMES_SIZE 255 // max 255
35 | #define RX_CAN_BUFFER_SIZE PACKET_MAX_PL_LEN
36 |
37 | typedef enum {
38 | CAN_PACKET_Power,
39 | CAN_PACKET_status, //(Limitl, Fault, Temperatures,)
40 | CAN_PACKET_Sweep,
41 | CAN_PACKET_FILL_RX_BUFFER = 0x05,
42 | CAN_PACKET_FILL_RX_BUFFER_LONG,
43 | CAN_PACKET_PROCESS_RX_BUFFER,
44 | CAN_PACKET_PROCESS_SHORT_BUFFER,
45 |
46 | //TODO Add can interface commands here
47 | CAN_CMD_SETMODE,
48 | CAN_CMD_SWEEP,
49 | CAN_PACKET_MSGCOUNT,
50 | } CAN_PACKET_ID;
51 |
52 | typedef struct modCanSettings_t {
53 | int baudrate;
54 | float samplepoint;
55 | uint16_t generalCanId;
56 | } modCanSettings_t;
57 |
58 | void modCANinit(modCanSettings_t *s);
59 | void modCANtask(void);
60 |
61 | uint32_t modCANGetDestinationID(FDCAN_RxHeaderTypeDef canMsg);
62 | CAN_PACKET_ID modCANGetPacketID(FDCAN_RxHeaderTypeDef canMsg);
63 |
64 | uint32_t modCANGetCANEXID(uint32_t destinationID, CAN_PACKET_ID packetID);
65 | uint32_t modCANGetCANID(uint32_t destinationID, CAN_PACKET_ID packetID);
66 |
67 | void modCANTransmitExtID(uint32_t id, uint8_t *data, uint8_t len);
68 | void modCANTransmitStandardID(uint32_t id, uint8_t *data, uint8_t len);
69 | void modCANSendBuffer(uint8_t controllerID, uint8_t *data, unsigned int len, bool send);
70 | void modCANSendPacketWrapper(unsigned char *data, unsigned int len);
71 | void modCANSendSweep(float* is, float*vs, int size);
72 |
73 | #endif /* SRC_CAN_H_ */
74 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/commands.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 Benjamin Vedder benjamin@vedder.se
3 |
4 | This file is part of the VESC firmware.
5 |
6 | The VESC firmware is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | The VESC firmware is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #ifndef COMMANDS_H_
21 | #define COMMANDS_H_
22 |
23 |
24 | #include "buffer.h"
25 | #include "terminal.h"
26 | #include "config.h"
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include "can.h"
33 |
34 | // Communication commands
35 | typedef enum {
36 | COMM_FW_VERSION = 0,
37 | COMM_JUMP_TO_BOOTLOADER,
38 | COMM_ERASE_NEW_APP,
39 | COMM_WRITE_NEW_APP_DATA,
40 | COMM_GET_VALUES,
41 | COMM_SET_DUTY,
42 | COMM_SET_CURRENT,
43 | COMM_SET_CURRENT_BRAKE,
44 | COMM_SET_RPM,
45 | COMM_SET_POS,
46 | COMM_SET_HANDBRAKE,
47 | COMM_SET_DETECT,
48 | COMM_SET_SERVO_POS,
49 | COMM_SET_MCCONF,
50 | COMM_GET_MCCONF,
51 | COMM_GET_MCCONF_DEFAULT,
52 | COMM_SET_APPCONF,
53 | COMM_GET_APPCONF,
54 | COMM_GET_APPCONF_DEFAULT,
55 | COMM_SAMPLE_PRINT,
56 | COMM_TERMINAL_CMD,
57 | COMM_PRINT,
58 | COMM_ROTOR_POSITION,
59 | COMM_EXPERIMENT_SAMPLE,
60 | COMM_DETECT_MOTOR_PARAM,
61 | COMM_DETECT_MOTOR_R_L,
62 | COMM_DETECT_MOTOR_FLUX_LINKAGE,
63 | COMM_DETECT_ENCODER,
64 | COMM_DETECT_HALL_FOC,
65 | COMM_REBOOT,
66 | COMM_ALIVE,
67 | COMM_GET_DECODED_PPM,
68 | COMM_GET_DECODED_ADC,
69 | COMM_GET_DECODED_CHUK,
70 | COMM_FORWARD_CAN,
71 | COMM_SET_CHUCK_DATA,
72 | COMM_CUSTOM_APP_DATA,
73 | COMM_NRF_START_PAIRING,
74 |
75 | COMM_STORE_MPPT_CONF = 50,
76 |
77 | COMM_WRITE_CALDATA = 75,
78 | COMM_READ_CALDATA,
79 |
80 | CONM_MPPT_GET_SWEEP=100,
81 | CONM_MPPT_SetMode,
82 | CONM_MPPT_SetOutputVoltage,
83 | CONM_MPPT_SetOutputCurrent,
84 | CONM_MPPT_SetInputCurrent,
85 | CONM_MPPT_SetInputVoltage,
86 | COMM_MPPT_SCOPE_RUN,
87 | COMM_MPPT_SCOPE_STEP,
88 | COMM_MPPT_SCOPE_GET_DATA,
89 | COMM_MPPT_SCOPE_DATAREADY,
90 |
91 | } COMM_PACKET_ID;
92 |
93 | // Functions
94 | void modCommandsInit();
95 | void modCommandsSetSendFunction(void(*func)(unsigned char *data, unsigned int len));
96 | void modCommandsSendPacket(unsigned char *data, unsigned int len);
97 | void modCommandsProcessPacket(unsigned char *data, unsigned int len);
98 | void modCommandsPrintf(const char* format, ...);
99 | void modCommandsJumpToMainApplication(void);
100 | void modCommandsSendSweep(int size);
101 |
102 | #endif /* COMMANDS_H_ */
103 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/config.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #ifndef __MODCONFIG_H
18 | #define __MODCONFIG_H
19 |
20 | #include
21 | #include
22 |
23 | #include "control.h"
24 | #include "mppt.h"
25 | #include "can.h"
26 | #include "eeprom.h"
27 |
28 | //#define hallo RX_CAN_FRAMES_SIZE
29 |
30 | typedef struct {
31 | //This structure represents the data structure of the full configuration settings.
32 | CalibrationData_t calData;
33 | ConverterSettings_t settings;
34 | modMPPTsettings_t mpptsettings;
35 | modCanSettings_t cansettings;
36 | }modConfig_t;
37 |
38 |
39 |
40 | typedef enum {
41 | EEPROM_OK,
42 | EEPROM_Error,
43 | EEPROM_Invalid_Adress,
44 | EEPROM_Invalid,
45 | EERPOM_WRITE_ERROR,
46 | }EEPROM_resp_t;
47 |
48 | modConfig_t* modConfigInit(void);
49 | bool modConfigStoreAndLoadDefaultConfig(void);
50 | bool modConfigStoreConfig(void);
51 | bool modConfigLoadConfig(void);
52 | bool modConfigStoreDefaultConfig(void);
53 | void modConfigLoadDefaultConfig(void);
54 | void modConfigLimitSettings(modConfig_t* c);
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/crc.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 Benjamin Vedder benjamin@vedder.se
3 |
4 | This file is part of the VESC firmware.
5 |
6 | The VESC firmware is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | The VESC firmware is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #include "crc.h"
21 |
22 | // CRC Table
23 | const unsigned short libCRCLookupTable[] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084,
24 | 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad,
25 | 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7,
26 | 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
27 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a,
28 | 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672,
29 | 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719,
30 | 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7,
31 | 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948,
32 | 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50,
33 | 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b,
34 | 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
35 | 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97,
36 | 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe,
37 | 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca,
38 | 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3,
39 | 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d,
40 | 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214,
41 | 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c,
42 | 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
43 | 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3,
44 | 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d,
45 | 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806,
46 | 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e,
47 | 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1,
48 | 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b,
49 | 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0,
50 | 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
51 | 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 };
52 |
53 | unsigned short libCRCCalcCRC16(unsigned char *buf, unsigned int len) {
54 | unsigned int i;
55 | unsigned short cksum = 0;
56 | for (i = 0; i < len; i++) {
57 | cksum = libCRCLookupTable[(((cksum >> 8) ^ *buf++) & 0xFF)] ^ (cksum << 8);
58 | }
59 | return cksum;
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/crc.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 Benjamin Vedder benjamin@vedder.se
3 |
4 | This file is part of the VESC firmware.
5 |
6 | The VESC firmware is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | The VESC firmware is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 |
20 | #ifndef CRC_H_
21 | #define CRC_H_
22 |
23 | /*
24 | * Functions
25 | */
26 | unsigned short libCRCCalcCRC16(unsigned char *buf, unsigned int len);
27 |
28 | #endif /* CRC_H_ */
29 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/delay.c:
--------------------------------------------------------------------------------
1 | #include "delay.h"
2 |
3 | static uint32_t hmsCnt = 0;
4 |
5 | void modDelayInit(void) {
6 | SystemCoreClockUpdate();
7 |
8 | //SystemCoreClock / 1000
9 | if(SysTick_Config(72000)){
10 | while(1); //Error setting SysTick.
11 | }
12 | }
13 |
14 | uint8_t modDelayTick1ms(uint32_t *last, uint32_t ticks) {
15 | if((uint32_t)(HAL_GetTick() - *last) >= ticks)
16 | {
17 | *last = HAL_GetTick();
18 | return true;
19 | }
20 |
21 | return false;
22 | }
23 |
24 | uint8_t modDelayTick100ms(uint32_t *last, uint32_t ticks) {
25 | static uint32_t msTicks = 0;
26 |
27 | if(modDelayTick1ms(&msTicks,99))
28 | hmsCnt++;
29 |
30 | if((uint32_t)(hmsCnt - *last) >= ticks)
31 | {
32 | *last = hmsCnt;
33 | return true;
34 | }
35 |
36 | return false;
37 | }
38 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/delay.h:
--------------------------------------------------------------------------------
1 | #include "stm32g4xx_hal.h"
2 | #include "stdbool.h"
3 |
4 | void modDelayInit(void);
5 | uint8_t modDelayTick1ms(uint32_t *last, uint32_t ticks);
6 | uint8_t modDelayTick100ms(uint32_t *last, uint32_t ticks);
7 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/dma.c:
--------------------------------------------------------------------------------
1 | #include "dma.h"
2 |
3 | void dma_init(void) {
4 |
5 | /* DMA controller clock enable */
6 | __HAL_RCC_DMAMUX1_CLK_ENABLE();
7 | __HAL_RCC_DMA1_CLK_ENABLE();
8 |
9 | /* DMA interrupt init */
10 | /* DMA1_Channel1_IRQn interrupt configuration */
11 | HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 2, 0);
12 | HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
13 |
14 | /* DMA1_Channel2_IRQn interrupt configuration */
15 | HAL_NVIC_SetPriority(DMA1_Channel2_IRQn, 2, 0);
16 | HAL_NVIC_EnableIRQ(DMA1_Channel2_IRQn);
17 |
18 | }
19 |
20 | void DMA1_Channel1_IRQHandler(void) {
21 | HAL_DMA_IRQHandler(&hdma_adc5);
22 | }
23 |
24 | void DMA1_Channel2_IRQHandler(void) {
25 | HAL_DMA_IRQHandler(&hdma_usart3_rx);
26 | }
27 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/dma.h:
--------------------------------------------------------------------------------
1 | #ifndef __DMA_H__
2 | #define __DMA_H__
3 |
4 |
5 | //#include "main.h"
6 | #include "stm32g4xx_hal.h"
7 |
8 | DMA_HandleTypeDef hdma_adc5;
9 | DMA_HandleTypeDef hdma_usart3_rx;
10 |
11 | void dma_init(void);
12 |
13 | #endif /* __DMA_H__ */
14 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/eeprom.c:
--------------------------------------------------------------------------------
1 | /*
2 | * eeprom.c
3 | *
4 | * Created on: 6 Oct 2021
5 | * Author: Tjitte
6 | */
7 | #include
8 | #include
9 |
10 | #include "stm32g4xx_hal.h"
11 |
12 | #include "eeprom.h"
13 | #include "crc.h"
14 | #include "flash.h"
15 |
16 | //These are 64 bit to make life easer when programming them.
17 | volatile __EEPROM_FLASH uint64_t rom_state;
18 | volatile __EEPROM_FLASH uint64_t crc;
19 | volatile __EEPROM_FLASH uint8_t eeprommem[EEPROM_SIZE / sizeof(uint8_t)];
20 |
21 | //Private funkiton-prototypes
22 | //uint16_t eeprom_calc_crc16(void);
23 | //EEPROM_resp_t eeprom_write(uint64_t* dest, uint64_t*src, uint32_t length);
24 | //EEPROM_resp_t eeprom_endwrite();
25 | //EEPROM_resp_t eeprom_startwrite();
26 |
27 |
28 |
29 | bool eeprom_init() {
30 | __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE();
31 |
32 | //Initialize RAM memory as FF to minimize flash writes and to set ram memory to known data.
33 | uint32_t* eeprom_ram = (uint32_t*) EEPROM_RAMSTART;
34 | for(int i = 0; i < EEPROM_SIZE/sizeof(uint32_t); i++){
35 | eeprom_ram[i] = 0xFFFFFFFF;
36 | }
37 |
38 | if (eeprom_valid()) {
39 | eeprom_load();
40 | return true;
41 | }
42 | return false;
43 | }
44 |
45 | bool eeprom_valid() {
46 | uint16_t ccrc = libCRCCalcCRC16(eeprommem, EEPROM_SIZE / sizeof(uint8_t));
47 | if ((rom_state != EEPROM_Valid) || ((uint16_t)crc != ccrc)) {
48 | //Current EEPROM is invalid.
49 | return false;
50 | }
51 | return true;
52 | }
53 |
54 | void eeprom_load() {
55 | memcpy(EEPROM_RAMSTART, (const void*) eeprommem, EEPROM_SIZE);
56 | }
57 |
58 | void eeprom_save() {
59 | __ISB();
60 |
61 | HAL_StatusTypeDef status = HAL_FLASH_Unlock();
62 | uint32_t error = 0;
63 |
64 | uint32_t page = (EROM_BASE - MAIN_BASE) / 0x800;
65 | uint32_t Bank = FLASH_BANK_1;
66 |
67 | if (page >= 128){
68 | page -= 128;
69 | Bank = FLASH_BANK_2;
70 | }
71 |
72 | // make sure that this structure matches the data-sheet of your chip
73 | FLASH_EraseInitTypeDef FLASH_EraseInitStruct = {
74 | .TypeErase = FLASH_TYPEERASE_PAGES,
75 | .Banks = Bank,
76 | .Page = page,
77 | .NbPages = 1
78 | };
79 |
80 | // clear all flags before you write it to flash
81 | __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR);
82 |
83 | if (status != HAL_OK)
84 | return;
85 |
86 | // perform the erase first
87 | HAL_FLASHEx_Erase(&FLASH_EraseInitStruct, &error);
88 |
89 | uint64_t* address = (uint64_t*) eeprommem;
90 | uint64_t* data = (uint64_t*) EEPROM_RAMSTART;
91 | uint64_t ccrc = libCRCCalcCRC16(EEPROM_RAMSTART, EEPROM_SIZE / sizeof(uint8_t));
92 | uint64_t val = EEPROM_Valid;
93 |
94 | HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, (uint32_t)&crc, ccrc);
95 | HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, (uint32_t)&rom_state, val);
96 |
97 | int i = 0;
98 | do {
99 | HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, (uint32_t)address, data[i++]);
100 | address += 1;
101 |
102 | //wait for flash to be ready
103 | FLASH_WaitForLastOperation(10);
104 | } while ((void*)address < (EEPROM_START_ADDRESS + EEPROM_SIZE));
105 |
106 | //CLEAR_BIT(FLASH->CR, FLASH_CR_PG);
107 | HAL_FLASH_Lock();
108 | FLASH_WaitForLastOperation(100);
109 | HAL_FLASH_Unlock();
110 |
111 | return;
112 | }
113 |
114 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/eeprom.h:
--------------------------------------------------------------------------------
1 | /*
2 | * eeprom.h
3 | *
4 | * Created on: 6 Oct 2021
5 | * Author: Tjitte
6 | */
7 |
8 | #ifndef EEPROM_H_
9 | #define EEPROM_H_
10 |
11 | #include
12 | #include "flash.h"
13 |
14 | #define __EEPROM __attribute__((__section__(".erom_ram")))
15 | #define __EEPROM_FLASH __attribute__((__section__(".erom_flash")))
16 |
17 | #define EEPROM_RAMSTART ((void*)0x2001f800)
18 | #define EEPROM_START_ADDRESS ((void*)EROM_BASE)
19 | #define EEPROM_SIZE ((1<<11)-sizeof(uint64_t)-sizeof(uint64_t))
20 |
21 | #define EEPROM_Valid ((uint64_t)0x00C0FEEBABE02001)
22 |
23 |
24 | bool eeprom_init();
25 | bool eeprom_valid();
26 | void eeprom_load();
27 | void eeprom_save();
28 |
29 |
30 | #endif /* EEPROM_H_ */
31 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/flash.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef SRC_FLASH_H_
19 | #define SRC_FLASH_H_
20 |
21 | #include "stm32g4xx_hal.h"
22 | #include "stdbool.h"
23 | #include "stdint.h"
24 |
25 | //#define FLASH_PAGES 100
26 | //#define BOOTLOADER_BASE 100
27 | //#define MAIN_APP_BASE 0
28 | //#define NEW_APP_BASE 50
29 | //#define NEW_APP_SECTORS 50
30 | //#define NEW_APP_MAX_SIZE (NEW_APP_SECTORS * (1 << 11))
31 |
32 | #define MAIN_BASE 0x08000000
33 | #define APP_BASE 0x0803d800
34 | #define EROM_BASE 0x0807b800
35 | #define BOOT_BASE 0x0807c000
36 |
37 |
38 |
39 | uint16_t modFlashEraseNewAppData(uint32_t new_app_size);
40 | uint16_t modFlashEraseMainAppData(uint32_t new_app_size);
41 | uint16_t modFlashWriteNewAppData(uint32_t offset, uint8_t *data, uint32_t len);
42 | uint16_t modFlashCopyNewAppToMainApp(uint64_t *data, uint32_t len);
43 | void modFlashJumpToBootloader(void);
44 | void modFlashJumpToMainApplication(void);
45 |
46 | #endif /* SRC_FLASH_H_ */
47 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/hardware/hardware.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #include "hardware.h"
18 |
19 | void hw_setio_output(GPIO_TypeDef * port, uint32_t pin){
20 | GPIO_InitTypeDef GPIO_InitStruct;
21 | GPIO_InitStruct.Pin = pin;
22 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
23 | GPIO_InitStruct.Pull = GPIO_NOPULL;
24 | HAL_GPIO_Init(port, &GPIO_InitStruct);
25 | }
26 |
27 | void hw_setio_input(GPIO_TypeDef * port, uint32_t pin, uint32_t pull){
28 | GPIO_InitTypeDef GPIO_InitStruct;
29 | GPIO_InitStruct.Pin = pin;
30 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
31 | GPIO_InitStruct.Pull = pull;
32 | HAL_GPIO_Init(port, &GPIO_InitStruct);
33 | }
34 |
35 | void hw_setio_af(GPIO_TypeDef * port, uint32_t pin, uint32_t af){
36 | GPIO_InitTypeDef GPIO_InitStruct;
37 | GPIO_InitStruct.Pin = pin;
38 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
39 | GPIO_InitStruct.Pull = GPIO_NOPULL;
40 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
41 | GPIO_InitStruct.Alternate = af;
42 | HAL_GPIO_Init(port, &GPIO_InitStruct);
43 | }
44 |
45 | void hw_setio_analog(GPIO_TypeDef * port, uint32_t pin){
46 | GPIO_InitTypeDef GPIO_InitStruct;
47 | GPIO_InitStruct.Pin = pin;
48 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
49 | GPIO_InitStruct.Pull = GPIO_NOPULL;
50 | HAL_GPIO_Init(port, &GPIO_InitStruct);
51 | }
52 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/hardware/hardware.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef HARDWARE_HARDWARE_H_
19 | #define HARDWARE_HARDWARE_H_
20 |
21 | #include "stm32g4xx_hal.h"
22 | #include "stdio.h"
23 |
24 | #define FW_VERSION_MAJOR 1
25 | #define FW_VERSION_MINOR 8
26 |
27 | #if defined(HW_REBOOST)
28 | #include "hw_reboost.h"
29 |
30 | #elif defined(HW_SECB175_7A)
31 | #include
32 |
33 | #elif defined(HW_SECB175_4A)
34 | #include "secb1754a.h"
35 |
36 | #elif defined(HW_SECB175_4B)
37 | #include "secb1754b.h"
38 |
39 | #elif defined(HW_SECB175_10A)
40 | #include "secb17510a.h"
41 |
42 | #else
43 | #error "No hardware defined."
44 | #endif
45 |
46 |
47 | #ifndef HW_TOPOLOGY_BOOST
48 | #ifndef HW_TOPOLOGY_BUCK
49 | #error "No hardware topology defined."
50 | #endif
51 | #endif
52 |
53 | #define HW_TEMP_LIM 85.0f
54 | #define HW_MIN_SETPOINT 5000.0f
55 |
56 |
57 | extern ADC_HandleTypeDef hadc1;
58 | extern ADC_HandleTypeDef hadc2;
59 | extern ADC_HandleTypeDef hadc3;
60 | extern ADC_HandleTypeDef hadc4;
61 | extern ADC_HandleTypeDef hadc5;
62 |
63 | void hw_setio_output(GPIO_TypeDef * port, uint32_t pin);
64 | void hw_setio_input(GPIO_TypeDef * port, uint32_t pin, uint32_t pull);
65 | void hw_setio_af(GPIO_TypeDef * port, uint32_t pin, uint32_t af);
66 | void hw_setio_analog(GPIO_TypeDef * port, uint32_t pin);
67 |
68 | //void hw_io_init(void);
69 | //void hw_adc_init(void);
70 |
71 | #endif /* HARDWARE_HARDWARE_H_ */
72 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/hardware/hw_reboost.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #ifndef HARDWARE_HW_OPENBOOST_H_
18 | #define HARDWARE_HW_OPENBOOST_H_
19 |
20 | #ifdef HW_REBOOST
21 | #ifndef HW_NAME
22 | #define HW_NAME "SEC-B80-8A"
23 | #endif
24 |
25 | #define HW_TOPOLOGY_BOOST
26 |
27 |
28 | #define HW_HAS_IOUT_SENSOR
29 | #define HW_HAS_UART
30 | //#define HW_HAS_USB
31 | #define HW_HASID
32 | #define HSEN
33 |
34 |
35 | #define HW_ADCREF 2900.0f
36 |
37 | //Filters
38 | #define VOLTAGE_IN_FORGETING_FACTOR 0.0f
39 | #define VOLTAGE_OUT_FORGETING_FACTOR 0.0f
40 | #define CURRENT_IN_FORGETING_FACTOR 0.0f
41 | #define CURRENT_PV_FORGETING_FACTOR 0.5f
42 | #define TEMP_FORGETING_FACTOR 0.95f
43 |
44 | //Limits
45 | #define HW_LIMIT_HS_VOLTAGE_HARD 90000
46 | #define HW_LIMIT_LS_VOLTAGE_HARD 90000
47 | #define HW_LIMIT_HS_CURRENT_HARD 13000
48 | #define HW_LIMIT_LS_CURRENT_HARD 13000
49 | #define HW_MAX_CURRENT_SETTING 9000.0f
50 |
51 | #define HW_SWITCHINGFREQUENCY 100
52 | #define HW_ADC_DELAY -0.4f
53 | #define HW_DEADTIMERISING 40
54 | #define HW_DEADTIMEFALLING 40
55 | #define HW_L 68e-6f
56 | #define HW_CLOW 100e-6f
57 | #define HW_CHIGH 600e-6f
58 | #define HW_RLINT 50e-3f
59 |
60 | #define HW_Q 1.0f
61 | #define HW_KLIM 0.8f
62 | #define HW_KLIM_VOUT 0.4f
63 | #define HW_CONTROLLERFREQUENCY 20
64 | #define HW_delay 30e-6
65 | #define HW_IOUT_EN_HYST 800 //mA
66 |
67 | #define HW_TIMERINDEX HRTIM_TIMERINDEX_TIMER_B
68 | #define HW_HRTIM_ADCTRIGGER HRTIM_ADCTRIGGEREVENT13_TIMERB_CMP3
69 |
70 |
71 | //Pinout
72 | #define LED0_Pin GPIO_PIN_15
73 | #define LED0_GPIO_Port GPIOC
74 | #define LED1_Pin GPIO_PIN_14
75 | #define LED1_GPIO_Port GPIOC
76 | #define LED2_Pin GPIO_PIN_13
77 | #define LED2_GPIO_Port GPIOC
78 | #define LED3_Pin GPIO_PIN_9
79 | #define LED3_GPIO_Port GPIOB
80 | #define ID0_Pin GPIO_PIN_4
81 | #define ID0_GPIO_Port GPIOC
82 | #define ID1_Pin GPIO_PIN_0
83 | #define ID1_GPIO_Port GPIOB
84 | #define ID2_Pin GPIO_PIN_1
85 | #define ID2_GPIO_Port GPIOB
86 | #define ID3_Pin GPIO_PIN_2
87 | #define ID3_GPIO_Port GPIOB
88 | #define VLS_Pin GPIO_PIN_1
89 | #define VLS_GPIO_Port GPIOA
90 | #define IHS__Pin GPIO_PIN_2
91 | #define IHS__GPIO_Port GPIOA
92 | #define IHS_A3_Pin GPIO_PIN_3
93 | #define IHS_A3_GPIO_Port GPIOA
94 | #define VHS_Pin GPIO_PIN_7
95 | #define VHS_GPIO_Port GPIOA
96 | #define ILS__Pin GPIO_PIN_14
97 | #define ILS__GPIO_Port GPIOB
98 | #define ILS_B15_Pin GPIO_PIN_15
99 | #define ILS_B15_GPIO_Port GPIOB
100 | #define Tamb_Pin GPIO_PIN_8
101 | #define Tamb_GPIO_Port GPIOA
102 | #define Tsink_Pin GPIO_PIN_9
103 | #define Tsink_GPIO_Port GPIOA
104 | #define P2_PWM_LS_Pin GPIO_PIN_10
105 | #define P2_PWM_LS_GPIO_Port GPIOA
106 | #define P2_EN_HS_Pin GPIO_PIN_11
107 | #define P2_EN_HS_GPIO_Port GPIOA
108 | #define PHSEN_Pin GPIO_PIN_12
109 | #define PHSEN_GPIO_Port GPIOA
110 | #define PEN_Pin GPIO_PIN_15
111 | #define PEN_GPIO_Port GPIOA
112 | #define DREN_Pin GPIO_PIN_4
113 | #define DREN_GPIO_Port GPIOB
114 | #define VDRVPG_Pin GPIO_PIN_7
115 | #define VDRVPG_GPIO_Port GPIOB
116 | #define RST_Pin GPIO_PIN_10
117 | #define RST_GPIO_Port GPIOG
118 | #define BOOT0_Pin GPIO_PIN_8
119 | #define BOOT0_GPIO_Port GPIOB
120 |
121 | #endif
122 | #endif /* HARDWARE_HW_OPENBOOST_H_ */
123 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/hardware/secb17510a.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef HARDWARE_SECB_H_
19 | #define HARDWARE_SECB_H_
20 | #ifdef HW_SECB175_10A
21 |
22 | #include "stm32g4xx_hal.h"
23 | #include "stdio.h"
24 |
25 |
26 | #ifndef HW_NAME
27 | #define HW_NAME "SEC-B175-10A"
28 | #endif
29 |
30 | #define HW_TOPOLOGY_BOOST
31 |
32 | #define HW_HAS_IOUT_SENSOR
33 | #define HW_HAS_UART
34 | //#define HW_HAS_USB
35 | #define HW_HASID
36 | #define HSEN
37 |
38 | #define HW_ADCREF 2900.0f
39 |
40 | #define HW_TIMERINDEX HRTIM_TIMERINDEX_TIMER_B
41 | #define HW_HRTIM_ADCTRIGGER HRTIM_ADCTRIGGEREVENT13_TIMERB_CMP3
42 |
43 |
44 | //Filters
45 | #define VOLTAGE_IN_FORGETING_FACTOR 0.0f
46 | #define VOLTAGE_OUT_FORGETING_FACTOR 0.0f
47 | #define CURRENT_IN_FORGETING_FACTOR 0.0f
48 | #define CURRENT_PV_FORGETING_FACTOR 0.5f
49 | #define TEMP_FORGETING_FACTOR 0.95f
50 |
51 | //Limits
52 | #define HW_LIMIT_HS_VOLTAGE_HARD 184210
53 | #define HW_LIMIT_LS_VOLTAGE_HARD 184210
54 | #define HW_LIMIT_HS_CURRENT_HARD 16000
55 | #define HW_LIMIT_LS_CURRENT_HARD 16000
56 | #define HW_MAX_CURRENT_SETTING 10500.0f
57 |
58 |
59 | #define HW_SWITCHINGFREQUENCY 59
60 | #define HW_ADC_DELAY 0.3f
61 | #define HW_DEADTIMERISING 141
62 | #define HW_DEADTIMEFALLING 45
63 | #define HW_L 84e-6
64 | #define HW_RLINT 30e-3
65 | #define HW_CLOW 220.0e-6f
66 | #define HW_CHIGH 440.0e-6f
67 |
68 | #define HW_Q 0.5f
69 | #define HW_KLIM 0.8f
70 | #define HW_KLIM_VOUT 0.4f
71 | #define HW_CONTROLLERFREQUENCY 20
72 | #define HW_delay 40e-6
73 | #define HW_IOUT_EN_HYST 800 //mA
74 |
75 | //Pinout
76 | #define LED0_Pin GPIO_PIN_15
77 | #define LED0_GPIO_Port GPIOC
78 | #define LED1_Pin GPIO_PIN_14
79 | #define LED1_GPIO_Port GPIOC
80 | #define LED2_Pin GPIO_PIN_13
81 | #define LED2_GPIO_Port GPIOC
82 | #define LED3_Pin GPIO_PIN_9
83 | #define LED3_GPIO_Port GPIOB
84 |
85 | #define ID0_Pin GPIO_PIN_4
86 | #define ID0_GPIO_Port GPIOC
87 | #define ID1_Pin GPIO_PIN_0
88 | #define ID1_GPIO_Port GPIOB
89 | #define ID2_Pin GPIO_PIN_1
90 | #define ID2_GPIO_Port GPIOB
91 | #define ID3_Pin GPIO_PIN_2
92 | #define ID3_GPIO_Port GPIOB
93 |
94 | #define VLS_Pin GPIO_PIN_1
95 | #define VLS_GPIO_Port GPIOA
96 | #define IHS__Pin GPIO_PIN_2
97 | #define IHS__GPIO_Port GPIOA
98 | #define IHS_A3_Pin GPIO_PIN_3
99 | #define IHS_A3_GPIO_Port GPIOA
100 | #define VHS_Pin GPIO_PIN_7
101 | #define VHS_GPIO_Port GPIOA
102 | #define ILS__Pin GPIO_PIN_14
103 | #define ILS__GPIO_Port GPIOB
104 | #define ILS_B15_Pin GPIO_PIN_15
105 | #define ILS_B15_GPIO_Port GPIOB
106 | #define Tamb_Pin GPIO_PIN_8
107 | #define Tamb_GPIO_Port GPIOA
108 | #define Tsink_Pin GPIO_PIN_9
109 | #define Tsink_GPIO_Port GPIOA
110 | #define P2_PWM_LS_Pin GPIO_PIN_10
111 | #define P2_PWM_LS_GPIO_Port GPIOA
112 | #define P2_EN_HS_Pin GPIO_PIN_11
113 | #define P2_EN_HS_GPIO_Port GPIOA
114 | #define PHSEN_Pin GPIO_PIN_12
115 | #define PHSEN_GPIO_Port GPIOA
116 | #define PEN_Pin GPIO_PIN_15
117 | #define PEN_GPIO_Port GPIOA
118 | #define DREN_Pin GPIO_PIN_4
119 | #define DREN_GPIO_Port GPIOB
120 | #define VDRVPG_Pin GPIO_PIN_7
121 | #define VDRVPG_GPIO_Port GPIOB
122 | #define RST_Pin GPIO_PIN_10
123 | #define RST_GPIO_Port GPIOG
124 | #define BOOT0_Pin GPIO_PIN_8
125 | #define BOOT0_GPIO_Port GPIOB
126 |
127 |
128 | //const CalibrationData_t defaultCalibration;
129 |
130 |
131 | void hw_io_init(void);
132 | void hw_adc_init(void);
133 | #endif
134 | #endif /* HARDWARE_SECB_H_ */
135 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/hardware/secb1754a.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef HARDWARE_SECB1754A_H_
19 | #define HARDWARE_SECB1754A_H_
20 |
21 | #ifdef HW_SECB175_4A
22 |
23 | #include "stm32g4xx_hal.h"
24 | #include "stdio.h"
25 |
26 | #ifndef HW_NAME
27 | #define HW_NAME "SEC-B175-4A"
28 | #endif
29 |
30 | #define HW_TOPOLOGY_BOOST
31 |
32 | #define HW_HAS_IOUT_SENSOR
33 | #define HW_HAS_UART
34 | //#define HW_HAS_USB
35 | #define HW_HASID
36 | #define HSEN
37 |
38 | #define HW_ADCREF 2900.0f
39 |
40 | #define HW_TIMERINDEX HRTIM_TIMERINDEX_TIMER_B
41 | #define HW_HRTIM_ADCTRIGGER HRTIM_ADCTRIGGEREVENT13_TIMERB_CMP3
42 |
43 |
44 | //Filters
45 | #define VOLTAGE_IN_FORGETING_FACTOR 0.0f
46 | #define VOLTAGE_OUT_FORGETING_FACTOR 0.0f
47 | #define CURRENT_IN_FORGETING_FACTOR 0.0f
48 | #define CURRENT_PV_FORGETING_FACTOR 0.5f
49 | #define TEMP_FORGETING_FACTOR 0.95f
50 |
51 | //Limits
52 | #define HW_LIMIT_HS_VOLTAGE_HARD 184210
53 | #define HW_LIMIT_LS_VOLTAGE_HARD 184210
54 | #define HW_LIMIT_HS_CURRENT_HARD 7000
55 | #define HW_LIMIT_LS_CURRENT_HARD 7000
56 | #define HW_MAX_CURRENT_SETTING 5000.0f
57 |
58 | //#define LC
59 | #define HW_SWITCHINGFREQUENCY 26
60 | #define HW_ADC_DELAY 0.6f
61 | #define HW_DEADTIMERISING 180
62 | #define HW_DEADTIMEFALLING 37
63 | #define HW_L 248e-6
64 | #define HW_RLINT 60e-3
65 | #define HW_CLOW 220e-6
66 | #define HW_CHIGH 440e-6
67 |
68 | #define HW_Q 0.5f
69 | #define HW_KLIM 0.8f
70 | #define HW_KLIM_VOUT 0.4f
71 | #define HW_CONTROLLERFREQUENCY 20
72 | #define HW_delay 40e-6
73 | #define HW_IOUT_EN_HYST 800 //mA
74 |
75 | //Pinout
76 | #define LED0_Pin GPIO_PIN_15
77 | #define LED0_GPIO_Port GPIOC
78 | #define LED1_Pin GPIO_PIN_14
79 | #define LED1_GPIO_Port GPIOC
80 | #define LED2_Pin GPIO_PIN_13
81 | #define LED2_GPIO_Port GPIOC
82 | #define LED3_Pin GPIO_PIN_9
83 | #define LED3_GPIO_Port GPIOB
84 |
85 | #define ID0_Pin GPIO_PIN_4
86 | #define ID0_GPIO_Port GPIOC
87 | #define ID1_Pin GPIO_PIN_0
88 | #define ID1_GPIO_Port GPIOB
89 | #define ID2_Pin GPIO_PIN_1
90 | #define ID2_GPIO_Port GPIOB
91 | #define ID3_Pin GPIO_PIN_2
92 | #define ID3_GPIO_Port GPIOB
93 |
94 | #define VLS_Pin GPIO_PIN_1
95 | #define VLS_GPIO_Port GPIOA
96 | #define IHS__Pin GPIO_PIN_2
97 | #define IHS__GPIO_Port GPIOA
98 | #define IHS_A3_Pin GPIO_PIN_3
99 | #define IHS_A3_GPIO_Port GPIOA
100 | #define VHS_Pin GPIO_PIN_7
101 | #define VHS_GPIO_Port GPIOA
102 | #define ILS__Pin GPIO_PIN_14
103 | #define ILS__GPIO_Port GPIOB
104 | #define ILS_B15_Pin GPIO_PIN_15
105 | #define ILS_B15_GPIO_Port GPIOB
106 | #define Tamb_Pin GPIO_PIN_8
107 | #define Tamb_GPIO_Port GPIOA
108 | #define Tsink_Pin GPIO_PIN_9
109 | #define Tsink_GPIO_Port GPIOA
110 | #define P2_PWM_LS_Pin GPIO_PIN_10
111 | #define P2_PWM_LS_GPIO_Port GPIOA
112 | #define P2_EN_HS_Pin GPIO_PIN_11
113 | #define P2_EN_HS_GPIO_Port GPIOA
114 | #define PHSEN_Pin GPIO_PIN_12
115 | #define PHSEN_GPIO_Port GPIOA
116 | #define PEN_Pin GPIO_PIN_15
117 | #define PEN_GPIO_Port GPIOA
118 | #define DREN_Pin GPIO_PIN_4
119 | #define DREN_GPIO_Port GPIOB
120 | #define VDRVPG_Pin GPIO_PIN_7
121 | #define VDRVPG_GPIO_Port GPIOB
122 | #define RST_Pin GPIO_PIN_10
123 | #define RST_GPIO_Port GPIOG
124 | #define BOOT0_Pin GPIO_PIN_8
125 | #define BOOT0_GPIO_Port GPIOB
126 |
127 |
128 | //const CalibrationData_t defaultCalibration;
129 |
130 |
131 | void hw_io_init(void);
132 | void hw_adc_init(void);
133 | #endif
134 | #endif /* HARDWARE_SECB_H_ */
135 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/hardware/secb1754b.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef HARDWARE_SECB1754B_H_
19 | #define HARDWARE_SECB1754B_H_
20 |
21 | #ifdef HW_SECB175_4B
22 |
23 | #include "stm32g4xx_hal.h"
24 | #include "stdio.h"
25 |
26 |
27 | #ifndef HW_NAME
28 | #define HW_NAME "SEC-B175-4B"
29 | #endif
30 |
31 | #define HW_TOPOLOGY_BOOST
32 |
33 | #define HW_HAS_IOUT_SENSOR
34 | #define HW_HAS_UART
35 | //#define HW_HAS_USB
36 | #define HW_HASID
37 | #define HSEN
38 |
39 | #define HW_ADCREF 2900.0f
40 |
41 | #define HW_TIMERINDEX HRTIM_TIMERINDEX_TIMER_B
42 | #define HW_HRTIM_ADCTRIGGER HRTIM_ADCTRIGGEREVENT13_TIMERB_CMP3
43 |
44 |
45 | //Filters
46 | #define VOLTAGE_IN_FORGETING_FACTOR 0.0f
47 | #define VOLTAGE_OUT_FORGETING_FACTOR 0.0f
48 | #define CURRENT_IN_FORGETING_FACTOR 0.0f
49 | #define CURRENT_PV_FORGETING_FACTOR 0.5f
50 | #define TEMP_FORGETING_FACTOR 0.95f
51 |
52 | //Limits
53 | #define HW_LIMIT_HS_VOLTAGE_HARD 184210
54 | #define HW_LIMIT_LS_VOLTAGE_HARD 184210
55 | #define HW_LIMIT_HS_CURRENT_HARD 7000
56 | #define HW_LIMIT_LS_CURRENT_HARD 7000
57 | #define HW_MAX_CURRENT_SETTING 5000.0f
58 |
59 | #define HW_SWITCHINGFREQUENCY 25
60 | #define HW_ADC_DELAY 0.6f
61 | #define HW_DEADTIMERISING 180
62 | #define HW_DEADTIMEFALLING 57
63 | #define HW_L 290e-6
64 | #define HW_RLINT 48e-3
65 | #define HW_CLOW 220.0e-6f
66 | #define HW_CHIGH 440.0e-6f
67 |
68 | #define HW_Q 0.5f
69 | #define HW_KLIM 0.8f
70 | #define HW_KLIM_VOUT 0.4f
71 | #define HW_CONTROLLERFREQUENCY 20
72 | #define HW_delay 40e-6
73 | #define HW_IOUT_EN_HYST 800 //mA
74 |
75 |
76 | //Pinout
77 | #define LED0_Pin GPIO_PIN_15
78 | #define LED0_GPIO_Port GPIOC
79 | #define LED1_Pin GPIO_PIN_14
80 | #define LED1_GPIO_Port GPIOC
81 | #define LED2_Pin GPIO_PIN_13
82 | #define LED2_GPIO_Port GPIOC
83 | #define LED3_Pin GPIO_PIN_9
84 | #define LED3_GPIO_Port GPIOB
85 |
86 | #define ID0_Pin GPIO_PIN_4
87 | #define ID0_GPIO_Port GPIOC
88 | #define ID1_Pin GPIO_PIN_0
89 | #define ID1_GPIO_Port GPIOB
90 | #define ID2_Pin GPIO_PIN_1
91 | #define ID2_GPIO_Port GPIOB
92 | #define ID3_Pin GPIO_PIN_2
93 | #define ID3_GPIO_Port GPIOB
94 |
95 | #define VLS_Pin GPIO_PIN_1
96 | #define VLS_GPIO_Port GPIOA
97 | #define IHS__Pin GPIO_PIN_2
98 | #define IHS__GPIO_Port GPIOA
99 | #define IHS_A3_Pin GPIO_PIN_3
100 | #define IHS_A3_GPIO_Port GPIOA
101 | #define VHS_Pin GPIO_PIN_7
102 | #define VHS_GPIO_Port GPIOA
103 | #define ILS__Pin GPIO_PIN_14
104 | #define ILS__GPIO_Port GPIOB
105 | #define ILS_B15_Pin GPIO_PIN_15
106 | #define ILS_B15_GPIO_Port GPIOB
107 | #define Tamb_Pin GPIO_PIN_8
108 | #define Tamb_GPIO_Port GPIOA
109 | #define Tsink_Pin GPIO_PIN_9
110 | #define Tsink_GPIO_Port GPIOA
111 | #define P2_PWM_LS_Pin GPIO_PIN_10
112 | #define P2_PWM_LS_GPIO_Port GPIOA
113 | #define P2_EN_HS_Pin GPIO_PIN_11
114 | #define P2_EN_HS_GPIO_Port GPIOA
115 | #define PHSEN_Pin GPIO_PIN_12
116 | #define PHSEN_GPIO_Port GPIOA
117 | #define PEN_Pin GPIO_PIN_15
118 | #define PEN_GPIO_Port GPIOA
119 | #define DREN_Pin GPIO_PIN_4
120 | #define DREN_GPIO_Port GPIOB
121 | #define VDRVPG_Pin GPIO_PIN_7
122 | #define VDRVPG_GPIO_Port GPIOB
123 | #define RST_Pin GPIO_PIN_10
124 | #define RST_GPIO_Port GPIOG
125 | #define BOOT0_Pin GPIO_PIN_8
126 | #define BOOT0_GPIO_Port GPIOB
127 |
128 |
129 | //const CalibrationData_t defaultCalibration;
130 |
131 |
132 | void hw_io_init(void);
133 | void hw_adc_init(void);
134 | #endif
135 | #endif /* HARDWARE_SECB_H_ */
136 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/hardware/secb1757a.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef HARDWARE_SECB_H_
19 | #define HARDWARE_SECB_H_
20 | #ifdef HW_SECB175_7A
21 |
22 | #include "stm32g4xx_hal.h"
23 | #include "stdio.h"
24 |
25 |
26 | #ifndef HW_NAME
27 | #define HW_NAME "SEC-B175-7A"
28 | #endif
29 |
30 | #define HW_TOPOLOGY_BOOST
31 |
32 | #define HW_HAS_IOUT_SENSOR
33 | #define HW_HAS_UART
34 | //#define HW_HAS_USB
35 | #define HW_HASID
36 | #define HSEN
37 |
38 | #define HW_ADCREF 2900.0f
39 |
40 | #define HW_TIMERINDEX HRTIM_TIMERINDEX_TIMER_B
41 | #define HW_HRTIM_ADCTRIGGER HRTIM_ADCTRIGGEREVENT13_TIMERB_CMP3
42 |
43 |
44 | //Filters
45 | #define VOLTAGE_IN_FORGETING_FACTOR 0.0f
46 | #define VOLTAGE_OUT_FORGETING_FACTOR 0.75f
47 | #define CURRENT_IN_FORGETING_FACTOR 0.0f
48 | #define CURRENT_PV_FORGETING_FACTOR 0.5f
49 | #define TEMP_FORGETING_FACTOR 0.95f
50 |
51 | //Limits
52 | #define HW_LIMIT_HS_VOLTAGE_HARD 184210
53 | #define HW_LIMIT_LS_VOLTAGE_HARD 184210
54 | #define HW_LIMIT_HS_CURRENT_HARD 12000
55 | #define HW_LIMIT_LS_CURRENT_HARD 12000
56 | #define HW_MAX_CURRENT_SETTING 9500.0f
57 |
58 | #define HW_CURRENT_LIMIT_CORRECITONFACTOR 1.0f
59 |
60 | #define HW_SWITCHINGFREQUENCY 36
61 | #define HW_ADC_DELAY 0.6f
62 | #define HW_DEADTIMERISING 111
63 | #define HW_DEADTIMEFALLING 40
64 | #define HW_L 100e-6
65 | #define HW_RLINT 30e-3
66 | #define HW_CLOW 220.0e-6f
67 | #define HW_CHIGH 440.0e-6f
68 |
69 | #define HW_Q 0.5f
70 | #define HW_KLIM 0.8f
71 | #define HW_KLIM_VOUT 0.6f
72 | #define HW_CONTROLLERFREQUENCY 20
73 | #define HW_delay 45e-6
74 | #define HW_IOUT_EN_HYST 800 //mA
75 |
76 | //Pinout
77 | #define LED0_Pin GPIO_PIN_15
78 | #define LED0_GPIO_Port GPIOC
79 | #define LED1_Pin GPIO_PIN_14
80 | #define LED1_GPIO_Port GPIOC
81 | #define LED2_Pin GPIO_PIN_13
82 | #define LED2_GPIO_Port GPIOC
83 | #define LED3_Pin GPIO_PIN_9
84 | #define LED3_GPIO_Port GPIOB
85 |
86 | #define ID0_Pin GPIO_PIN_4
87 | #define ID0_GPIO_Port GPIOC
88 | #define ID1_Pin GPIO_PIN_0
89 | #define ID1_GPIO_Port GPIOB
90 | #define ID2_Pin GPIO_PIN_1
91 | #define ID2_GPIO_Port GPIOB
92 | #define ID3_Pin GPIO_PIN_2
93 | #define ID3_GPIO_Port GPIOB
94 |
95 | #define VLS_Pin GPIO_PIN_1
96 | #define VLS_GPIO_Port GPIOA
97 | #define IHS__Pin GPIO_PIN_2
98 | #define IHS__GPIO_Port GPIOA
99 | #define IHS_A3_Pin GPIO_PIN_3
100 | #define IHS_A3_GPIO_Port GPIOA
101 | #define VHS_Pin GPIO_PIN_7
102 | #define VHS_GPIO_Port GPIOA
103 | #define ILS__Pin GPIO_PIN_14
104 | #define ILS__GPIO_Port GPIOB
105 | #define ILS_B15_Pin GPIO_PIN_15
106 | #define ILS_B15_GPIO_Port GPIOB
107 | #define Tamb_Pin GPIO_PIN_8
108 | #define Tamb_GPIO_Port GPIOA
109 | #define Tsink_Pin GPIO_PIN_9
110 | #define Tsink_GPIO_Port GPIOA
111 | #define P2_PWM_LS_Pin GPIO_PIN_10
112 | #define P2_PWM_LS_GPIO_Port GPIOA
113 | #define P2_EN_HS_Pin GPIO_PIN_11
114 | #define P2_EN_HS_GPIO_Port GPIOA
115 | #define PHSEN_Pin GPIO_PIN_12
116 | #define PHSEN_GPIO_Port GPIOA
117 | #define PEN_Pin GPIO_PIN_15
118 | #define PEN_GPIO_Port GPIOA
119 | #define DREN_Pin GPIO_PIN_4
120 | #define DREN_GPIO_Port GPIOB
121 | #define VDRVPG_Pin GPIO_PIN_7
122 | #define VDRVPG_GPIO_Port GPIOB
123 | #define RST_Pin GPIO_PIN_10
124 | #define RST_GPIO_Port GPIOG
125 | #define BOOT0_Pin GPIO_PIN_8
126 | #define BOOT0_GPIO_Port GPIOB
127 |
128 |
129 | //const CalibrationData_t defaultCalibration;
130 |
131 |
132 | void hw_io_init(void);
133 | void hw_adc_init(void);
134 | #endif
135 | #endif /* HARDWARE_SECB_H_ */
136 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/leds.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #include "leds.h"
18 | #include "delay.h"
19 | #include "main.h"
20 | #include "mppt.h"
21 |
22 | uint32_t effectLastTick = 0;
23 | extern ConverterPhase_t phase;
24 |
25 | bool effectBlinkState = false;
26 | uint32_t effectBlinkLastTick;
27 | uint32_t effectLastLimitTick;
28 |
29 | void modEffectTask(){
30 | if(modDelayTick1ms(&effectBlinkLastTick,500)){
31 | effectBlinkState = !effectBlinkState;
32 | }
33 |
34 | if(modDelayTick1ms(&effectLastTick, 5)){
35 |
36 | if(phase.fault != Converter_OK){
37 | LED0_GPIO_Port->BRR = LED0_Pin;
38 | LED2_GPIO_Port->BRR = LED2_Pin;
39 |
40 | if(effectBlinkState){
41 | LED1_GPIO_Port->BSRR = LED1_Pin;
42 | }else{
43 | LED1_GPIO_Port->BRR = LED1_Pin;
44 | }
45 | }
46 | else {
47 | if(phase.mode != PhaseMode_CIV){
48 | LED1_GPIO_Port->BSRR = LED1_Pin;
49 | effectLastLimitTick = HAL_GetTick();
50 | }
51 | else{
52 | if(modDelayTick1ms(&effectLastLimitTick, 500)){
53 | LED1_GPIO_Port->BRR = LED1_Pin;
54 | }
55 | }
56 |
57 | switch(MpptLastAckion){
58 | default:
59 | case MpptAcktionState_Init:
60 | LED0_GPIO_Port->BRR = LED0_Pin;
61 | LED2_GPIO_Port->BRR = LED2_Pin;
62 | break;
63 |
64 | case MpptAcktionState_Up:
65 | LED0_GPIO_Port->BSRR = LED0_Pin;
66 | LED2_GPIO_Port->BRR = LED2_Pin;
67 | break;
68 |
69 | case MpptAcktionState_down:
70 | LED0_GPIO_Port->BRR = LED0_Pin;
71 | LED2_GPIO_Port->BSRR = LED2_Pin;
72 | break;
73 |
74 | }
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/leds.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef INC_MODEFFECT_H_
19 | #define INC_MODEFFECT_H_
20 |
21 | void modEffectTask(void);
22 |
23 | #endif /* INC_MODEFFECT_H_ */
24 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/main.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #ifndef __MAIN_H
18 | #define __MAIN_H
19 |
20 | #include
21 |
22 |
23 | void Error_Handler(void);
24 | void main_init_after_config(void);
25 | bool main_halt_risky(void);
26 |
27 | #endif /* __MAIN_H */
28 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/mppt.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef INC_MODMPPT_H_
19 | #define INC_MODMPPT_H_
20 | #include "stdbool.h"
21 |
22 | #include "mppt.h"
23 | #include "stdint.h"
24 | #include "stm32g4xx_hal.h"
25 | #include "delay.h"
26 | #include "control.h"
27 | #include "main.h"
28 |
29 | #define MPPT_SWEEP_DOWN true
30 | #define MPPT_SWEEP_UP false
31 |
32 | #define MPPT_SWEEP_SIZE (128)
33 | float mppt_vs[MPPT_SWEEP_SIZE];
34 | float mppt_is[MPPT_SWEEP_SIZE];
35 |
36 |
37 | typedef enum {
38 | MpptState_Disable,
39 | MpptState_init,
40 | MpptState_delay,
41 | MpptState_PO,
42 | MpptState_SweepStart,
43 | MpptState_SweepStartupdelay,
44 | MpptState_Sweep,
45 | MpptState_ConstantVoltage,
46 | }modMPPTstate_t;
47 |
48 | typedef enum {
49 | MpptMode_Disable,
50 | MpptMode_PO,
51 | MpptMode_ConstantVoltage,
52 | }modMPPTmode_t;
53 |
54 | typedef enum{
55 | MpptAcktionState_Init,
56 | MpptAcktionState_Up,
57 | MpptAcktionState_down,
58 | }modMPPTlastacktionstate_t;
59 |
60 | typedef struct{
61 | float PO_Stepsize;
62 | uint32_t PO_Timestep;
63 | float PO_StepSizeGain;
64 | float jump_PowerThreshold;
65 | int jump_Rate;
66 |
67 | bool Sweep_eneable;
68 | uint32_t Sweep_interval;
69 | uint32_t Sweep_timestep;
70 | bool Sweep_direction;
71 | uint32_t Sweep_datapoints;
72 | bool Sweep_publishOnCan;
73 |
74 | }modMPPTsettings_t;
75 |
76 | modMPPTlastacktionstate_t MpptLastAckion;
77 |
78 | void modMPPTtask();
79 | void modMPPTinit(modMPPTsettings_t *settings);
80 |
81 | void modMPPTPerturbAndObserve(void);
82 | void modMPPTSetPowerLevel(uint8_t level);
83 | void modMpptStartSweep(float start, float end, int size);
84 |
85 | void modMpptSetMode(modMPPTmode_t mode);
86 |
87 | #endif /* INC_MODMPPT_H_ */
88 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/packet.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef PACKET_H_
19 | #define PACKET_H_
20 |
21 | #include
22 |
23 | // Settings
24 | #define PACKET_RX_TIMEOUT 2
25 | #define PACKET_HANDLERS 2
26 | #define PACKET_MAX_PL_LEN 1024
27 |
28 | // Functions
29 | void libPacketInit(void (*s_func)(unsigned char *data, unsigned int len), void (*p_func)(unsigned char *data, unsigned int len), int handler_num);
30 | void libPacketProcessByte(uint8_t rx_data, int handler_num);
31 | void libPacketTimerFunc(void);
32 | void libPacketSendPacket(unsigned char *data, unsigned int len, int handler_num);
33 |
34 | #endif /* PACKET_H_ */
35 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/pwm.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #ifndef SRC_PWM_H_
18 | #define SRC_PWM_H_
19 |
20 | #include "hardware.h"
21 |
22 | void pwm_init(float switchingFrequency, float controllerFrequency, float dtr, float dtf, float adc_td);
23 | void pwm_setDuty(float duty);
24 | void pwm_disable();
25 | float pwm_GetControllerPeriod(void);
26 |
27 | #endif /* SRC_PWM_H_ */
28 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/sysmem.c:
--------------------------------------------------------------------------------
1 | /**
2 | *****************************************************************************
3 | **
4 | ** File : sysmem.c
5 | **
6 | ** Author : Auto-generated by STM32CubeIDE
7 | **
8 | ** Abstract : STM32CubeIDE Minimal System Memory calls file
9 | **
10 | ** For more information about which c-functions
11 | ** need which of these lowlevel functions
12 | ** please consult the Newlib libc-manual
13 | **
14 | ** Environment : STM32CubeIDE MCU
15 | **
16 | ** Distribution: The file is distributed as is, without any warranty
17 | ** of any kind.
18 | **
19 | *****************************************************************************
20 | **
21 | ** © COPYRIGHT(c) 2018 STMicroelectronics
22 | **
23 | ** Redistribution and use in source and binary forms, with or without modification,
24 | ** are permitted provided that the following conditions are met:
25 | ** 1. Redistributions of source code must retain the above copyright notice,
26 | ** this list of conditions and the following disclaimer.
27 | ** 2. Redistributions in binary form must reproduce the above copyright notice,
28 | ** this list of conditions and the following disclaimer in the documentation
29 | ** and/or other materials provided with the distribution.
30 | ** 3. Neither the name of STMicroelectronics nor the names of its contributors
31 | ** may be used to endorse or promote products derived from this software
32 | ** without specific prior written permission.
33 | **
34 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
38 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
40 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
41 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
42 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
43 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 | **
45 | **
46 | *****************************************************************************
47 | */
48 |
49 | /* Includes */
50 | #include
51 | #include
52 |
53 | /* Variables */
54 | extern int errno;
55 | register char * stack_ptr asm("sp");
56 |
57 | /* Functions */
58 |
59 | /**
60 | _sbrk
61 | Increase program data space. Malloc and related functions depend on this
62 | **/
63 | caddr_t _sbrk(int incr)
64 | {
65 | extern char end asm("end");
66 | static char *heap_end;
67 | char *prev_heap_end;
68 |
69 | if (heap_end == 0)
70 | heap_end = &end;
71 |
72 | prev_heap_end = heap_end;
73 | if (heap_end + incr > stack_ptr)
74 | {
75 | errno = ENOMEM;
76 | return (caddr_t) -1;
77 | }
78 |
79 | heap_end += incr;
80 |
81 | return (caddr_t) prev_heap_end;
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/terminal.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 |
18 | #ifndef TERMINAL_H_
19 | #define TERMINAL_H_
20 |
21 | #include
22 | #include
23 | #include
24 |
25 | #include "commands.h"
26 | #include "config.h"
27 |
28 |
29 | // Settings
30 | #define FAULT_VEC_LEN 25
31 | #define CALLBACK_LEN 25
32 |
33 | // Functions
34 | void terminal_process_string(char *str);
35 | void terminal_register_command_callback(
36 | const char* command,
37 | const char *help,
38 | const char *arg_names,
39 | void(*cbf)(int argc, const char **argv));
40 |
41 | #endif /* TERMINAL_H_ */
42 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/testing.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #ifndef INC_MODTESTING_H_
18 | #define INC_MODTESTING_H_
19 |
20 | #include "control.h"
21 |
22 | #define NSTATES 3
23 | #define INPUTS 2
24 |
25 | //float state[NSTATES];
26 |
27 | typedef struct{
28 | float Vlow;
29 | float Vhigh;
30 | float Iind;
31 | float Ihigh;
32 | }modTestingSimState_t;
33 |
34 | modTestingSimState_t simstate;
35 |
36 | typedef enum tests{
37 | test_nominal,
38 | test_load_disconect,
39 | test_lastest,
40 | }modTestS_t;
41 |
42 | typedef struct{
43 | float C1;
44 | float C2;
45 | float Isc;
46 | float Voc;
47 | }modTestingSolarCell_t;
48 |
49 | void modTestingInit(const ConverterSettings_t* s);
50 | void modTestingTask(void);
51 |
52 | void modTestingModel(float* x, float* dx, float*u);
53 |
54 | void modTestingSimstep(modTestingSimState_t *state, float dt, ConverterPhase_t* phase);
55 |
56 | #endif /* INC_MODTESTING_H_ */
57 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/uart.c:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright 2023 Tjitte van der Ploeg, tjitte@tpee.nl
3 | **
4 | ** This file is part of the OpenBoost firmware.
5 | ** The Open-SEC firmware is free software: you can redistribute
6 | ** it and/or modify it under the terms of the GNU General Public License
7 | ** as published by the Free Software Foundation, either version 3 of the
8 | ** License, or (at your option) any later version. The Open-SEC firmware is
9 | ** distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 | ** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 | ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 | **
13 | ** You should have received a copy of the GNU General Public License along
14 | ** with this program. If not, see .
15 | */
16 |
17 | #include "uart.h"
18 | #include "dma.h"
19 |
20 | uint32_t consoleStatusLastTick;
21 |
22 | #define RX_BUFFER_SIZE 256
23 | #define TX_BUFFER_SIZE 256
24 | uint8_t rxBuffer[RX_BUFFER_SIZE];
25 | uint8_t txbuffer[TX_BUFFER_SIZE];
26 |
27 | uint32_t wr_pointer = 0;
28 | uint32_t available = 0;
29 | uint32_t lastnewline = 0;
30 | bool HasOverflown = false;
31 |
32 | UART_HandleTypeDef huart3;
33 |
34 | void modUARTInit(void) {
35 |
36 | __HAL_RCC_USART3_CLK_ENABLE();
37 |
38 | huart3.Instance = USART3;
39 | huart3.Init.BaudRate = 115200;
40 | huart3.Init.WordLength = UART_WORDLENGTH_8B;
41 | huart3.Init.StopBits = UART_STOPBITS_1;
42 | huart3.Init.Parity = UART_PARITY_NONE;
43 | huart3.Init.Mode = UART_MODE_TX_RX;
44 | huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
45 | huart3.Init.OverSampling = UART_OVERSAMPLING_16;
46 | huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
47 | huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
48 | huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
49 |
50 | hdma_usart3_rx.Instance = DMA1_Channel2;
51 | hdma_usart3_rx.Init.Request = DMA_REQUEST_USART3_RX;
52 | hdma_usart3_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
53 | hdma_usart3_rx.Init.PeriphInc = DMA_PINC_DISABLE;
54 | hdma_usart3_rx.Init.MemInc = DMA_MINC_ENABLE;
55 | hdma_usart3_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
56 | hdma_usart3_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
57 | hdma_usart3_rx.Init.Mode = DMA_CIRCULAR;
58 | hdma_usart3_rx.Init.Priority = DMA_PRIORITY_LOW;
59 |
60 | HAL_DMA_Init(&hdma_usart3_rx);
61 | __HAL_LINKDMA(&huart3,hdmarx,hdma_usart3_rx);
62 |
63 | HAL_UART_Init(&huart3);
64 | HAL_UARTEx_SetTxFifoThreshold(&huart3, UART_TXFIFO_THRESHOLD_1_8);
65 | HAL_UARTEx_SetRxFifoThreshold(&huart3, UART_RXFIFO_THRESHOLD_1_8);
66 | HAL_UARTEx_DisableFifoMode(&huart3);
67 |
68 | HAL_UART_Receive_DMA(&huart3, rxBuffer, RX_BUFFER_SIZE);
69 | libPacketInit(modUARTSendPacket, modUARTProcessPacket, PACKET_HANDLER_UART); // Configure the UART driver
70 | }
71 |
72 | void modUARTTask(void) {
73 | uint32_t n_wr_pointer = RX_BUFFER_SIZE - DMA1_Channel2->CNDTR;
74 | uint32_t new = 0;
75 | if(n_wr_pointer == wr_pointer){
76 | //No new character received. return for speed.
77 | return;
78 | }
79 |
80 | if(n_wr_pointer < wr_pointer){
81 | //Buffer went round
82 | new = n_wr_pointer + (RX_BUFFER_SIZE - wr_pointer);
83 | HasOverflown = true;
84 |
85 | }
86 | else{
87 | new = n_wr_pointer - wr_pointer;
88 | }
89 | available += new;
90 |
91 | if(available > RX_BUFFER_SIZE){
92 | available = RX_BUFFER_SIZE;
93 | //Overflow has occurred!
94 | }
95 |
96 | //Process incoming chars
97 | for(int i = 0; i < new; i++){
98 | uint32_t index = wr_pointer + i;
99 | if (index >= RX_BUFFER_SIZE){
100 | index -= RX_BUFFER_SIZE;
101 | }
102 | libPacketProcessByte(rxBuffer[index],PACKET_HANDLER_UART);
103 |
104 | }
105 | wr_pointer = n_wr_pointer;
106 | }
107 |
108 |
109 | void modUARTSendPacketWrapper(unsigned char *data, unsigned int len) {
110 | libPacketSendPacket(data, len, PACKET_HANDLER_UART);
111 | }
112 |
113 | void modUARTProcessPacket(unsigned char *data, unsigned int len) {
114 | modCommandsSetSendFunction(modUARTSendPacketWrapper);
115 | modCommandsProcessPacket(data, len);
116 | }
117 |
118 | void modUARTSendPacket(unsigned char *data, unsigned int len) {
119 | HAL_UART_Transmit(&huart3, data, len, 100);
120 | }
121 |
--------------------------------------------------------------------------------
/Open-SEC Firmware/src/uart.h:
--------------------------------------------------------------------------------
1 | #ifndef __MODMESSAGE_H
2 | #define __MODMESSAGE_H
3 |
4 | #include
5 | #include
6 |
7 | #include "delay.h"
8 | #include "config.h"
9 | #include "packet.h"
10 | #include "commands.h"
11 |
12 | #define PACKET_HANDLER_UART 1
13 |
14 | UART_HandleTypeDef huart3;
15 | DMA_HandleTypeDef hdma_usart3_rx;
16 |
17 | typedef enum {
18 | MESSAGE_DEBUG = 0,
19 | MESSAGE_ERROR,
20 | MESSAGE_NORMAL,
21 | } modMessageMessageTypeDef;
22 |
23 | void modUARTInit(void);
24 | void modUARTTask(void);
25 | void modUARTSendPacketWrapper(unsigned char *data, unsigned int len);
26 | void modUARTProcessPacket(unsigned char *data, unsigned int len);
27 | void modUARTSendPacket(unsigned char *data, unsigned int len);
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/Pictures/20210831_111327.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/20210831_111327.jpg
--------------------------------------------------------------------------------
/Pictures/20210907_143401.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/20210907_143401.jpg
--------------------------------------------------------------------------------
/Pictures/20211026_080104.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/20211026_080104.jpg
--------------------------------------------------------------------------------
/Pictures/Efficiency40V_0-6A_50-70V.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/Efficiency40V_0-6A_50-70V.png
--------------------------------------------------------------------------------
/Pictures/IMG_20210124_115808.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210124_115808.jpg
--------------------------------------------------------------------------------
/Pictures/IMG_20210127_121656.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210127_121656.jpg
--------------------------------------------------------------------------------
/Pictures/IMG_20210128_111823.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210128_111823.jpg
--------------------------------------------------------------------------------
/Pictures/IMG_20210210_154253.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210210_154253.jpg
--------------------------------------------------------------------------------
/Pictures/IMG_20210210_154258.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210210_154258.jpg
--------------------------------------------------------------------------------
/Pictures/IMG_20210211_132339.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210211_132339.jpg
--------------------------------------------------------------------------------
/Pictures/IMG_20210212_160706.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210212_160706.jpg
--------------------------------------------------------------------------------
/Pictures/IMG_20210212_160715.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210212_160715.jpg
--------------------------------------------------------------------------------
/Pictures/IMG_20210212_160718.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210212_160718.jpg
--------------------------------------------------------------------------------
/Pictures/IMG_20210407_174357.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210407_174357.jpg
--------------------------------------------------------------------------------
/Pictures/IMG_20210621_180132.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/IMG_20210621_180132.jpg
--------------------------------------------------------------------------------
/Pictures/MPPT-STRAIGHT.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/MPPT-STRAIGHT.png
--------------------------------------------------------------------------------
/Pictures/Power_Losses_40V_0-6A_50-70V.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/Power_Losses_40V_0-6A_50-70V.png
--------------------------------------------------------------------------------
/Pictures/tool.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/tool.png
--------------------------------------------------------------------------------
/Pictures/tool02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TjitteS/OpenSmartEnergyConverter/2036b0858356ec6e5de97b7387b64ee855074729/Pictures/tool02.png
--------------------------------------------------------------------------------