Target halted due to a break instruction in user code(Cause=6 means "Instruction bus error")

Hi,
I am trying to port FreeRtos to PIC32MZ2048EFH144 micro controller. I was created some small applications and able to use demo applications also. now i integrated the main application code which has 18 application tasks. When i am trying to run all of them, i am getting “Target halted due to a break instruction in user code” error in debugger and “General Exception Instruction bus error (cause=6, addr=a5a5a5a5).” message in console.

The below is the execution flow of the tasks running with respective priority numbers outputted the Console:

Resetting nRST Pin

Resetting nRST Pin completed
TCP/IP Stack: Initialization Started

FW_Version is 1:2
****** IP Address :1******

**********Time Sync from Ext to Internal RTC Write completed ***********
POWER ON
Internal RTC Time & Date : 23:39:54 01/22/20

_SYS_Tasks Running at 18
_SYS_RTCC_Tasks Running at 17
_SYS_FS_Tasks Running at 16
_SYS_TMR_Tasks Running at 15
_DRV_SDCARD_Tasks Running at 14
_LED_Control Running at 13
_SDCard_Process Running at 12
_SDCard_LogDeletion Running at 11
_SYS_Tasks Running at 18
_SYS_RTCC_Tasks Running at 17
_SYS_FS_Tasks Running at 16
_SYS_TMR_Tasks Running at 15
_DRV_SDCARD_Tasks Running at 14
_LED_Control Running at 13
_SDCard_Process Running at 12
_SDCard_LogDeletion Running at 11
_SYS_Tasks Running at 18
_SYS_RTCC_Tasks Running at 17
_SYS_FS_Tasks Running at 16
_SYS_TMR_Tasks Running at 15
_DRV_SDCARD_Tasks Running at 14
_LED_Control Running at 13
_SDCard_Process Running at 12
_SDCard_LogDeletion Running at 11
_SYS_Tasks Running at 18
_SYS_RTCC_Tasks Running at 17
_SYS_FS_Tasks Running at 16
_SYS_TMR_Tasks Running at 15
_DRV_SDCARD_Tasks Running at 14
_LED_Control Running at 13
_SDCard_Process Running at 12
_SDCard_LogDeletion Running at 11
_SYS_Tasks Running at 18
_SYS_RTCC_Tasks Running at 17
_SYS_FS_Tasks Running at 16
_SYS_TMR_Tasks Running at 15
_DRV_SDCARD_Tasks Running at 14
_LED_Control Running at 13
_SDCard_Process Running at 12
_SDCard_LogDeletion Running at 11MVB INIT SUCCESS

_MVB_Data_Process Running at 10
step-1

step-2

_SYS_Tasks Running at 18
_SYS_RTCC_Tasks Running at 17
_SYS_FS_Tasks Running at 16
_SYS_TMR_Tasks Running at 15
_DRV_SDCARD_Tasks Running at 14
_LED_Control Running at 13
_SDCard_Process Running at 12
_SDCard_LogDeletion Running at 11VCU COMM TIMEOUT

_MVB_Data_Process Running at 10
GPRS Modem Power ON*

GPRS Module Powered ON

_Gprs_StateMachine Running at 9
_GpsDataRx Running at 8
_RecordMVBEventRecorderData Running at 7
_HttpStreamDatapost Running at 6
_TCP_Tasks Running at 5
_WDT_Trigger Running at 4
_LocoConfig_to_EEPROM Running at 3
_APP_Tasks Running at 2
_SYS_Tasks Running at 18
_SYS_RTCC_Tasks Running at 17
_SYS_FS_Tasks Running at 16
_SYS_TMR_Tasks Running at 15
_DRV_SDCARD_Tasks Running at 14
_LED_Control Running at 13
_SDCard_Process Running at 12
_SDCard_LogDeletion Running at 11
_MVB_Data_Process Running at 10AT

_Gprs_StateMachine Running at 9
_GpsDataRx Running at 8
_RecordMVBEventRecorderData Running at 7
_HttpStreamDatapost Running at 6
_TCP_Tasks Running at 5
_WDT_Trigger Running at 4
_LocoConfig_to_EEPROM Running at 3
_APP_Tasks Running at 2
_SYS_Tasks Running at 18
_SYS_RTCC_Tasks Running at 17
_SYS_FS_Tasks Running at 16
_SYS_TMR_Tasks Running at 15
_DRV_SDCARD_Tasks Running at 14
_LED_Control Running at 13
_SDCard_Process Running at 12
_SDCard_LogDeletion Running at 11
_MVB_Data_Process Running at 10At CMD Time OUT -> AT

_Gprs_StateMachine Running at 9
_GpsDataRx Running at 8
_RecordMVBEventRecorderData Running at 7
_HttpStreamDatapost Running at 6
_TCP_Tasks Running at 5
_WDT_Trigger Running at 4
_LocoConfig_to_EEPROM Running at 3
_APP_Tasks Running at 2
_SYS_Tasks Running at 18
_SYS_RTCC_Tasks Running at 17
_SYS_FS_Tasks Running at 16
_SYS_TMR_Tasks Running at 15
_DRV_SDCARD_Tasks Running at 14
_LED_Control Running at 13
_SDCard_Process Running at 12
_SDCard_LogDeletion Running at 11
_MVB_Data_Process Running at 10AT

_Gprs_StateMachine Running at 9
_GpsDataRx Running at 8
_RecordMVBEventRecorderData Running at 7
_HttpStreamDatapost Running at 6
_TCP_Tasks Running at 5
_WDT_Trigger Running at 4
_LocoConfig_to_EEPROM Running at 3
_APP_Tasks Running at 2

General Exception Instruction bus error (cause=6, addr=a5a5a5a5).

Considerations:

  1. Initially i was able to run from 18 to 10, then system got into exceptional error. then i went through Execution memory and found problem in 9th priority task in which one Do{} while() loop stopping the system. So after avoiding that , now running full tasks i.e from 18 to 2(task 1 was not created) .
    In this situation i thought a watch Dog timer resets the application as scheduler hide in do{} while() loop. is it Correct??
  2. after solving the first case, i was able to run all the task up to 3 iterations, but again the system got into exceptional error. this time i am not able to find the error.
  3. I am using 4 uarts . 1 for GPS which continuously causing interrupt and 2 for GPRS and 3 for COM port. In addition i am using Ethernet, SD card etc mentioned above in console output.
    Please help me as early as possible .

Thank you in advance.

As I’m not familiar with your application I have no way of knowing.

This is the value the stack is filled with when a task is created, so it looks like a stack or other corruption issue. Are you familiar with this page https://www.freertos.org/FAQHelp.html - it lists things like how to check for stack overflows, how to use configASSERT(), etc. to help you during development.

I would also recommend familiarising yourself with the “Interrupt Service Routines” section on this PIC32 specific page: https://www.freertos.org/PIC32MZ_RTOS_MIPS_M14K.html

Thank you Sir,
My problem solved. The bug is in UART ISR in which i am calling SYSCONSOLEPRINT(); So RTOS doesnot allow to switch another operation without using proper ISR API’s given by FREERTOS like GiveFromISR();. So when i removed it apllication working fine.