Hello All,
I have a problem when I enable the assert functionality in
freeRTOSconfig.h , the assert is referent to the priority grouping and the max level of interrupts.
~~~
configASSERT( ( portAIRCR
REG & portPRIORITYGROUP_MASK ) <= ulMaxPRIGROUPValue );
~~~
FreeRtos: v9.00
Compiler: GCC
System: Cortex-M3
NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
I had been cheking the values obtains during the xPortStartScheduler:
~~~
Save the interrupt priority value that is about to be clobbered. */
ulOriginalPriority = *pucFirstUserPriorityRegister;
/* Determine the number of priority bits available. First write to all
possible bits. */
*pucFirstUserPriorityRegister = **portMAX_8_BIT_VALUE**;
/* Read the value back to see how many bits stuck. */
ucMaxPriorityValue = *pucFirstUserPriorityRegister;
/* Use the same mask on the maximum system call priority. */
ucMaxSysCallPriority = configMAX_SYSCALL_INTERRUPT_PRIORITY & ucMaxPriorityValue;
/* Calculate the maximum acceptable priority group value for the number
of bits read back. */
ulMaxPRIGROUPValue = portMAX_PRIGROUP_BITS;
In this point ucMaxPriorityValue = 248
while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE )
{
ulMaxPRIGROUPValue--;
ucMaxPriorityValue <<= ( uint8_t ) 0x01;
}
/* Shift the priority group value back to its position within the AIRCR
register. */
In this point ulMaxPRIGROUPValue = 2;
ulMaxPRIGROUPValue <<= portPRIGROUP_SHIFT;
ulMaxPRIGROUPValue &= portPRIORITY_GROUP_MASK;
~~~
acording with the documentation in http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html, usually the ucMaxPriorityValue is 11110000b or 11100000b depending of the priority group selected but when I read this register with my microcontroller the result value is 11111000b and I suppose that my microcontroller has five bits to select the max priorty, for this reason when FreeRTOS calculates the maximun acceptable priority group result is 512 and assume that the priority groupt is two.
so, when FreeRTOS makes the comparation it see this values:
portAIRCR
REG & portPRIORITYGROUP_MASK = 0x300
ulMaxPRIGROUPValue = 200
and the assert stops the scheduler.
I had solutioning this issue changing the next value:
~~~
define portTOPBITOFBYTE ( ( uint8t ) 0x80 )
~~~
for
~~~
define portTOPBITOFBYTE ( ( uint8t ) 0xD0 )
~~~
and the issue is solved, but I’m not sure that this is the correct solution, please if anyone had the same o similar problem please help me.
Thank you for your support.