Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

vTaskDelay cause system halt

Posted by vincent on August 17, 2013
Hi:

I use STM32 chip to receive data vai 485 bus. and my receive routine as followed:
static void rs485_plus_rx_routine(void)
{
rs485_plus_rx_flag = 0;
rs485_plus_rx_count = 0;
rxtimeout_plus = 0;
cmdrsppacketsize_plus = 0;

while (!rs485_plus_rx_flag)
{
if (rxtimeout_plus ++ > SLIP_RX_TIMEOUT_PLUS)
{
break;
}
vTaskDelay(1);
}
}
after running some hours, system halt, I printf some debug info and found system halt in vTaskDelay(1) function. never exit. Who know why ?

Vincent

RE: vTaskDelay cause system halt

Posted by Richard on August 17, 2013
I'm not sure that simple debug printf()'ing, which will radically change the behaviour of the code you are testing, is accurate enough to know exactly where the problem lies. For example, vTaskDelay() will cause a switch to another task - so you don't know if the problem occurs when you call the function, in the function, or the task it switches to.

Are you using FreeRTOS V7.5.2? If not I would recommend switching to it as it has some extra diagnostic functionality, some of which was put in specifically for users of the STM32 peripheral driver library - which has some unique characteristics.

When you are using V7.5.2 ensure configASSERT() is defined, along with the normal stack overflow checking, etc.

Also look at http://www.freertos.org/FAQHelp.html

Regards.

RE: vTaskDelay cause system halt

Posted by vincent on August 17, 2013
HI Rechard:

I am using 7.4.2. the total stack size of all task is 22K, but i set system heap to 32K . I don't know it is enough or not .


vincent

RE: vTaskDelay cause system halt

Posted by Dave on August 17, 2013
That would seem like a lot of stack, so it is probably ok, but we don't know how your application is using the stack. If you followed Richard's suggestions you would know, rather than still have to guess.

RE: vTaskDelay cause system halt

Posted by vincent on August 18, 2013
Hi:

I running my application with FreeRTOSv7.5.2 and enable configASSERT, but i don't see any ASSERT when system halt.
does it mean it is my application problem ?
xTaskCreate(dhcp_task, "DHCPDOG", configMINIMAL_STACK_SIZE*3, NULL,DHCP_TASK_PRIO, &dhcphandle);
xTaskCreate(oled_task,"OLED", configMINIMAL_STACK_SIZE*2, NULL, OLED_TASK_PRIO, &oledhandle);
xTaskCreate(log_task,"LOG",configMINIMAL_STACK_SIZE*2,NULL, LOG_TASK_PRIO, &loghandle);
xTaskCreate(serial_task,"COM", configMINIMAL_STACK_SIZE*4,NULL, COM_TASK_PRIO, NULL);
xTaskCreate(relay_task,"RELAY", configMINIMAL_STACK_SIZE*3, NULL, RS485_TASK_PRIO, &pduhandle);
xTaskCreate(daisyqna_task,"DSYQNA",configMINIMAL_STACK_SIZE*3, NULL, DAISYCHAIN_TASK_PRIO, NULL);
xTaskCreate(sensor_task,"SENSOR",configMINIMAL_STACK_SIZE*3,NULL, SENSOR_TASK_PRIO, &sensorhandle);

xTaskCreate(svrrch_task,"SVRRCH",configMINIMAL_STACK_SIZE*2,NULL, SVRRCH_TASK_PRIO, &svrhandle);
xTaskCreate(ftp_task,"FTP", configMINIMAL_STACK_SIZE*3,NULL,FTP_THREAD_PRIO, &ftphandle);
xTaskCreate(telnet_task,"TELNET",configMINIMAL_STACK_SIZE*4,NULL, TELNET_THREAD_PRIO, &telnethandle);
xTaskCreate(ssh_task,"SSH", configMINIMAL_STACK_SIZE*5,NULL, SSHSERVER_THREAD_PRIO,&sshhandle);
xTaskCreate(http_task,"HTTP", configMINIMAL_STACK_SIZE*6, NULL, HTTPSERVER_THREAD_PRIO, &httphandle);
above is my all tasks except TCPIP and ETHERNET tasks.


RE: vTaskDelay cause system halt

Posted by Dave on August 18, 2013
“does it mean it is my application problem”


