is there any progress integrating the end switches?
I tried to implement a interrupt routine for GPIO_5, but without luck. Maybe somebody can tell me what I’m doing wrong. I’m not really confirmed with the STM32. In the layout of my 3.5 board, GPIO_5 is connected to PC4, so I have to use EXTI4_IRQHandler.
First I added a 10k pullup resistor to the GPIO port and 3.3V.
In the code (main.cpp) (int odrive_main(void) )
I added the code below to activate the interrupt routine for GPIO_5.
I saw, that the initialization is done. But when I push the end switch, the voltage at the port changes from 3.3 to 0V, but no interrupt was fired.
#if HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR >= 5
GPIO_InitStruct.Pin = GPIO_5_Pin; //GPIO5 ist PC4
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
HAL_NVIC_SetPriority(EXTI4_IRQn, 3, 0);
And a Interrupt routine:
//if during control loop, do a emergency stop,
//else set position to zero