2020-12-21 12:25 AM
Hello,
I am using a STM429I-EVAL1 board. With this I try to trigger an interrupt by pressing on the joystick, which is on the board. The interrupt is executed correctly a few times, but then it aborts. You can't tell when, it can abort after the 10 times or 20 times. The joystick is connected to the processor via I²C. Does anyone maybe have an idea what the problem could be?
Many thanks in advance.
2020-12-21 01:30 AM
Aborts how exactly?
Don't call blocking code from interrupt/callback context.
Arbitrate ownership via a mutex or semaphore so only one query or I2c transaction occurs at once.
2020-12-21 07:38 AM
After repeated pressing of the joystick, the process pauses in Task.c and toggles between the two functions.
static void prvCheckTasksWaitingTermination( void )
{
/** THIS FUNCTION IS CALLED FROM THE RTOS IDLE TASK **/
#if ( INCLUDE_vTaskDelete == 1 )
{
TCB_t *pxTCB;
/* uxDeletedTasksWaitingCleanUp is used to prevent vTaskSuspendAll()
being called too often in the idle task. */
while( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U )
{
taskENTER_CRITICAL();
{
pxTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) );
( void ) uxListRemove( &( pxTCB->xStateListItem ) );
--uxCurrentNumberOfTasks;
--uxDeletedTasksWaitingCleanUp;
}
taskEXIT_CRITICAL();
prvDeleteTCB( pxTCB );
}
}
#endif /* INCLUDE_vTaskDelete */
}
___________________________________________________________________________________________________________
#if ( ( configUSE_PREEMPTION == 1 ) && ( configIDLE_SHOULD_YIELD == 1 ) )
{
/* When using preemption tasks of equal priority will be
timesliced. If a task that is sharing the idle priority is ready
to run then the idle task should yield before the end of the
timeslice.
A critical region is not required here as we are just reading from
the list, and an occasional incorrect value will not matter. If
the ready list at the idle priority contains more than one task
then a task other than the idle task is ready to execute. */
if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) 1 )
{
taskYIELD();
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configIDLE_SHOULD_YIELD == 1 ) ) */
____________________________________________________________________________________________________________________
How can I arbitrate the ownership? Do you have an example?