Not definitely, but to be blunt, most likely. I can't remember the last time a support request originated from a bug in the code. Most problems arise from bad configuration options or just simple application coding errors. If you think about it that is logical though. The kernel is a small piece of code used by thousands of people over a long period of time. Application code is normally much larger and brand new. All code has bugs in it though.

I would recommend cutting your application down to its bones. Run just a few tasks, test, then incrementally add more until the problem recurs, then back track a little and debug.

RE: vTaskDelay cause system halt

Posted by vincent on August 18, 2013
yes, my tasks is more complex. before I don't add DAISYCHAIN task, all tasks work well in single device.
once adding DAISYCHAIN task, system halt happen. DAISYCHAIN task use other 485 channel to poll data. there is other task use one 485 channel to polling data. I seperate the data buffer in enough array. i trace the DAISYCHAIN task to find where system. the result is I post previous.
I start to guess FATFS conf, there is a File REENTRANT feature,I enable it.... don't know if it is root cause.

vincent

RE: vTaskDelay cause system halt

Posted by Richard Damon on August 18, 2013
First suggestion, make sure you have turned on stack overflow checking to see if every task has enough stack as stack overflows can cause all sorts of strange problems.

Related to this, you are defining all your stack sizes as configMINIMUM_STACK_SIZE*n, this is normally a bad idea. configMINIMUM_STACK_SIZE is set to be enough to cover the system overhead and some minimal amount of base stack for the tasks (enough for the idle task). If your task needs additional space, that space is almost assuredly not based on this value, but an absolute number of bytes, so your stack sizes should be of the form configMINIMUM_STACK_SIZE+n (with a different n).

The second likely source of the problem is an interrupt with the wrong priority or using a non FromISR API routine, which can cause data corruption inside FreeRTOS.

Lastly, looking at the code for the function, it looks like it would be better for the ISR to use a semaphore to signal when data was available, rather than polling on a data flag. (Unless there is some reason the ISR can not have an interrupt priority compatible with this). By polling you will not start to process the data until the time tick after the data arrives, and are using CPU time to run the loop while waiting.

And finally, debugging through routines like vTaskDelay can be tricky as these routines do context switches inside of them selves, so you can easily end up inside another tasks operation.

RE: vTaskDelay cause system halt

