This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Stack errors with TI-RTOS and Tiva C launchpad

Hello:

In my application, I seem to be having issues with task stacks.

My application aborts after running for a short period of time. 

My application uses TI-RTOS on the TM4C123GXL launchpad.

The SYS/BIOS version is 6.35.4.50

The application is intended to read various data via ADCs as well as from an accelerometer accessed via I2C.
I have been able to access, set up and read the MEMS accelerometer.  

My plan is to use Timer2 to trigger the ADC, and use the ADC interrupt as well as a GPIO interrupt to signal that data is ready. I have tested and verified that these HWIs are entered and data is read.

So here is the problem. The program runs for a short time and aborts. The logs show that it will access the I2C and clear interrupts as to be expected. However, instead of running continuously. it will suddenly abort. It always aborts in Task.c when checking stack pointers. I have attached a screen capture of the CCS Debug screen showing error messages and the point in Task.c when execution was aborted.

To try to solve this, I commented out various functions in my code. I also disabled the ADC interrupt. However, the problem persists. I don't understand the code in Task.c, and the ROV logs do not give me any hints as to what is causing this fault.

Thank you

Dale

8053.CCS Debug Screen Shot.docx

  • Dale,

    The first thing that comes to mind is that you might be overflowing your tasks' stack. When the program fails can you open ROV and send me a snapshot of the Detailed view of the Task module? Also are you using the TI-RTOS I2C drivers? If you are, what version of TI-RTOS are you using?

    Thanks,

    Moses

  • Hi Moses

    Here is the screen shot of the ROV Detailed Task module

    I am using TI-RTOS for Tiva C version 2.1.0.03. I am using the TI-RTOS I2C drivers.

    4035.Task Module.docx

    Thank you

    Dale

  • Dale,

     From ROV your  task stack looks healthy. I still don't have enough information to narrow this down. I see from ROV that the DataGather task was running before the abort. What are you doing in that task? Where in that task does it fail? Can I see how you setup the I2C driver? Your cfg file will also be useful to help me narrow the problem down.

    There's also a chance that you might be corrupting the task stack pointer. Are using any heap?

    Thanks,
    Moses

  • Hi Moses:

    The purpose of DataGather() is to read data from the MEMS accelerometer and ADCs when data is available. 

    I have included main.c and app.cfg, the main.c contains the I2C driver configuration as well as DataGather().

    Examining the list of functions that led to the abort, DataGather is not on the list, but MEMSIntHandler is where it seems to interrupt. This function is also in main.c. The purpose of this interrupt handler is to post a semaphore (MEMSReady) when the data from the MEMS sensor is ready. The MEMS sensor is configured to send an interrupt back to the MCU when data is ready. This interrupt appears at the MCU at GPIO Port A Pin 6. The steps ideally I would eventually like to get into the DataGather() routine are as follows:

    1. A request is made to read 6 bytes of data from the MEMS. This 6 bytes will be X, Y and Z axis acceleration values.
    2. The request will pend on the 'MEMSReady' semaphore.
    3. When the data is read, DataGather will then pend on a semaphore indicating that the ADC data is available.
    4. DataGather will then read the ADC data.
    5. All these data points will be placed in an array for use by the control routine.

    You will see in my file I commented out the ADC statements, to see if that could be the cause of the error.

    I have not configured any heap, unless it has been configured by RTOS.

    Let me know what other information I can provide.

    If necessary, I can export the project and send the archive file.

    Thank you

    Dale

    3404.main.c

    8715.app.cfg

  • Dale,

    First thing I see is that you're creating a Hwi for the GPIO interrupt in your cfg file. There's no need for that as the GPIO_setupCallbacks internally creates a Hwi for the GPIO. I don't see the code where you set up the I2C and GPIO pins, I can assume it's alright since at least you're able to get interrupts. Fix this and test it.

    Regarding the heap, in your *cfg file I see BIOS.heapSize is set to 0. So if you're doing any dynamic module creates or any memory allocation, then that will be an issue.

    I'll need more information. You said the program runs and aborts in the MEMSIntHandler. Is it the first time it runs that ISR that it aborts? Can I see what the console window displays when its aborts (abort message)? When it aborts can you open ROV, go to the BIOS module and go to the Scan for errors tab. I'd like to see what error is displayed there.

    Thanks,

    Moses

  • Hi Moses:

    It looks like the issue was having 2 separate instances of the HWI for the GPIO. I removed the MEMSInterrupt HWI from my app.cfg. The program now runs without any problems. 

    I can now proceed to add the ADC routines to my code and test further.

    Thank you

    Dale