"vPortSetInterruptMask" erro...

francisco-moon wrote on Monday, March 26, 2012:

Hello, Somebody who help me…

Please help me… I don’t know what’s wrong.

- STM32F2x7_ETH_Lwip + 3 task (I made 3 tasks)
- MDK-ARM

I sometimes got a HardFault_Handler.

Call stack + Locals (I can see below call stack when i got a hardfault_handler)

- HardFault_Handler         0x08019892
- vPortSetInterruptMask    0x0800020A
- xPortSysTickHandler      0x0804CA06

I don’ know what’s wrong.

=========================================================================================
added 3 tasks

xTaskCreate(uart_task, “UART_DEBUG”, configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO+1, NULL);
xTaskCreate(uart_timer_task, “UART_TIMER”, configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);
xTaskCreate(CDS_ITF_task, “CDS_IFT”, 7168, NULL, 10, NULL);

===============================================================================================
FreeRTOSConfig.h

#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK         0
#define configUSE_TICK_HOOK         0
#define configCPU_CLOCK_HZ              ( ( unsigned long ) 120000000 )
#define configTICK_RATE_HZ         ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 15 ) //7->8
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 50*1024))//70 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES               1
#define configUSE_COUNTING_SEMAPHORES   1
#define configUSE_MALLOC_FAILED_HOOK    0

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */

#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources         0
#define INCLUDE_vTaskSuspend 0
#define INCLUDE_vTaskDelayUntil 0
#define INCLUDE_vTaskDelay         1

/* 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_PRIORITY 15

rtel wrote on Monday, March 26, 2012:

I don’t think the code you posted can help remote diagnostic without seeing the task code.

Did you start with a working project?  Can you go back to that and add back in your code bit by bit until the problem replicates? 

Do you have stack overflow checking turned on.

Have you ensured all the topics on this page are covered?  Especially point 3: http://www.freertos.org/FAQHelp.html

Regards.

francisco-moon wrote on Tuesday, March 27, 2012:

Thanks for your advices.
I did go back to orginal working project. And then I added some code again step by step.
I think I found a problem where occur.

I modified a scatter file to use an external memory.
# scatter file.
LR_IROM1 0x08000000 0x00100000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00100000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  ;RW_IRAM1 0x20000000 0x00020000  {  ; RW data
  ; .ANY (+RW +ZI)
  ;}
  RW_RAM1 0x60000000 0x00100000  {  ; RW data
   .ANY (+RW +ZI)
   heap_2.o (+RW +ZI) 
   tasks.o (+RW +ZI)
  }
  RW_IRAM1 0x20000000 0x00020000  {
   startup_stm32f2xx.o (+RW +ZI)
   stm32f2xx_rcc.o (+RW +ZI)
   stm32f2x7_eth.o (+RW +ZI)

  }
}

It was mainly cause. But I don’t have any ideas to clear it.

If you have any ideas, please give me some ideas.

Regards

francisco-moon wrote on Thursday, March 29, 2012:

I added back in my code bit by bit. When I use an external ram, It always occurred.

In the beginning, it works well.
But after some minutes, I got a problem about systick handler.
Before crash the system, the system works slowly. And then the system crash…

What do I do anything else?

Please give me some ideas…

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x08000000 0x00100000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00100000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  RW_RAM1 0x60000000 UNINIT 0x00100000  {  ; RW data
   heap_2.o(+RW +ZI)
  }
  RW_IRAM1 0x20000000 0x00020000  {
   .ANY (+RW +ZI)
  }
}


startup code

__initial_sp
__initial_spTop EQU    0x20000400                 ; stack used for SystemInit & SystemInit_ExtMemCtl
.
.
.  
;__Vectors       DCD     __initial_sp               ; Top of Stack
__Vectors       DCD     __initial_spTop            ; Top of Stack