Posted by vincent on August 18, 2013
I set 485 and 485plus and ethernet NVIC as following, would you help check it is problem or not ?
static void RS485_NVIC_Config(void)
{
NVIC_InitTypeDef NVIC_InitStructure;

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
static void RS485_plus_NVIC_Config(void)
{
NVIC_InitTypeDef NVIC_InitStructure;

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void ETH_NVIC_Config(void)
{
NVIC_InitTypeDef NVIC_InitStructure;

/* 2 bit for pre-emption priority, 2 bits for subpriority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);

/* Enable the Ethernet global Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = ETH_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}

RE: vTaskDelay cause system halt

Posted by Richard on August 19, 2013
Your code is wrong, and FreeRTOS V7.5.2 has traps specifically to catch this error (if you use it with configASSERT()) defined.

Go to the link I posted in my first reply. At the top of that page you will see "a special note for Cortex-M3 users", with a link to "A page dedicated to explaining the ARM Cortex-M interrupt behaviour". On that page you will find some bold red text that says "A special note for STM32 users" ---- that note has the answer you are looking for.

Regards.

RE: vTaskDelay cause system halt

Posted by vincent on August 19, 2013
I saw the node before.before RTOS schedule , it must set NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );

but, when could I set NVIC_PriorityGroupConfig( NVIC_PriorityGroup_2); after OS running ? or only set NVIC_PriorityGroup_4 as default value ?

I enable configASSERT, but i don't catch the trap .
if the interrupt configure is wrong, why does it run so long to be hatl ?

RE: vTaskDelay cause system halt

Posted by Richard on August 19, 2013
“when could I set NVIC_PriorityGroupConfig( NVIC_PriorityGroup_2); after OS running ? ”


You can't use that setting very easily. All priority bits must be set to preemption priority if you want a simple system. If any other setting is used then the interrupt masking to correctly implement interrupt nesting will be very complex.

“I enable configASSERT, but i don't catch the trap .”


Please post your configASSERT() implementation.

Regards.

RE: vTaskDelay cause system halt

Posted by vincent on August 19, 2013
understand .
I only define configASSERT printf("%s %d \n", __FILE__, __LINE__) in freertosconfig.h

RE: vTaskDelay cause system halt

Posted by vincent on August 19, 2013
i set NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4); before system run , system still halt after running some while

vincent

RE: vTaskDelay cause system halt

Posted by Dave on August 19, 2013
“I only define configASSERT printf("%s %d \n", __FILE__, __LINE__) in freertosconfig.h”


and are you sure printf() is working. Besides which, that particular test is done in an interrupt, so printf() is probably not going to work as you expect and may even overflow the interrupt stack.

Normally configASSERT() will not return because if it is triggered there is an error that needs attention. If you add a null loop to your definition (for(;;);) then you will know when it is called because your code will stop in the loop.

RE: vTaskDelay cause system halt

Posted by vincent on August 19, 2013
I change my NVIC code as following
static void RS485_NVIC_Config(void)
{
NVIC_InitTypeDef NVIC_InitStructure;

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
static void RS485_plus_NVIC_Config(void)
{
NVIC_InitTypeDef NVIC_InitStructure;

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =3;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void ETH_NVIC_Config(void)
{
NVIC_InitTypeDef NVIC_InitStructure;

/* 2 bit for pre-emption priority, 2 bits for subpriority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);

/* Enable the Ethernet global Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = ETH_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
system halt in the line ..\USER\FreeRTOS_v7.5.2\queue.c 560
could you help to check this ?

vincent

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
Hi:

is there a latest port.c for MDK ? I found that i always use old port.c . so ,I don't catch the trap .

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
I use the FreeRTOSV7.5.2\FreeRTOS\Source\portable\GCC\ARM_CM3 port.c and portmirco.h to compile , and compile fail. more error and worning happen.

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
do need update it MDKv4.72a ?

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
Post the compiler ERROR and WARNING
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(135): warning: #1207-D: attribute "naked" ignored
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(137): warning: #1207-D: attribute "naked" ignored
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(142): warning: #1207-D: attribute "naked" ignored
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(177): warning: #191-D: type qualifier is meaningless on cast type
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(218): warning: #1267-D: Implicit physical register R3 should be defined as a variable
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(218): error: #1086: Operand is wrong type
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(218): error: #114: label "pxCurrentTCBConst2" was referenced but not defined
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(232): warning: #1267-D: Implicit physical register R0 should be defined as a variable
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(232): error: #29: expected an expression
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(248): warning: #191-D: type qualifier is meaningless on cast type
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(346): warning: #1207-D: attribute "naked" ignored
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(354): error: #18: expected a ")"
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(363): warning: #1207-D: attribute "naked" ignored
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(369): error: #18: expected a ")"
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(407): error: #18: expected a ")"
..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c(592): error: #18: expected a ")"

assemable code compile error

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
I use the portable files under \FreeRTOSV7.5.2\FreeRTOS\Source\portable\RVDS\ARM_CM3 and configure NVIC for each IRQ by refer to FreeRTOS\Demo\CORTEX_A2F200_IAR_and_Keil... system can't run .
I also find that the demo don't use the NVIC_SETGROUP, only call NVIC_setPrioirty and NVIC_enableIRQ function to configure, does it work?

RE: vTaskDelay cause system halt

Posted by Richard on August 20, 2013
“I use the FreeRTOSV7.5.2\FreeRTOS\Source\portable\GCC\ARM_CM3 port.c and portmirco.h to compile , and compile fail. more error and worning happen.”


“do need update it MDKv4.72a ?”


You can't build GCC files with the Keil compiler. That is why there is a separate port for Keil (and IAR, and Tasking...)


“I also find that the demo don't use the NVIC_SETGROUP”


The only time you should need to set the priority group is if you are using the STM32 peripheral driver libraries. In all other cases you can leave it at its default value, so the port layer code does not set it. As you are using the libraries you must set it, as we have already discussed.

Regards.

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
I get it done . rechards is right , the validate interrupt prioirty trap is catched. it happen in..\USER\FreeRTOS_v7.5.2\portable\MDK-ARM\ARM_CM3\port.c 650
any ISR calling FREERTOS API 's prioity must set to lowest priolirty, i set it to configKERNEL_INTERRUPT_PRIORITY which define in freertosconf.h
/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255
(lowest) to 0 (1?) (highest). */
#define configKERNEL_INTERRUPT_PRIORITY 255
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xb0, or priority 11. */


/* This is the value being used as per the ST library which permits 16
priority values, 0 to 15. This must correspond to the
configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest
NVIC value of 255. */
#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY15

i have eeprom, serial, rs485, rs485plus, ethernet interrupt, only ethenet use freertos api .
so, i set other interrupt prioity to 0, and set ethernet interrtup to configKERNEL_INTERRUPT_PRIORITY.
and before task schedule, i set NVIC GROUP TO 4.
all things seems work now , I also enable ASSERT to catch other trap if it exist.


RE: vTaskDelay cause system halt

Posted by Richard on August 20, 2013
“I change my NVIC code as following”


... but that is still calling NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); instead of NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

Regards.

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
I changeed it to NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
it works well

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
HI rechard:

I post all interrrupt configuration as following:
NVIC_SetPriority( SERIAL_PORT_IRQn, 0 );
NVIC_EnableIRQ( SERIAL_PORT_IRQn );
NVIC_SetPriority( USART1_IRQn, 0 );
NVIC_EnableIRQ( USART1_IRQn );
NVIC_SetPriority( USART3_IRQn, 0 );
NVIC_EnableIRQ( USART3_IRQn );

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
NVIC_SetPriority( ETH_IRQn, configKERNEL_INTERRUPT_PRIORITY );
NVIC_EnableIRQ( ETH_IRQn );

/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255
(lowest) to 0 (1?) (highest). */
#define configKERNEL_INTERRUPT_PRIORITY 255
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xb0, or priority 11. */


/* This is the value being used as per the ST library which permits 16
priority values, 0 to 15. This must correspond to the
configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest
NVIC value of 255. */
#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY15

only ethernet ISR use FreeRTOS api, so above interrupt configruation is okay ?

vincent

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
before RTOS runing, I set EEPROM RX and TX interrupt as followed
void eeprom_nvic_update(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
NVIC_SetPriority( I2C_EE_DMA_TX_IRQn, configKERNEL_INTERRUPT_PRIORITY );
NVIC_EnableIRQ( I2C_EE_DMA_TX_IRQn );
NVIC_SetPriority( I2C_EE_DMA_RX_IRQn, configKERNEL_INTERRUPT_PRIORITY );
NVIC_EnableIRQ( I2C_EE_DMA_RX_IRQn );
}
,then, I use it to read data from EEPROM, system halt in read eeprom API.
I change configKERNEL_INTERRUP_PRIOIRTY to 0, it works.. why ?

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
wooo, system halt again . configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ) is catched !!! what does it mean ?

RE: vTaskDelay cause system halt

Posted by Dave on August 20, 2013
It means you are passing a null pointer into the function. That would probably explain why you are having so many problems.

Plus the interrupt priority should probably be set to configLIBRARY_KERNEL_INTERRUPT_PRIORITY as you are passing it into a library function. Check how the function you are calling expects the priority to be passed in, and reread the page about setting Cortex interrupt priorities on the FreeRTOS.org site.

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
I2C's RX and TX interrupt 's prority define to configLIBRARY_KERNAL_INTERRUPT_PRIORITY , RX and TX api can't work before freertos running.
/* Configure and enable I2C DMA TX Channel interrupt */
NVIC_SetPriority( I2C_EE_DMA_TX_IRQn, configLIBRARY_KERNEL_INTERRUPT_PRIORITY );
NVIC_EnableIRQ( I2C_EE_DMA_TX_IRQn );
NVIC_SetPriority( I2C_EE_DMA_RX_IRQn, configLIBRARY_KERNEL_INTERRUPT_PRIORITY );
NVIC_EnableIRQ( I2C_EE_DMA_RX_IRQn );

but I set the priority to 0, it works.

/* Configure and enable I2C DMA TX Channel interrupt */
NVIC_SetPriority( I2C_EE_DMA_TX_IRQn, 0 );
NVIC_EnableIRQ( I2C_EE_DMA_TX_IRQn );
NVIC_SetPriority( I2C_EE_DMA_RX_IRQn, 0 );
NVIC_EnableIRQ( I2C_EE_DMA_RX_IRQn );

other interrrupt works with configLIBRARY_KERNEL_INTERRUPT_PRIORITY priority.
anyone tell me why ? it is strange

RE: vTaskDelay cause system halt

Posted by Dave on August 20, 2013
Interrupts up to the syscall priority level are masked until the scheduler is started. It should work when the scheduler is running, just ensure to set the priority down before you call vTaskStartScheduler().

RE: vTaskDelay cause system halt

Posted by vincent on August 20, 2013
for the trap assert happen in configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) ); in xQueueGenericSend function , but xQueueGenericSend is called in xQueueCreateMutex, I don't enable configUSE_MUTEXES in freertosconfig.h

