Ignore:
Timestamp:
Dec 6, 2024, 11:57:29 AM (6 weeks ago)
Author:
Zed
Message:

SDMMC low level driver was added.

Location:
ctrl/firmware/Main/CubeMX
Files:
6 added
7 edited

Legend:

Unmodified
Added
Removed
  • ctrl/firmware/Main/CubeMX/Core/Inc/stm32h7xx_hal_conf.h

    r47 r51  
    7070#define HAL_RTC_MODULE_ENABLED
    7171/* #define HAL_SAI_MODULE_ENABLED   */
    72 /* #define HAL_SD_MODULE_ENABLED   */
     72#define HAL_SD_MODULE_ENABLED
    7373/* #define HAL_MMC_MODULE_ENABLED   */
    7474/* #define HAL_SPDIFRX_MODULE_ENABLED   */
  • ctrl/firmware/Main/CubeMX/Core/Inc/stm32h7xx_it.h

    r45 r51  
    5757void SysTick_Handler(void);
    5858void DMA1_Stream0_IRQHandler(void);
     59void SDMMC1_IRQHandler(void);
    5960void SPI4_IRQHandler(void);
    6061/* USER CODE BEGIN EFP */
  • ctrl/firmware/Main/CubeMX/Core/Src/gpio.c

    r50 r51  
    8686  /*Configure GPIO pins : PC13 PC0 PC1 PC2
    8787                           PC3 PC4 PC5 PC6
    88                            PC7 PC8 PC9 PC10
    89                            PC11 PC12 */
     88                           PC7 */
    9089  GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2
    9190                          |GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6
    92                           |GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10
    93                           |GPIO_PIN_11|GPIO_PIN_12;
     91                          |GPIO_PIN_7;
    9492  GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
    9593  GPIO_InitStruct.Pull = GPIO_NOPULL;
     
    144142  /*Configure GPIO pins : PD8 PD9 PD10 PD11
    145143                           PD12 PD13 PD14 PD15
    146                            PD0 PD1 PD2 PD3
    147                            PD4 PD5 PD6 */
     144                           PD0 PD1 PD3 PD4
     145                           PD5 PD6 */
    148146  GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
    149147                          |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15
    150                           |GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
    151                           |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6;
     148                          |GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_4
     149                          |GPIO_PIN_5|GPIO_PIN_6;
    152150  GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
    153151  GPIO_InitStruct.Pull = GPIO_NOPULL;
  • ctrl/firmware/Main/CubeMX/Core/Src/main.c

    r50 r51  
    2222#include "memorymap.h"
    2323#include "rtc.h"
     24#include "sdmmc.h"
    2425#include "spi.h"
    2526#include "gpio.h"
     
    114115  MX_RTC_Init();
    115116  MX_SPI4_Init();
     117  MX_SDMMC1_SD_Init();
    116118  /* USER CODE BEGIN 2 */
    117119
     
    170172  RCC_OscInitStruct.PLL.PLLN = 40;
    171173  RCC_OscInitStruct.PLL.PLLP = 2;
    172   RCC_OscInitStruct.PLL.PLLQ = 2;
     174  RCC_OscInitStruct.PLL.PLLQ = 4;
    173175  RCC_OscInitStruct.PLL.PLLR = 2;
    174176  RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
  • ctrl/firmware/Main/CubeMX/Core/Src/spi.c

    r50 r51  
    8585  */
    8686    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPI4;
    87     PeriphClkInitStruct.PLL2.PLL2M = 3;
    88     PeriphClkInitStruct.PLL2.PLL2N = 40;
    89     PeriphClkInitStruct.PLL2.PLL2P = 2;
    90     PeriphClkInitStruct.PLL2.PLL2Q = 11;
    91     PeriphClkInitStruct.PLL2.PLL2R = 2;
    92     PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_3;
    93     PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOWIDE;
    94     PeriphClkInitStruct.PLL2.PLL2FRACN = 0;
    95     PeriphClkInitStruct.Spi45ClockSelection = RCC_SPI45CLKSOURCE_PLL2;
     87    PeriphClkInitStruct.Spi45ClockSelection = RCC_SPI45CLKSOURCE_HSE;
    9688    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
    9789    {
  • ctrl/firmware/Main/CubeMX/Core/Src/stm32h7xx_it.c

    r45 r51  
    5656
    5757/* External variables --------------------------------------------------------*/
     58extern SD_HandleTypeDef hsd1;
    5859extern DMA_HandleTypeDef hdma_spi4_tx;
    5960extern SPI_HandleTypeDef hspi4;
     
    215216
    216217/**
     218  * @brief This function handles SDMMC1 global interrupt.
     219  */
     220void SDMMC1_IRQHandler(void)
     221{
     222  /* USER CODE BEGIN SDMMC1_IRQn 0 */
     223
     224  /* USER CODE END SDMMC1_IRQn 0 */
     225  HAL_SD_IRQHandler(&hsd1);
     226  /* USER CODE BEGIN SDMMC1_IRQn 1 */
     227
     228  /* USER CODE END SDMMC1_IRQn 1 */
     229}
     230
     231/**
    217232  * @brief This function handles SPI4 global interrupt.
    218233  */
  • ctrl/firmware/Main/CubeMX/charger.ioc

    r50 r51  
    4141Mcu.IP5=RCC
    4242Mcu.IP6=RTC
    43 Mcu.IP7=SPI4
    44 Mcu.IP8=SYS
    45 Mcu.IPNb=9
     43Mcu.IP7=SDMMC1
     44Mcu.IP8=SPI4
     45Mcu.IP9=SYS
     46Mcu.IPNb=10
    4647Mcu.Name=STM32H723ZETx
    4748Mcu.Package=LQFP144
    4849Mcu.Pin0=PE6
    4950Mcu.Pin1=PC14-OSC32_IN
    50 Mcu.Pin10=PA13(JTMS/SWDIO)
    51 Mcu.Pin11=PA14(JTCK/SWCLK)
    52 Mcu.Pin12=PD7
    53 Mcu.Pin13=PG9
    54 Mcu.Pin14=PG10
    55 Mcu.Pin15=PG11
    56 Mcu.Pin16=PG12
    57 Mcu.Pin17=PG13
    58 Mcu.Pin18=VP_RTC_VS_RTC_Activate
    59 Mcu.Pin19=VP_SYS_VS_Systick
     51Mcu.Pin10=PC8
     52Mcu.Pin11=PC9
     53Mcu.Pin12=PA13(JTMS/SWDIO)
     54Mcu.Pin13=PA14(JTCK/SWCLK)
     55Mcu.Pin14=PC10
     56Mcu.Pin15=PC11
     57Mcu.Pin16=PC12
     58Mcu.Pin17=PD2
     59Mcu.Pin18=PD7
     60Mcu.Pin19=PG9
    6061Mcu.Pin2=PC15-OSC32_OUT
    61 Mcu.Pin20=VP_MEMORYMAP_VS_MEMORYMAP
     62Mcu.Pin20=PG10
     63Mcu.Pin21=PG11
     64Mcu.Pin22=PG12
     65Mcu.Pin23=PG13
     66Mcu.Pin24=VP_RTC_VS_RTC_Activate
     67Mcu.Pin25=VP_SYS_VS_Systick
     68Mcu.Pin26=VP_MEMORYMAP_VS_MEMORYMAP
    6269Mcu.Pin3=PH0-OSC_IN
    6370Mcu.Pin4=PH1-OSC_OUT
     
    6774Mcu.Pin8=PE14
    6875Mcu.Pin9=PE15
    69 Mcu.PinsNb=21
     76Mcu.PinsNb=27
    7077Mcu.ThirdPartyNb=0
    7178Mcu.UserConstants=
     
    8289NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
    8390NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
     91NVIC.SDMMC1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
    8492NVIC.SPI4_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
    8593NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
     
    9098PA14(JTCK/SWCLK).Mode=Serial_Wire
    9199PA14(JTCK/SWCLK).Signal=DEBUG_JTCK-SWCLK
     100PC10.Mode=SD_4_bits_Wide_bus
     101PC10.Signal=SDMMC1_D2
     102PC11.Mode=SD_4_bits_Wide_bus
     103PC11.Signal=SDMMC1_D3
     104PC12.Mode=SD_4_bits_Wide_bus
     105PC12.Signal=SDMMC1_CK
    92106PC14-OSC32_IN.Mode=LSE-External-Oscillator
    93107PC14-OSC32_IN.Signal=RCC_OSC32_IN
    94108PC15-OSC32_OUT.Mode=LSE-External-Oscillator
    95109PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
     110PC8.Locked=true
     111PC8.Mode=SD_4_bits_Wide_bus
     112PC8.Signal=SDMMC1_D0
     113PC9.Mode=SD_4_bits_Wide_bus
     114PC9.Signal=SDMMC1_D1
     115PD2.Mode=SD_4_bits_Wide_bus
     116PD2.Signal=SDMMC1_CMD
    96117PD7.GPIOParameters=GPIO_Label
    97118PD7.GPIO_Label=OUTPUT_ON_LED
     
    195216RCC.CpuClockFreq_Value=100000000
    196217RCC.D1CPREFreq_Value=100000000
    197 RCC.DFSDMACLkFreq_Value=100000000
     218RCC.DFSDMACLkFreq_Value=50000000
    198219RCC.DFSDMFreq_Value=100000000
    199220RCC.DIVM1=5
    200221RCC.DIVM2=3
    201 RCC.DIVM3=25
     222RCC.DIVM3=1
    202223RCC.DIVN1=40
    203224RCC.DIVN2=40
    204 RCC.DIVN3=200
     225RCC.DIVN3=4
    205226RCC.DIVP1Freq_Value=100000000
    206227RCC.DIVP2Freq_Value=166666666.66666666
    207 RCC.DIVP3Freq_Value=100000000
    208 RCC.DIVQ1Freq_Value=100000000
     228RCC.DIVP3Freq_Value=50000000
     229RCC.DIVQ1=4
     230RCC.DIVQ1Freq_Value=50000000
    209231RCC.DIVQ2=11
    210232RCC.DIVQ2Freq_Value=30303030.3030303
    211 RCC.DIVQ3Freq_Value=100000000
     233RCC.DIVQ3Freq_Value=50000000
    212234RCC.DIVR1Freq_Value=100000000
    213 RCC.DIVR2Freq_Value=166666666.66666666
    214 RCC.DIVR3Freq_Value=100000000
    215 RCC.FDCANFreq_Value=100000000
     235RCC.DIVR2=10
     236RCC.DIVR2Freq_Value=33333333.333333332
     237RCC.DIVR3Freq_Value=50000000
     238RCC.FDCANFreq_Value=50000000
    216239RCC.FMCFreq_Value=100000000
    217240RCC.FamilyName=M
     
    220243RCC.I2C123Freq_Value=100000000
    221244RCC.I2C4Freq_Value=100000000
    222 RCC.IPParameters=ADCFreq_Value,AHB12Freq_Value,AHB4Freq_Value,APB1Freq_Value,APB2Freq_Value,APB3Freq_Value,APB4Freq_Value,AXIClockFreq_Value,CECFreq_Value,CKPERFreq_Value,CortexFreq_Value,CpuClockFreq_Value,D1CPREFreq_Value,DFSDMACLkFreq_Value,DFSDMFreq_Value,DIVM1,DIVM2,DIVM3,DIVN1,DIVN2,DIVN3,DIVP1Freq_Value,DIVP2Freq_Value,DIVP3Freq_Value,DIVQ1Freq_Value,DIVQ2,DIVQ2Freq_Value,DIVQ3Freq_Value,DIVR1Freq_Value,DIVR2Freq_Value,DIVR3Freq_Value,FDCANFreq_Value,FMCFreq_Value,FamilyName,HCLK3ClockFreq_Value,HCLKFreq_Value,I2C123Freq_Value,I2C4Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM345Freq_Value,LPUART1Freq_Value,LTDCFreq_Value,MCO1PinFreq_Value,MCO2PinFreq_Value,PLL2FRACN,PLLFRACN,PLLSourceVirtual,QSPIFreq_Value,RNGFreq_Value,RTCClockSelection,RTCFreq_Value,SAI1Freq_Value,SAI4AFreq_Value,SAI4BFreq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SPI123Freq_Value,SPI45Freq_Value,SPI6Freq_Value,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,Spi45ClockSelection,Tim1OutputFreq_Value,Tim2OutputFreq_Value,TraceFreq_Value,USART16Freq_Value,USART234578Freq_Value,USBFreq_Value,VCO1OutputFreq_Value,VCO2OutputFreq_Value,VCO3OutputFreq_Value,VCOInput1Freq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value
     245RCC.IPParameters=ADCFreq_Value,AHB12Freq_Value,AHB4Freq_Value,APB1Freq_Value,APB2Freq_Value,APB3Freq_Value,APB4Freq_Value,AXIClockFreq_Value,CECFreq_Value,CKPERFreq_Value,CortexFreq_Value,CpuClockFreq_Value,D1CPREFreq_Value,DFSDMACLkFreq_Value,DFSDMFreq_Value,DIVM1,DIVM2,DIVM3,DIVN1,DIVN2,DIVN3,DIVP1Freq_Value,DIVP2Freq_Value,DIVP3Freq_Value,DIVQ1,DIVQ1Freq_Value,DIVQ2,DIVQ2Freq_Value,DIVQ3Freq_Value,DIVR1Freq_Value,DIVR2,DIVR2Freq_Value,DIVR3Freq_Value,FDCANFreq_Value,FMCFreq_Value,FamilyName,HCLK3ClockFreq_Value,HCLKFreq_Value,I2C123Freq_Value,I2C4Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM345Freq_Value,LPUART1Freq_Value,LTDCFreq_Value,MCO1PinFreq_Value,MCO2PinFreq_Value,PLL2FRACN,PLLFRACN,PLLSourceVirtual,QSPIFreq_Value,RNGFreq_Value,RTCClockSelection,RTCFreq_Value,SAI1Freq_Value,SAI4AFreq_Value,SAI4BFreq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SPI123Freq_Value,SPI45Freq_Value,SPI6Freq_Value,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,Spi45ClockSelection,Tim1OutputFreq_Value,Tim2OutputFreq_Value,TraceFreq_Value,USART16Freq_Value,USART234578Freq_Value,USBFreq_Value,VCO1OutputFreq_Value,VCO2OutputFreq_Value,VCO3OutputFreq_Value,VCOInput1Freq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value
    223246RCC.LPTIM1Freq_Value=100000000
    224247RCC.LPTIM2Freq_Value=100000000
    225248RCC.LPTIM345Freq_Value=100000000
    226249RCC.LPUART1Freq_Value=100000000
    227 RCC.LTDCFreq_Value=100000000
     250RCC.LTDCFreq_Value=50000000
    228251RCC.MCO1PinFreq_Value=64000000
    229252RCC.MCO2PinFreq_Value=100000000
     
    235258RCC.RTCClockSelection=RCC_RTCCLKSOURCE_LSE
    236259RCC.RTCFreq_Value=32768
    237 RCC.SAI1Freq_Value=100000000
    238 RCC.SAI4AFreq_Value=100000000
    239 RCC.SAI4BFreq_Value=100000000
    240 RCC.SDMMCFreq_Value=100000000
    241 RCC.SPDIFRXFreq_Value=100000000
    242 RCC.SPI123Freq_Value=100000000
    243 RCC.SPI45Freq_Value=30303030.3030303
     260RCC.SAI1Freq_Value=50000000
     261RCC.SAI4AFreq_Value=50000000
     262RCC.SAI4BFreq_Value=50000000
     263RCC.SDMMCFreq_Value=50000000
     264RCC.SPDIFRXFreq_Value=50000000
     265RCC.SPI123Freq_Value=50000000
     266RCC.SPI45Freq_Value=25000000
    244267RCC.SPI6Freq_Value=100000000
    245268RCC.SWPMI1Freq_Value=100000000
    246269RCC.SYSCLKFreq_VALUE=100000000
    247270RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
    248 RCC.Spi45ClockSelection=RCC_SPI45CLKSOURCE_PLL2
     271RCC.Spi45ClockSelection=RCC_SPI45CLKSOURCE_HSE
    249272RCC.Tim1OutputFreq_Value=100000000
    250273RCC.Tim2OutputFreq_Value=100000000
     
    252275RCC.USART16Freq_Value=100000000
    253276RCC.USART234578Freq_Value=100000000
    254 RCC.USBFreq_Value=100000000
     277RCC.USBFreq_Value=50000000
    255278RCC.VCO1OutputFreq_Value=200000000
    256279RCC.VCO2OutputFreq_Value=333333333.3333333
    257 RCC.VCO3OutputFreq_Value=200000000
     280RCC.VCO3OutputFreq_Value=100000000
    258281RCC.VCOInput1Freq_Value=5000000
    259282RCC.VCOInput2Freq_Value=8333333.333333333
    260 RCC.VCOInput3Freq_Value=1000000
     283RCC.VCOInput3Freq_Value=25000000
     284SDMMC1.ClockPowerSave=SDMMC_CLOCK_POWER_SAVE_ENABLE
     285SDMMC1.HardwareFlowControl=SDMMC_HARDWARE_FLOW_CONTROL_ENABLE
     286SDMMC1.IPParameters=ClockPowerSave,HardwareFlowControl
    261287SPI4.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_4
    262 SPI4.CalculateBaudRate=7.575757 MBits/s
     288SPI4.CalculateBaudRate=6.25 MBits/s
    263289SPI4.DataSize=SPI_DATASIZE_9BIT
    264290SPI4.Direction=SPI_DIRECTION_1LINE
Note: See TracChangeset for help on using the changeset viewer.