Skip to content

Commit 4a00106

Browse files
authored
Merge pull request #27 from iralabdisco/h-bridge-faults
add fault interrupts, fix #6
2 parents cadb9be + ac0ed4b commit 4a00106

6 files changed

Lines changed: 114 additions & 58 deletions

File tree

otto_controller/.cproject

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F7xx/Include"/>
4545
<listOptionValue builtIn="false" value="../Core/Inc"/>
4646
<listOptionValue builtIn="false" value="../Drivers/STM32F7xx_HAL_Driver/Inc"/>
47-
<listOptionValue builtIn="false" value="../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy"/>
4847
<listOptionValue builtIn="false" value="../Core/Inc/protobuf"/>
48+
<listOptionValue builtIn="false" value="../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy"/>
4949
</option>
5050
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.otherflags.978301265" name="Other flags" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.otherflags" useByScannerDiscovery="false" valueType="stringList"/>
5151
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1784720711" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
@@ -58,8 +58,8 @@
5858
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F7xx/Include"/>
5959
<listOptionValue builtIn="false" value="../Core/Inc"/>
6060
<listOptionValue builtIn="false" value="../Drivers/STM32F7xx_HAL_Driver/Inc"/>
61-
<listOptionValue builtIn="false" value="../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy"/>
6261
<listOptionValue builtIn="false" value="../Core/Inc/protobuf"/>
62+
<listOptionValue builtIn="false" value="../Drivers/STM32F7xx_HAL_Driver/Inc/Legacy"/>
6363
</option>
6464
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols.1826209638" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
6565
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>

otto_controller/.mxproject

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ SourceFiles#4=/home/fdila/Projects/otto/otto_controller/Core/Src/stm32f7xx_it.c
2020
SourceFiles#5=/home/fdila/Projects/otto/otto_controller/Core/Src/stm32f7xx_hal_msp.c
2121
HeaderFiles#6=/home/fdila/Projects/otto/otto_controller/Core/Inc/main.h
2222
SourceFiles#6=/home/fdila/Projects/otto/otto_controller/Core/Src/main.c
23-
HeaderFiles=;
24-
SourceFiles=;
2523

2624
[PreviousLibFiles]
2725
LibFiles=Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h;Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_exti.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_exti.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c;Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart_ex.c;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h;Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_exti.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h;Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f767xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Include/system_stm32f7xx.h;Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cm4.h;

otto_controller/Core/Inc/main.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ void Error_Handler(void);
5858
/* USER CODE END EFP */
5959

6060
/* Private defines -----------------------------------------------------------*/
61+
#define user_button_Pin GPIO_PIN_13
62+
#define user_button_GPIO_Port GPIOC
63+
#define user_button_EXTI_IRQn EXTI15_10_IRQn
6164
#define current2_Pin GPIO_PIN_0
6265
#define current2_GPIO_Port GPIOC
6366
#define encoder_dx1_Pin GPIO_PIN_0

otto_controller/Core/Src/gpio.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ void MX_GPIO_Init(void)
5656
/*Configure GPIO pin Output Level */
5757
HAL_GPIO_WritePin(GPIOF, sleep2_Pin|sleep1_Pin, GPIO_PIN_SET);
5858

59-
/*Configure GPIO pin : PC13 */
60-
GPIO_InitStruct.Pin = GPIO_PIN_13;
59+
/*Configure GPIO pin : PtPin */
60+
GPIO_InitStruct.Pin = user_button_Pin;
6161
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
6262
GPIO_InitStruct.Pull = GPIO_NOPULL;
63-
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
63+
HAL_GPIO_Init(user_button_GPIO_Port, &GPIO_InitStruct);
6464

6565
/*Configure GPIO pin : PtPin */
6666
GPIO_InitStruct.Pin = current2_Pin;
@@ -76,8 +76,8 @@ void MX_GPIO_Init(void)
7676

7777
/*Configure GPIO pin : PtPin */
7878
GPIO_InitStruct.Pin = fault2_Pin;
79-
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
80-
GPIO_InitStruct.Pull = GPIO_NOPULL;
79+
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
80+
GPIO_InitStruct.Pull = GPIO_PULLUP;
8181
HAL_GPIO_Init(fault2_GPIO_Port, &GPIO_InitStruct);
8282

8383
/*Configure GPIO pins : PFPin PFPin */
@@ -96,8 +96,8 @@ void MX_GPIO_Init(void)
9696

9797
/*Configure GPIO pin : PtPin */
9898
GPIO_InitStruct.Pin = fault1_Pin;
99-
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
100-
GPIO_InitStruct.Pull = GPIO_NOPULL;
99+
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
100+
GPIO_InitStruct.Pull = GPIO_PULLUP;
101101
HAL_GPIO_Init(fault1_GPIO_Port, &GPIO_InitStruct);
102102

103103
/* EXTI interrupt init*/

otto_controller/Core/Src/main.cpp

Lines changed: 88 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,12 @@ static void MX_NVIC_Init(void);
129129
/* USER CODE END 0 */
130130

