Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


Generate Software Interrupt (SI) with STM32F· Discovery board with HAL drivers

Thanks for the answer diabolo, and sorry for not answering you earlier. I’ve read more information about FreeRTOS but I still couldn’t figure out how to make a timer properly. Now I’ve defined a timer of 1KHz frequency with the FreeRTOS API and a callback function like this:

/* Create the timer(s) */
/* definition and creation of myTimer01 */
osTimerDef(myTimer01, Callback01);
myTimer01Handle = osTimerCreate(osTimer(myTimer01), osTimerPeriodic, NULL);

/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
osTimerStart(myTimer01Handle,1);
/* USER CODE END RTOS_TIMERS */

/* Create the thread(s) */
/* definition and creation of defaultTask */
osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128);
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);

In the callback I set a clock of 1KHz in a GPIO and every 100 ms I activate a SWI.

/* Callback01 function */
void Callback01(void const * argument)
{
/* USER CODE BEGIN Callback01 */
HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_1);
contador_timer++;
if (contador_timer == 100){
contador_timer = 0;
flag_SI = 1;
HAL_GPIO_TogglePin(GPIOE,GPIO_PIN_10);
//EXTI->SWIER |= EXTI_SWIER_SWIER0;
__HAL_GPIO_EXTI_GENERATE_SWIT(EXTI_SWIER_SWIER2);
}
/* USER CODE END Callback01 */
}

In the SWI I trie to set a GPIO and wait 200 ms until the next change of value, but the output change every 100 ms and I don’t know why.

void EXTI2_TSC_IRQHandler(void)
{
/* USER CODE BEGIN EXTI2_TSC_IRQn 0 */
if ((__HAL_GPIO_EXTI_GET_IT(EXTI_SWIER_SWIER2) != RESET) && (flag_SI == 1)){
//HAL_GPIO_WritePin(GPIOC,GPIO_PIN_2, GPIO_PIN_SET);
HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_2);
while(delay_SI > 0)
{
delay_SI = delay_SI - 1;
}
delay_SI = 200;
__HAL_GPIO_EXTI_CLEAR_IT(EXTI_SWIER_SWIER2);
flag_SI = 0;

}
/* USER CODE END EXTI2_TSC_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2);
/* USER CODE BEGIN EXTI2_TSC_IRQn 1 */

/* USER CODE END EXTI2_TSC_IRQn 1 */
}


There is some manual for the correct configuration of FreeRTOS for STM32CubeMX?

Thanks.

France

Hi,

I don’t understand the use of your waiting loop in EXTI2_TSC_IRQHandler: you will just wait for a few microseconds, or even less, before setting delay_SI to 200. Where did you see a 200ms delay?

According to your code, you toggle GPIO1 every millisecond, and GPIO10 and GPIO2 every 100ms (the first two in the callback, the last in the software generated interrupt handler, which is triggered every 100ms). If you want GPIO2 to be toggled every 200ms you should have a static counter in the SW handler, and only toggle GPIO2 when it is equal to 2 (then reset it to 0).

Bernard (Ac6)