Skip to content

Commit

Permalink
Revised startup current bugfix
Browse files Browse the repository at this point in the history
Original fix not working as intented, as the BSRR register write
had no effect before the pin was initialised.

Now setting the ODR register directly.
  • Loading branch information
dresco committed Dec 5, 2023
1 parent 0fee249 commit f7495bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Src/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1944,8 +1944,9 @@ static bool driver_setup (settings_t *settings)
for(i = 0 ; i < sizeof(outputpin) / sizeof(output_signal_t); i++) {
if(outputpin[i].group != PinGroup_StepperPower) {

// Set the initial state of the pin when it is enabled (note: need to use ODR instead of BSRR)
if(outputpin[i].group == PinGroup_MotorChipSelect || outputpin[i].group == PinGroup_MotorUART || outputpin[i].group == PinGroup_StepperEnable)
DIGITAL_OUT(outputpin[i].port, outputpin[i].bit, 1);
outputpin[i].port->ODR |= 1 << outputpin[i].pin;

GPIO_Init.Pin = outputpin[i].bit = 1 << outputpin[i].pin;
GPIO_Init.Mode = outputpin[i].mode.open_drain ? GPIO_MODE_OUTPUT_OD : GPIO_MODE_OUTPUT_PP;
Expand Down Expand Up @@ -2200,7 +2201,7 @@ bool driver_init (void)
hal.info = "STM32H743";
#endif

hal.driver_version = "231121";
hal.driver_version = "231205";
#ifdef BOARD_NAME
hal.board = BOARD_NAME;
#endif
Expand Down

0 comments on commit f7495bb

Please sign in to comment.