131131
/**
132-
* @brief The application entry point.
133-
* @retval int
134-
*/
135-
int main(void)
136-
{
132+
* @brief The application entry point.
133+
* @retval int
134+
*/
135+
int main(void) {
137136
/* USER CODE BEGIN 1 */
138137
/* USER CODE END 1 */
139-
140138

141139
/* MCU Configuration--------------------------------------------------------*/
142140

@@ -194,7 +192,7 @@ int main(void)
194192

195193
//Enables UART RX interrupt
196194
HAL_UART_Receive_DMA(&huart6, (uint8_t*) &proto_buffer_rx,
197-
VelocityCommand_size);
195+
VelocityCommand_size);
198196

199197
/* USER CODE END 2 */
200198

@@ -209,56 +207,51 @@ int main(void)
209207
}
210208

211209
/**
212-
* @brief System Clock Configuration
213-
* @retval None
214-
*/
215-
void SystemClock_Config(void)
216-
{
217-
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
218-
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
219-
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
210+
* @brief System Clock Configuration
211+
* @retval None
212+
*/
213+
void SystemClock_Config(void) {
214+
RCC_OscInitTypeDef RCC_OscInitStruct = { 0 };
215+
RCC_ClkInitTypeDef RCC_ClkInitStruct = { 0 };
216+
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = { 0 };
220217

221218
/** Configure the main internal regulator output voltage
222-
*/
219+
*/
223220
__HAL_RCC_PWR_CLK_ENABLE();
224221
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
225222
/** Initializes the CPU, AHB and APB busses clocks
226-
*/
223+
*/
227224
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
228225
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
229226
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
230227
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
231-
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
232-
{
228+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
233229
Error_Handler();
234230
}
235231
/** Initializes the CPU, AHB and APB busses clocks
236-
*/
237-
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
238-
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
232+
*/
233+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
234+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
239235
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
240236
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
241237
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
242238
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
243239

244-
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
245-
{
240+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) {
246241
Error_Handler();
247242
}
248243
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART6;
249244
PeriphClkInitStruct.Usart6ClockSelection = RCC_USART6CLKSOURCE_PCLK2;
250-
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
251-
{
245+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
252246
Error_Handler();
253247
}
254248
}
255249

256250
/**
257-
* @brief NVIC Configuration.
258-
* @retval None
259-
*/
260-
static void MX_NVIC_Init(void)
261-
{
251+
* @brief NVIC Configuration.
252+
* @retval None
253+
*/
254+
static void MX_NVIC_Init(void) {
262255
/* TIM3_IRQn interrupt configuration */
263256
HAL_NVIC_SetPriority(TIM3_IRQn, 2, 1);
264257
HAL_NVIC_EnableIRQ(TIM3_IRQn);
@@ -295,7 +288,8 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
295288
//TIMER 10Hz Transmit
296289
if (htim->Instance == TIM6) {
297290

298-
pb_ostream_t stream = pb_ostream_from_buffer(proto_buffer_tx, sizeof(proto_buffer_tx));
291+
pb_ostream_t stream = pb_ostream_from_buffer(proto_buffer_tx,
292+
sizeof(proto_buffer_tx));
299293

300294
float left_wheel = left_encoder.GetLinearVelocity();
301295
float right_wheel = right_encoder.GetLinearVelocity();
@@ -313,7 +307,8 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
313307

314308
pb_encode(&stream, StatusMessage_fields, &status_msg);
315309

316-
HAL_UART_Transmit_DMA(&huart6,(uint8_t*) &proto_buffer_tx, StatusMessage_size);
310+
HAL_UART_Transmit_DMA(&huart6, (uint8_t*) &proto_buffer_tx,
311+
StatusMessage_size);
317312
}
318313
}
319314

@@ -330,7 +325,7 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle) {
330325
float angular_velocity;
331326

332327
pb_istream_t stream = pb_istream_from_buffer(proto_buffer_rx,
333-
VelocityCommand_size);
328+
VelocityCommand_size);
334329

335330
bool status = pb_decode(&stream, VelocityCommand_fields, &vel_cmd);
336331

@@ -349,32 +344,82 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle) {
349344
float cross_setpoint = left_setpoint - right_setpoint;
350345
cross_pid.set(cross_setpoint);
351346

352-
353347
}
354348

355349
HAL_UART_Receive_DMA(&huart6, (uint8_t*) &proto_buffer_rx,
356-
VelocityCommand_size);
350+
VelocityCommand_size);
357351
}
358352

