GPIO
| Button | Method |
|---|
| PF10 | EXTI |
| PC0 | EXTI |
| PC1 | EXTI |
| PA0 | Poll every 5–10 ms using some timer or leave. Cant interrupt using both PC1 and PA0 |
| PH2 | EXTI |
| PH3 | EXTI |
| Button | Method |
|---|
| PF10 | EXTI |
| PC0 | EXTI |
| PC1 | EXTI |
| PA0 | Poll every 5–10 ms using some timer or leave. Cant interrupt using both PC1 and PA0 |
| PH2 | EXTI |
| PH3 | EXTI |
| ADC | IC | Channels |
|---|---|---|
| ADC1 | ADS7606 (U9) | AN0–AN7 |
| ADC2 | ADS7606 (U10) | AN8–AN15 |
All 8 channels on each ADS7606 are sampled simultaneously Low pass filter at the input line of each adc channel:
|
| Pin | Purpose |
|---|---|
| PI8 | ADC1 conversion trigger (CONVST) |
| PI11 | ADC1 BUSY signal |
| PI9 | ADC2 conversion trigger (CONVST) |
| PI10 | ADC2 BUSY signal |
| PI0 | ADC1 SPI chip select |
| PI3 | ADC2 SPI chip select |
When running the Switches_LED_Demo program,]
Current consumption increase by 100mA when SW3 is pressed.
After disable PI15 relay output in software, the current consumption is correct:
if(button3 == 1)
{
if(button3_state == 0)
{
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_14, GPIO_PIN_SET);
button3_state = 1;
// PI 15 is relay 1
// This code is for testing only
// HAL_GPIO_WritePin(GPIOI, GPIO_PIN_15, GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_14, GPIO_PIN_RESET);
button3_state = 0;
// PI 15 is relay 1
// This code is for testing only
// HAL_GPIO_WritePin(GPIOI, GPIO_PIN_15, GPIO_PIN_RESET);
}
button3 = 0 ;
}
Comments
System clock setting:
RCC_OscInitStruct.PLL.PLLM = 4;
RCC_OscInitStruct.PLL.PLLN = 50;
RCC_OscInitStruct.PLL.PLLP = 2;
Timer duration set in tim.c
/* USER CODE END TIM13_Init 1 */
htim13.Instance = TIM13;
htim13.Init.Prescaler = 9999;
htim13.Init.CounterMode = TIM_COUNTERMODE_UP;
htim13.Init.Period = 9999;
htim13.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4;
htim13.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
Interrupt Frequency =
TIM13 Clock / ((Prescaler + 1) × (Period + 1))
PF2 Toggle code in main.c:
if(htim->Instance == TIM13)
{
if(heart_beat == 0)
{
heart_beat = 1 ;
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_2, GPIO_PIN_SET);
}
else
{
heart_beat = 0 ;
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_2, GPIO_PIN_RESET);
}
}
| Button | Net Name | MCU Pin | Input Type | Detection Method | Interrupt Type | Pull-up Type | Pull-up Resistor |
|---|---|---|---|---|---|---|---|
| SW1 | SW_INP1 | PF10 | Digital Input | EXTI Interrupt | Falling Edge | External | R62 = 10 kΩ |
| SW2 | SW_INP2 | PC0 | Digital Input | EXTI Interrupt | Falling Edge | External | R61 = 10 kΩ |
| SW3 | SW_INP3 | PC1 | Digital Input | EXTI Interrupt | Falling Edge | External | R60 = 10 kΩ |
| SW4 | SW_INP4 | PA0 | Digital Input | TIM7 Polling | None | External | R59 = 10 kΩ |
| SW5 | SW_INP5 | PH2 | Digital Input | EXTI Interrupt | Falling Edge | External | R57 = 10 kΩ |
| SW6 | SW_INP6 | PH3 | Digital Input | EXTI Interrupt | Falling Edge | External | R56 = 10 kΩ |
| Button | Series Resistor | Debounce Capacitor | TVS / ESD Protection |
|---|---|---|---|
| SW1 | R14 = 100 Ω | C10 = 0.1 µF | VS6 |
| SW2 | R15 = 100 Ω | C11 = 0.1 µF | VS7 |
| SW3 | R16 = 100 Ω | C12 = 0.1 µF | VS8 |
| SW4 | R17 = 100 Ω | C13 = 0.1 µF | VS11 |
| SW5 | R18 = 100 Ω | C14 = 0.1 µF | VS9 |
| SW6 | R19 = 100 Ω | C15 = 0.1 µF | VS10 |
| Function | MCU Output Pin(s) | GPIO Configuration | Controlled By |
|---|---|---|---|
| Heartbeat LED | PF2 | Digital Output (Push-Pull) | TIM13 Interrupt |
| Output 1 | PI12, PB1 | Digital Output (Push-Pull) | SW1 |
| Output 2 | PI13, PB2 | Digital Output (Push-Pull) | SW2 |
| Output 3 | PI14, PI15 | Digital Output (Push-Pull) | SW3 |
| Output 4 | PF4 | Digital Output (Push-Pull) | SW4 |
| Output 5 | PH5 | Digital Output (Push-Pull) | SW5 |
| Output 6 | PK2 | Digital Output (Push-Pull) | SW6 |
If build fails again with the error:
make: *** No rule to make target 'G:/03_NAL/2024_RC_amb/10_controls/STM32Cube/Repository/STM32Cube_FW_H7_V1.12.0/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c', needed by 'Drivers/STM32H7xx_HAL_Driver/stm32h7xx_hal.o'. Stop.
make: *** Waiting for unfinished jobs....
"make -j4 all" terminated with exit code 2. Build might be incomplete.
16:48:08 Build Failed. 2 errors, 0 warnings. (took 34s.189ms)
Probably becaluse it is still looking for repository. In properties, delete the linked resources looking for old repository files: