2018-05-14 09:14 AM
.
2018-05-16 01:04 AM
Hello,
Your NVIC configuration looks correct.
BASEPRI is the name of the core registers which is used to block interrupt on the desired level (always vs preemption priorities). As you see in above code you are configuring BASEPRI with configMAX_SYSCALL_INTERRUPT_PRIORITY (5 in your case).
I see you are using os functions within HAL functions .
I would separate those two worlds. Please select different timer (SYS->Timebase) for HAL libraries and leave SysTick for OS. It will help you with proper interrupt management.
If you will use Systick for HAL and OS you will face the situation that your SysTick interrupt (having lowest possible priority) will be stucked as it will be blocked by most of the OS functions at entrance to critical section (operations on BASEPRI).
Best Regards,
Artur
2018-05-16 01:11 AM
Hello,
I wanted to configure the interruptino using Systick and then change it to timer but it is not correct right ??
If no , which Timer shall I use in SYS PLEASE ??
Can You tell me more about timers and how to use it ? I am a debutant about timers
2018-05-16 01:24 AM
I changed it to tTIM6 .when I debug it blocks in the BASEPRI function I do not know why yet
2018-05-16 01:34 AM
TIM6 is a good choice.
Concerning timers introduction, I would recommend to you one of our dedicated application notes,
where you will find more information. To track where you are blocked please check whether you are not using HAL_Delay function from interrupts or from tasks. From task it is better to use osDelay which is not blocking CPU.Best Regards,
Artur
2018-05-16 01:38 AM
HAL_delay function is weak function so I re wwrited it liks this
void HAL_Delay ( volatile uint32_t millis)
{
/* remplace la fonction de délai de blocage de la bibliothèque HAL avec l'équivalent de la reconnaissance de threads FreeRTOS */ osDelay (millis);}Still did not know how to resolve it
:(
2018-05-16 01:48 AM
Please, keep an original form of HAL_Delay() and please do not call from it any OS functions. HAL_Delay should have nothing in common with OS to have an option to work with the hardware.
HAL_Delay() in your case should generate delays, timeouts based on Timer6 events. Timer6 interrupt has higher priority (much above OS) to allow hardware, its interrupts to work and not be blocked by OS (within critical sections using BASEPRI).
2018-05-16 02:07 AM
in stm32f4xx_it.c the HAL DELAY is like this
__weak void HAL_Delay(uint32_t Delay)
{ uint32_t tickstart = HAL_GetTick(); uint32_t wait = Delay;/* Add a freq to guarantee minimum wait */
if (wait < HAL_MAX_DELAY) { wait += (uint32_t)(uwTickFreq); }while((HAL_GetTick() - tickstart) < wait)
{ }}I do know why but I read somewhere that I hzve to re write it
void HAL_Delay ( volatile uint32_t millis)
{
/* remplace la fonction de délai de blocage de la bibliothèque HAL avec l'équivalent de la reconnaissance de threads FreeRTOS *//*(mappage HAL_Delay () à vTaskDelay () résout le problème du blocage d'une fonction dans un timeout)*/
vTaskDelay (millis);}I removed the osDelay . Is it fine noww ???
When I debug I put breakpoint on Hal_Delay . It blocks . when I put pause to see where it is blocked
it is blocked in list.c file in for loop
/* *** NOTE ***********************************************************
If you find your application is crashing here then likely causes arelisted below. In addition see
https://community.st.com/external-link.jspa?url=http%3A%2F%2Fwww.freertos.org%2FFAQHelp.html
for
more tips, and ensure configASSERT() is defined!1) Stack overflow -
see
2) Incorrect interrupt priority assignment, especially on Cortex-M parts where numerically high priority values denote low actual interrupt priorities, which can seem counter intuitive. Seeand the definition
of configMAX_SYSCALL_INTERRUPT_PRIORITY onhttps://community.st.com/external-link.jspa?url=http%3A%2F%2Fwww.freertos.org%2Fa00110.html
3) Calling an API function from within a critical section or when the scheduler is suspended, or calling an API function that does not end in 'FromISR' from an interrupt. 4) Using a queue or semaphore before it has been initialised or before the scheduler has been started (are interrupts firing before vTaskStartScheduler() has been called?). **********************************************************************/for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
{ /* There is nothing to do here, just iterating to the wanted insertion position. */ } }2018-05-16 02:07 AM
Thank you for your help . I need help and i am debutant
:(
2018-05-16 02:45 AM
No problem, I am here to help you.
I am attaching a simple ready project on FreeRTOS and manual from one of our workshops. It is done on STM32F072 Nucleo board, but can be adapted to any STM Inside you will find a STM32CubeMX project (.ioc file), complete project for Keil uVision, but you can regenerate the code to any other IDE.
I hope it helps.
________________ Attachments : Developing of typical 8-bit application with CubeMX and FreeRTOS.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hxcn&d=%2Fa%2F0X0000000b0G%2FpjYm.WhbfFlQsDQ_M1S_1L9IFmZWhYGQTmcjkWMm9eo&asPdf=falseDeveloping of typical 8-bit application with CubeMX and FreeRTOS.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hxcx&d=%2Fa%2F0X0000000b0H%2F3NUwOdhBgOG6MIoG3E9zOuO4kS_cz5LPHXyuK8xcHVI&asPdf=false2018-05-16 02:53 AM
I am using STM32479I EVAL BOARD.
Shall I use the project you send me and make the modification in it ?
Thank ou so much