I am confusing about this

RE: vTaskDelay cause system halt

Posted by vincent on August 21, 2013
Hi:

system halt again, confASSERT still trap in ..\USER\FreeRTOS_v7.5.2\queue.c 560
I define following in freertosconf.h
#define configUSE_MUTEXES 0
#define configUSE_COUNTING_SEMAPHORES 1

i really don't know when call the xQueueGenericSend function in runnig time. any suggestion ?

RE: vTaskDelay cause system halt

Posted by vincent on August 21, 2013
Trace code and find that xSemaphoreGive call the function . but don't find where take this

RE: vTaskDelay cause system halt

Posted by vincent on August 21, 2013
I found that Fatfs crashed once the trap happen, so I trace the code and find that I enable _FS_REENTRANT in ffconf.h and set
#define _FS_TIMEOUT100/* Timeout period in unit of time ticks */
#define_SYNC_txQueueHandle/* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
in syscall.c there are api call xSemaphoreCreateMutex , xSemaphoreTake , xSemaphoreGive, i think the trap happen in here. but I don't know why it happen, the TIMEOUT value is small ?

vincent

RE: vTaskDelay cause system halt

Posted by Richard on August 21, 2013
Unfortunately we cannot support third party code - but from experience of past support requests I would guess your problems come from the implementation of your FATfs driver.