359353
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
360354
//Blue user button on the NUCLEO board
361-
if (GPIO_Pin == GPIO_PIN_13) {
355+
if (GPIO_Pin == user_button_Pin) {
362356
if (mode == 0) {
363357
mode = 1;
364358
//Enables TIM3 interrupt (used for PID control)
365359
HAL_TIM_Base_Start_IT(&htim3);
366-
367360
}
361+
362+
} else if (GPIO_Pin == fault1_Pin) {
363+
left_motor.brake();
364+
right_motor.brake();
365+
//stop TIM3 interrupt (used for PID control)
366+
HAL_TIM_Base_Stop_IT(&htim3);
367+
368+
//Send status message with error code
369+
status_msg.linear_velocity = 0;
370+
status_msg.angular_velocity = 0;
371+
372+
float current_tx_millis = HAL_GetTick();
373+
status_msg.delta_millis = current_tx_millis - previous_tx_millis;
374+
previous_tx_millis = current_tx_millis;
375+
376+
status_msg.status = 4;
377+
378+
pb_ostream_t stream = pb_ostream_from_buffer(proto_buffer_tx,
379+
sizeof(proto_buffer_tx));
380+
pb_encode(&stream, StatusMessage_fields, &status_msg);
381+
382+
HAL_UART_Transmit_DMA(&huart6, (uint8_t*) &proto_buffer_tx,
383+
StatusMessage_size);
384+
385+
//loops forever, manual reset is needed
386+
while (1);
387+
388+
} else if (GPIO_Pin == fault2_Pin) {
389+
left_motor.brake();
390+
right_motor.brake();
391+
//stop TIM3 interrupt (used for PID control)
392+
HAL_TIM_Base_Stop_IT(&htim3);
393+
394+
//Send status message with error code
395+
status_msg.linear_velocity = 0;
396+
status_msg.angular_velocity = 0;
397+
398+
float current_tx_millis = HAL_GetTick();
399+
status_msg.delta_millis = current_tx_millis - previous_tx_millis;
400+
previous_tx_millis = current_tx_millis;
401+
402+
status_msg.status = 5;
403+
404+
pb_ostream_t stream = pb_ostream_from_buffer(proto_buffer_tx,
405+
sizeof(proto_buffer_tx));
406+
pb_encode(&stream, StatusMessage_fields, &status_msg);
407+
408+
HAL_UART_Transmit_DMA(&huart6, (uint8_t*) &proto_buffer_tx,
409+
StatusMessage_size);
410+
411+
//loops forever, manual reset is needed
412+
while (1);
368413
}
414+
369415
}
370416
/* USER CODE END 4 */
371417

372418
/**
373-
* @brief This function is executed in case of error occurrence.
374-
* @retval None
375-
*/
376-
void Error_Handler(void)
377-
{
419+
* @brief This function is executed in case of error occurrence.
420+
* @retval None
421+
*/
422+
void Error_Handler(void) {
378423
/* USER CODE BEGIN Error_Handler_Debug */
379424
/* User can add his own implementation to report the HAL error return state */
380425

otto_controller/otto_controller.ioc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,12 @@ PA5.GPIOParameters=GPIO_Label
105105
PA5.GPIO_Label=encoder_sx1
106106
PA5.Locked=true
107107
PA5.Signal=S_TIM2_CH1_ETR
108-
PA6.GPIOParameters=GPIO_Label
108+
PA6.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI
109109
PA6.GPIO_Label=fault2
110+
PA6.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
111+
PA6.GPIO_PuPd=GPIO_PULLUP
110112
PA6.Locked=true
111-
PA6.Signal=GPIO_Input
113+
PA6.Signal=GPXTI6
112114
PB3.GPIOParameters=GPIO_Label
113115
PB3.GPIO_Label=encoder_sx2
114116
PB3.Locked=true
@@ -117,6 +119,8 @@ PC0.GPIOParameters=GPIO_Label
117119
PC0.GPIO_Label=current2
118120
PC0.Locked=true
119121
PC0.Signal=GPIO_Analog
122+
PC13.GPIOParameters=GPIO_Label
123+
PC13.GPIO_Label=user_button
120124
PC13.Locked=true
121125
PC13.Signal=GPXTI13
122126
PC6.Mode=Asynchronous
@@ -139,10 +143,12 @@ PD15.GPIOParameters=GPIO_Label
139143
PD15.GPIO_Label=pwm1
140144
PD15.Locked=true
141145
PD15.Signal=S_TIM4_CH4
142-
PE9.GPIOParameters=GPIO_Label
146+
PE9.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI
143147
PE9.GPIO_Label=fault1
148+
PE9.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
149+
PE9.GPIO_PuPd=GPIO_PULLUP
144150
PE9.Locked=true
145-
PE9.Signal=GPIO_Input
151+
PE9.Signal=GPXTI9
146152
PF12.GPIOParameters=GPIO_Label
147153
PF12.GPIO_Label=dir2
148154
PF12.Locked=true
@@ -224,6 +230,10 @@ RCC.VCOOutputFreq_Value=192000000
224230
RCC.VCOSAIOutputFreq_Value=192000000
225231
SH.GPXTI13.0=GPIO_EXTI13
226232
SH.GPXTI13.ConfNb=1
233+
SH.GPXTI6.0=GPIO_EXTI6
234+
SH.GPXTI6.ConfNb=1
235+
SH.GPXTI9.0=GPIO_EXTI9
236+
SH.GPXTI9.ConfNb=1
227237
SH.S_TIM2_CH1_ETR.0=TIM2_CH1,Encoder_Interface
228238
SH.S_TIM2_CH1_ETR.ConfNb=1
229239
SH.S_TIM2_CH2.0=TIM2_CH2,Encoder_Interface

0 commit comments

Comments
 (0)