32F417: trying to interrupt from PE12 rising edge
Post edited by the ST moderator to be inline with ST community rules especially for the code. Please use </> button to paste your code.
Hello :)
I almost have this working. In fact I had the ISR running and incrementing an integer. Then I went to the next stage and put in the xTaskResumeFromISR() but that crashes in configASSERT( xTaskToResume ).
Can anyone see any problems with this code?
Init:
__disable_irq();
GPIO_InitTypeDef GPIO_InitStruct = {0};
// Configure PE12
GPIO_InitStruct.Pin = GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; // Interrupt on rising edge
GPIO_InitStruct.Pull = GPIO_PULLDOWN; // pulldown
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; // This does nothing on an input pin
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
// Configure NVIC
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 10, 0); // Maybe the priority is not suitable for xTaskResumeFromISR ?
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
__enable_irq();Vector table piece:
.word USART2_IRQHandler /* USART2 */
.word USART3_IRQHandler /* USART3 */
.word EXTI15_10_IRQHandler /* EXTI15_10_IRQHandler External Line[15:10] used for PE12 (TE) interrupt */
.word 0 /* RTC_Alarm_IRQHandler RTC Alarm (A and B) through EXTI Line */
.word 0 /* OTG_FS_WKUP_IRQHandler USB OTG FS Wakeup through EXTI line */ISR:
// Handler for TE (PE12=1) interrupt.
// This restarts the xLCDHandle task which was suspended with vTaskSuspend(NULL).
void EXTI15_10_IRQHandler(void)
{
// Check if interrupt is from EXTI12 (PE12)
if (EXTI->PR & (1 << 12))
{
// Clear the interrupt pending bit
EXTI->PR = (1 << 12);
// Restart the suspended LCD task. If task not suspended, nothing happens
//xTaskResumeFromISR( xLCDHandle ); // uncommenting this breaks it
}
}
Currently I have no tasks suspended (so nothing to resume) but xTaskResumeFromISR should then just return False.
Digging around I found this
// Restart the suspended LCD task. If task not suspended, nothing happens
xYieldRequired = xTaskResumeFromISR( xLCDHandle );
if ( xYieldRequired == pdTRUE )
{
portYIELD_FROM_ISR( xYieldRequired );
}
but it doesn't help because the crash happens inside xTaskResumeFromISR.
Thank you very much for any input.