Regards.

RE: vTaskDelay cause system halt

Posted by vincent on August 22, 2013
Hi, I print the xQueue value when the ASSERT happen (queue.c 560), the value is not of those semaphore I create. it is related with ethernet, because the ASSERT never happen once I plug out cable. Does it mean that my LWIP porting has problem ?

RE: vTaskDelay cause system halt

Posted by vincent on August 22, 2013
Sorry, the ASSERT stil happen when plug out cable ...

RE: vTaskDelay cause system halt

Posted by Richard on August 22, 2013
“I print the xQueue value when the ASSERT happen”


Do you mean print it to a console? Are you trying to do this without a debugger? If you have file system and Ethernet code you have a large code base and working without a debugger will be very inefficient.

Regards.

RE: vTaskDelay cause system halt

Posted by vincent on August 22, 2013
I reduce my application in my system, it only has 2 function, one is write a data log by interval 0.5s and another task is polling data via 485. even this, the ASSERT still happen . I want to know if FreeRTOS has Own semaphore or mutex ?
other, so write file frequency will cause the ASSERT ?

RE: vTaskDelay cause system halt

Posted by Richard on August 22, 2013
No - it does not have its own semaphore.

You need to set a break point in the semaphore function, then look at the call stack at that point to know what is calling it. If you are not able to do that because you are not using a debugger then I'm afraid I cannot spend my time assisting any more. If you can do that then you will be able to answer your question within minutes, rather than spending days.

Regards.

RE: vTaskDelay cause system halt

Posted by vincent on August 22, 2013
Sorry, I only has COM , no other debugger , I try to find the answer

RE: vTaskDelay cause system halt

Posted by vincent on August 25, 2013
HI Rechard:

I update the issue status to you . the queue.c 560 assert is cause by FATFS _FS_REENTRANT feature, which create semaphore to allow file system can be reentrant. I disable the function and add new semaphore for my appliction to access file system, the issue never happen again .
But , after runing many hours, system still halt, I trace the code and found that system halt suddenlty in receiving 485 data in interrupt. I don't think it is code issue. because I send and receive 485 data by interrupt.with baudrate 57600, I don't know if the rate bing heavy loading to system. so, I modify send data with polling and only receive data with interrupt, the issue disappear so far. i need run it continualy .


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists