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.

TMS570LS1114: Abort Data by reading ADC values

Part Number: TMS570LS1114

Hello all,

 I am struggling with problem Data Abort by reading ADC values. Actually in my project, I have configured ADC triggered by HET every 100us.

    The interrupt occurs well but by reading ADC values in function on the line  uint32 index = (adc == adcREG1) ? 0U : 1U;

uint32 adcGetData(adcBASE_t *adc, uint32 group, adcData_t * data)
{
uint32 i;
uint32 buf;
uint32 mode;
uint32 index = (adc == adcREG1) ? 0U : 1U;

uint32 count;

adcData_t *ptr = data;

}

I got Data Abort. I guess it's problem with HEAP because when I commented out this line, I got again the same problem with adcData_t *ptr = data;

It's my linker script 

/* Linker Settings */
--stack_size=0x0800
--heap_size=0x0100
--retain="*(.intvecs)"

/*----------------------------------------------------------------------------*/
/* Memory Map */
MEMORY{
VECTORS (X) : origin=0x00000000 length=0x00000020
FLASH0 (RX) : origin=0x00000020 length=0x000FFFE0
STACKS (RW) : origin=0x08000000 length=0x00001300
RAM (RW) : origin=0x08001300 length=0x0001ED00
}

/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS{
.intvecs : {} > VECTORS
.text : {} > FLASH0
.const : {} > FLASH0
.cinit : {} > FLASH0
.pinit : {} > FLASH0
.bss : {} > RAM
.data : {} > RAM
.heap : {} > RAM
.sysmem : {} > RAM
}

In my project I am using FreeRTOS, the Serial Interface works fine. The task for ADC configured with stack 4096bytes.

Do you have any idea? Thanks in advanced.

  • Something more: I call the function 

    uint32 adcGetData(adcBASE_t *adc, uint32 group, adcData_t * data)
    {
    uint32 i;
    uint32 buf;
    uint32 mode;
    uint32 index = (adc == adcREG1) ? 0U : 1U;

    uint32 count;

    adcData_t *ptr = data;

    }

    in the notification.c, it means in interrupt routine, when I moved this part to the task (I use FreeRTOS), then everything is ok. It means: I can do uint32 index = (adc == adcREG1) ? 0U : 1U; or adcData_t *ptr = data; without any problem.

    As I said before, it might be related to HEAP, but I don't really know why.

    Thanks. 

  • Hello,

    The total amount of available heap space is set by configTOTAL_HEAP_SIZE  which is defined in FreeRTOSConfig.h.The xPortGetFreeHeapSize() API function returns the total amount of heap space that remains unallocated (allowing the configTOTAL_HEAP_SIZE setting to be optimized).

    I don't know how freeRTOS allocates memroy for tasks, message queues, semaphores, mutextes, etc. You can compare the heap space used before and after  the ISR is moved to task.

  • Hi QJ,

    I solved the problem. The main problem was by Start-up procedure  and the setting with linker script.

    I took the demo project from FreeRTOS, unfortunately in the start-up procedure were missing the self-test  + BIST and the linker script not defined well for the RTOS. Well, after generating the project from HAL CoGEN  + manual modification, now I can see how ADC triggered by HET...