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.

TMS570LS0914: workaround with ADC DMA

Part Number: TMS570LS0914
Other Parts Discussed in Thread: HALCOGEN

Dear TI-Support,

This ticket is related to an other post:

In short:
It appeared that the results of 4 adc - conversions were swapped after an undefined time, when we are using the dma modul, in fact the ADC result was invalid and the same ADC channel was triggered again. So the new value of the result was not in the expected ADC buffer and the DMA copied the invalid value to the application buffer.

Original:
https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1102375/tms570ls0914-adc-groupconversion-triggered-by-dma-generates-faulty-buffer-values-after-few-hours/4122409#4122409

To solve this problem, we set the element count of the dma modul to 8 even though G2_BLOCKS was still 4.
The idea was that dma would copy all adc->G2BUF[0-7] after a dma request was triggered.
In our application we discard all invalid results.
Using a block transfer IRQ triggered at the end of 10 DMA frames(frame count = 10), we measure the time between each IRQ.
After an undefined time, the IRQ is triggered every 2-3ms instead of every 10ms.

We don't know why the IRQ triggers that early.

As new workaround we think to use ADC port A and port B on two different DMA request lines (11 and 17). At the same time we decrease the fifo size from 16 to 2 or 4.

A) What would you recommend?

B) Btw, where are the results stored if we use a fifo size greater than 8? 16 Was Halcogen's default value, althouh there are only 8 buffer register?


We enable G2_BLK_XFER with size 2. In our application we check if the G2_EMPTY flag is set and only copy the values ​​if the bit is not set.

c) What does no valid data mean for ADC?

d) When does the block transfer trigger the DMA request? If we set G2_BLK_XFER  to2, will a request be generated after the second valid or after the seconf measurement?

  • A) What would you recommend?

    My recommendation is:

    DMA Element Count = G2_Blocks = Fifo Size

    B) Btw, where are the results stored if we use a fifo size greater than 8? 16 Was Halcogen's default value, althouh there are only 8 buffer register?

    If the converted data in FIFO (buffer 0 ~ buffer 7) have been copied to SRAM, the new conversion data will be written to FIFO starting at FIFO[0]. If data has not been read out from FIFO, the new conversion data will be written to FIFO[16:8].

    If DMA_EN and BLK_XFER are enabled, the data should be read out before the next conversion starts.

    c) What does no valid data mean for ADC?

    There is a hardware mechanism to protect the application from reading the invalid data in the FIFO. Once all available conversion results have been read out of the FIFO, a  subsequent read from the FIFO causes the mechanism to indicate that the FIFO is empty by setting the EMPTY field.

    d) When does the block transfer trigger the DMA request? If we set G2_BLK_XFER  to2, will a request be generated after the second valid or after the seconf measurement?

    G2_BLK_XFER can be programmed to 0x0 or 0x1. 2 is not valid. 

    G2_BLK_XFER = 1 --> ADC module generates a DMA request when the ADC has written G2_BLOCKS number of buffers into the Group2 memory.

  • Thank you, we will try it. In d) we meant "If we set G2_BLOCKS to2, .[..]", but i guess its answered anyway.

  • we have noticed that the value of  G2_BLOCKS is changing during runtime. in the adc_init it is set to 2.
    while our applcation runs,we send out the value over CAN and the value is flucuating between 1-8.

    Do you have an idea, why it is changing?

    __

    Edit: we habe observed, if we set GxINTCR = Fifo_size , G2_BLOCKS is set to Fifo_size as well. Now Fifo size is set to 2.

  • The "FIFO Size" on HALCOGEN GUI configures the group's interrupt threshold counter. That is, how many conversions should the ADC accumulate for that group before it generates the group's threshold interrupt flag. For a single conversion sequence the ADC will always convert the number of channels selected and then stop.