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: ADC1 Event group memory problem

Part Number: TMS570LS0914

Hello,

I wanted to create DMA transfer from ADC based on this thread: "Is there any alternate way to read ADC result data using DMA other than FIFO incase if multiple channels are configured in single group". This is working for ADC1 Group 1 and Group 2 and actually the DMA part is working well with ADC1 Event group as well. But when I checked the memory I found that the event group memory is not good:

0xFF3E0000 0x000014AB 0x00002000 0x0000A000 0x0000A000 0x00008000 0x00008000 0x00008000
0xFF3E001C 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E0038 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E0054 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E0070 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E008C 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E00A8 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E00C4 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E00E0 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E00FC 0x00008000 0x00001000 0x00002000 0x0000A000 0x0000A000 0x00008000 0x00008000
0xFF3E0118 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E0134 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E0150 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E016C 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E0188 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E01A4 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000
0xFF3E01C0 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000

The above memory should be similar to group2:

0xFF3E0070 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x000014A0
0xFF3E008C 0x00002000 0x0000A000 0x00001498 0x00002000 0x0000A000 0x00001494 0x00002000
0xFF3E00A8 0x0000A000 0x000014A5 0x00002000 0x0000A002 0x000014AA 0x00002000 0x0000A000
0xFF3E00C4 0x000014A4 0x00002000 0x0000A000 0x00001000 0x00002000 0x0000A000 0x00001000
0xFF3E00E0 0x00002000 0x0000A000 0x00001000 0x00002000 0x0000A000 0x0000148F 0x00002000
0xFF3E00FC 0x0000A000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000 0x00008000

 I attached the ADC configuration and here is my DMA config as well:

   dmaEnable();

        // dma config for ADC Channel 0
        dma_config.SADD = (uint32_t)0xFF3E0000;
        dma_config.DADD = (uint32_t) ADC_DATA0;
        dma_config.CHCTRL = 0;                             // chain to next channel
        dma_config.FRCNT = 1;
        dma_config.ELCNT = transfer_size;
        dma_config.ELDOFFSET = 0;
        dma_config.ELSOFFSET = 12;
        dma_config.FRDOFFSET = 0;
        dma_config.FRSOFFSET = 0;
        dma_config.PORTASGN  = 4;
        dma_config.RDSIZE    = ACCESS_32_BIT;
        dma_config.WRSIZE    = ACCESS_32_BIT;
        dma_config.TTYPE     = FRAME_TRANSFER;
        dma_config.ADDMODERD = ADDR_OFFSET;
        dma_config.ADDMODEWR = ADDR_INC1;
        dma_config.AUTOINIT  = AUTOINIT_ON;
        // setting dma control packets for ADC Channel 0
        dmaSetCtrlPacket(DMA_CH0, dma_config);

        // dma config for ADC Channel 1
        dma_config.SADD = (uint32_t)0xFF3E0004;
        dma_config.DADD = (uint32_t) ADC_DATA1;
        dma_config.CHCTRL = 0;                             // chain to next channel
        dma_config.FRCNT = 1;
        dma_config.ELCNT = transfer_size;
        dma_config.ELDOFFSET = 0;
        dma_config.ELSOFFSET = 12;
        dma_config.FRDOFFSET = 0;
        dma_config.FRSOFFSET = 0;
        dma_config.PORTASGN  = 4;
        dma_config.RDSIZE    = ACCESS_32_BIT;
        dma_config.WRSIZE    = ACCESS_32_BIT;
        dma_config.TTYPE     = FRAME_TRANSFER;
        dma_config.ADDMODERD = ADDR_OFFSET;
        dma_config.ADDMODEWR = ADDR_INC1;
        dma_config.AUTOINIT  = AUTOINIT_ON;
        // setting dma control packets for ADC Channel 1
        dmaSetCtrlPacket(DMA_CH1, dma_config);

        // dma config for ADC Channel 2
        dma_config.SADD = (uint32_t)0xFF3E0008;
        dma_config.DADD = (uint32_t) ADC_DATA2;
        dma_config.CHCTRL = 0;                             // chain to next channel
        dma_config.FRCNT = 1;
        dma_config.ELCNT = transfer_size;
        dma_config.ELDOFFSET = 0;
        dma_config.ELSOFFSET = 12;
        dma_config.FRDOFFSET = 0;
        dma_config.FRSOFFSET = 0;
        dma_config.PORTASGN  = 4;
        dma_config.RDSIZE    = ACCESS_32_BIT;
        dma_config.WRSIZE    = ACCESS_32_BIT;
        dma_config.TTYPE     = FRAME_TRANSFER;
        dma_config.ADDMODERD = ADDR_OFFSET;
        dma_config.ADDMODEWR = ADDR_INC1;
        dma_config.AUTOINIT  = AUTOINIT_ON;
        // setting dma control packets for ADC Channel 2
        dmaSetCtrlPacket(DMA_CH2, dma_config);

        dmaReqAssign(0,7);                            // MIBADC1 G1 is connected to reqline 10. Map Reqline 10 to DMA channel 0
        dmaReqAssign(1,7);                            // MIBADC1 G1 is connected to reqline 10. Map Reqline 10 to DMA channel 1
        dmaReqAssign(2,7);                            // MIBADC1 G1 is connected to reqline 10. Map Reqline 10 to DMA channel 2

        dmaSetChEnable(0,DMA_HW);                      // Enable DMA channel 0
        dmaSetChEnable(1,DMA_HW);                      // Enable DMA channel 1
        dmaSetChEnable(2,DMA_HW);                      // Enable DMA channel 2

        adcStartConversion(adcREG1,adcGROUP0);

So the question is why not working adc event group well? 

Thank you!

Kind regards,

Keno

0844.adc.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/** @file adc.c
* @brief ADC Driver Source File
* @date 08-Feb-2017
* @version 04.06.01
*
* This file contains:
* - API Functions
* - Interrupt Handlers
* .
* which are relevant for the ADC driver.
*/
/*
* Copyright (C) 2009-2016 Texas Instruments Incorporated - www.ti.com
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/* USER CODE BEGIN (0) */
/* USER CODE END */
/* Include Files */
#include "adc.h"
#include "sys_vim.h"
/* USER CODE BEGIN (1) */
/* USER CODE END */
/** @fn void adcInit(void)
* @brief Initializes ADC Driver
*
* This function initializes the ADC driver.
*
*/
/* USER CODE BEGIN (2) */
/* USER CODE END */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7206.adc.h

  • Hello Keno,

    I didn't find any problem from your code. The ADC DMA is enabled. The ADC generates DAM request wen it writes 30 buffers to ADC memory. 

    You said it works for group1, group2 and Event group with/without DMA. What should be the correct value in ADC memory? How many channels in event groups are sampled? 

  • Hi QJ,

    It works for group1, group2, but the ADC conversion for event group is wrong. 3 channels are sampled in event group (same as group1 or group2) and the ADC memory should be the same as group1 or group2. It seems to me event group ADC conversion is working wrongly. Thank you!

    Kind regards,

    Norbert

  • Hello Nobert,

    You said that event group ADC conversion is working wrongly. Is the sampled data not correct? or the sampled data in ADC RAM is not transferred correctly with DMA? The event group has to be triggered by HW (GIO, NHET, or RTI timer).