MSPM0G3507: ADC DMA Collected samples having glitches

Part Number: MSPM0G3507

Configured ADC 0 with two channels 0 (PA27) & 1(PA26) and with sampling rate of 0.25us  to capture the 5Khz pulse waveform using DMA of 512 samples. Attached the collected sample log for reference and found the collected samples through DMA is not proper and having glitches. Configuration currently used for capturing samples is attached herewith. So, Please give guidance on proper configuration and  steps to collect  the expected samples  based on sampling rate without data lose or glitches.    ADC_DMA_SYSCONFIG.txt 
5KHz_ADC_DMA_DATA.xlsx 

  • Hi,

    I am OOO till next Tuesday. I'll check the details when I back office, Thanks for your patience.

    B.R.

    Sal

  • Hi,

    There have several things need to be taken care:

    DMA trigger setting:

    DMA Errata: As you enabled FIFO, I think the DMA source address is FIFO which is SVT_FIFODATA, then it is fine.

    Power Down Mode: Select Manual mode

    Sample time: Right now you are setting 0.25us.

    Consider increasing sample time if you adc input impedance is high (with some resistor connected to ADC input path). -> Optional according your hardware.

    Others looks fine.

    B.R.

    Sal

  • Hi Sal. Thanks for your reply.
     

    Total sample count that I am able to collect with 0.25 us is very less compared to expected count. For a 20kHz ,50% duty cycle signal, I was able to collect only 5 ON and 5 OFF samples. With 0.25us adc sampling time, total sample count should be more.

    I cannot increase the adc sampling time from 0.25us as my actual requirement is to measure atleast 100 Khz signal.

    Please provide guidance on increasing the sample count. As per datasheet adc has sampling frequency of 4MSPS and I am not able to measure even 50kHz or 100 kHz. There is no resistor connected to adc input in hardware. The configuration that I am using is attached herewith.

    /**
     * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
     * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
     * @cliArgs --device "MSPM0G350X" --package "LQFP-64(PM)" --part "Default" --product "mspm0_sdk@2.01.00.03"
     * @versions {"tool":"1.19.0+3426"}
     */
    
    /**
     * Import the modules used in this configuration.
     */
    const ADC12         = scripting.addModule("/ti/driverlib/ADC12", {}, false);
    const ADC121        = ADC12.addInstance();
    const ADC122        = ADC12.addInstance();
    const DMA           = scripting.addModule("/ti/driverlib/DMA");
    const GPIO          = scripting.addModule("/ti/driverlib/GPIO", {}, false);
    const GPIO1         = GPIO.addInstance();
    const GPIO2         = GPIO.addInstance();
    const GPIO3         = GPIO.addInstance();
    const GPIO4         = GPIO.addInstance();
    const GPIO5         = GPIO.addInstance();
    const GPIO6         = GPIO.addInstance();
    const I2C           = scripting.addModule("/ti/driverlib/I2C", {}, false);
    const I2C1          = I2C.addInstance();
    const PWM           = scripting.addModule("/ti/driverlib/PWM", {}, false);
    const PWM1          = PWM.addInstance();
    const SPI           = scripting.addModule("/ti/driverlib/SPI", {}, false);
    const SPI1          = SPI.addInstance();
    const SYSCTL        = scripting.addModule("/ti/driverlib/SYSCTL");
    const TIMER         = scripting.addModule("/ti/driverlib/TIMER", {}, false);
    const TIMER1        = TIMER.addInstance();
    const TIMER2        = TIMER.addInstance();
    const UART          = scripting.addModule("/ti/driverlib/UART", {}, false);
    const UART1         = UART.addInstance();
    const ProjectConfig = scripting.addModule("/ti/project_config/ProjectConfig");
    
    /**
     * Write custom configuration values to the imported modules.
     */
    const divider7       = system.clockTree["PLL_PDIV"];
    divider7.divideValue = 2;
    
    const divider9       = system.clockTree["UDIV"];
    divider9.divideValue = 2;
    
    const multiplier2         = system.clockTree["PLL_QDIV"];
    multiplier2.multiplyValue = 10;
    
    const mux8       = system.clockTree["HSCLKMUX"];
    mux8.inputSelect = "HSCLKMUX_SYSPLL0";
    
    ADC121.$name                             = "ADC12_0";
    ADC121.adcMem0avgen                      = true;
    ADC121.adcMem1chansel                    = "DL_ADC12_INPUT_CHAN_1";
    ADC121.adcMem1avgen                      = true;
    ADC121.samplingOperationMode             = "sequence";
    ADC121.sampClkSrc                        = "DL_ADC12_CLOCK_ULPCLK";
    ADC121.sampCnt                           = 1;
    ADC121.repeatMode                        = true;
    ADC121.enableFIFO                        = true;
    ADC121.configureDMA                      = true;
    ADC121.sampleTime0                       = "0.25 us";
    ADC121.sampleTime1                       = "0.25 us";
    ADC121.enabledEvents                     = ["DL_ADC12_EVENT_MEM0_RESULT_LOADED"];
    ADC121.endAdd                            = 1;
    ADC121.powerDownMode                     = "DL_ADC12_POWER_DOWN_MODE_MANUAL";
    ADC121.enabledInterrupts                 = ["DL_ADC12_INTERRUPT_DMA_DONE"];
    ADC121.enabledDMATriggers                = ["DL_ADC12_DMA_MEM1_RESULT_LOADED"];
    ADC121.peripheral.$assign                = "ADC0";
    ADC121.peripheral.adcPin0.$assign        = "PA27";
    ADC121.peripheral.adcPin1.$assign        = "PA26";
    ADC121.adcPin0Config.$name               = "ti_driverlib_gpio_GPIOPinGeneric9";
    ADC121.DMA_CHANNEL.$name                 = "DMA_CH0";
    ADC121.DMA_CHANNEL.configureTransferSize = true;
    ADC121.DMA_CHANNEL.addressMode           = "f2b";
    ADC121.DMA_CHANNEL.transferMode          = "FULL_CH_REPEAT_SINGLE";
    ADC121.DMA_CHANNEL.transferSize          = 2;
    ADC121.DMA_CHANNEL.peripheral.$assign    = "DMA_CH1";
    ADC121.adcPin1Config.$name               = "ti_driverlib_gpio_GPIOPinGeneric8";
    
    ADC122.$name                             = "ADC12_1";
    ADC122.endAdd                            = 1;
    ADC122.adcMem0avgen                      = true;
    ADC122.adcMem1chansel                    = "DL_ADC12_INPUT_CHAN_1";
    ADC122.adcMem1avgen                      = true;
    ADC122.samplingOperationMode             = "sequence";
    ADC122.sampCnt                           = 1;
    ADC122.enableFIFO                        = true;
    ADC122.repeatMode                        = true;
    ADC122.enabledInterrupts                 = ["DL_ADC12_INTERRUPT_DMA_DONE"];
    ADC122.configureDMA                      = true;
    ADC122.sampleTime0                       = "0.25 us";
    ADC122.sampleTime1                       = "0.25 us";
    ADC122.sampClkSrc                        = "DL_ADC12_CLOCK_ULPCLK";
    ADC122.powerDownMode                     = "DL_ADC12_POWER_DOWN_MODE_MANUAL";
    ADC122.enabledDMATriggers                = ["DL_ADC12_DMA_MEM1_RESULT_LOADED"];
    ADC122.peripheral.$assign                = "ADC1";
    ADC122.peripheral.adcPin0.$assign        = "PA15";
    ADC122.peripheral.adcPin1.$assign        = "PA16";
    ADC122.adcPin0Config.$name               = "ti_driverlib_gpio_GPIOPinGeneric11";
    ADC122.adcPin1Config.$name               = "ti_driverlib_gpio_GPIOPinGeneric7";
    ADC122.DMA_CHANNEL.$name                 = "DMA_CH1";
    ADC122.DMA_CHANNEL.configureTransferSize = true;
    ADC122.DMA_CHANNEL.addressMode           = "f2b";
    ADC122.DMA_CHANNEL.transferMode          = "FULL_CH_REPEAT_SINGLE";
    ADC122.DMA_CHANNEL.transferSize          = 2;
    ADC122.DMA_CHANNEL.peripheral.$assign    = "DMA_CH2";
    
    const Board                       = scripting.addModule("/ti/driverlib/Board", {}, false);
    Board.peripheral.$assign          = "DEBUGSS";
    Board.peripheral.swclkPin.$assign = "PA20";
    Board.peripheral.swdioPin.$assign = "PA19";
    
    GPIO1.port                          = "PORTA";
    GPIO1.$name                         = "RS485";
    GPIO1.associatedPins[0].$name       = "ENABLE_RX_TX";
    GPIO1.associatedPins[0].pin.$assign = "PA12";
    
    GPIO2.$name                         = "MODBUS";
    GPIO2.associatedPins.create(3);
    GPIO2.associatedPins[0].$name       = "MASTER_ADD_S0_DB";
    GPIO2.associatedPins[0].direction   = "INPUT";
    GPIO2.associatedPins[0].pin.$assign = "PB6";
    GPIO2.associatedPins[1].$name       = "MASTER_ADD_S1_DB";
    GPIO2.associatedPins[1].direction   = "INPUT";
    GPIO2.associatedPins[1].pin.$assign = "PB7";
    GPIO2.associatedPins[2].$name       = "MASTER_ADD_S2_DB";
    GPIO2.associatedPins[2].direction   = "INPUT";
    GPIO2.associatedPins[2].pin.$assign = "PB8";
    
    GPIO3.$name                          = "MC_BOARD";
    GPIO3.associatedPins.create(2);
    GPIO3.associatedPins[0].$name        = "EN_DB";
    GPIO3.associatedPins[0].pin.$assign  = "PB15";
    GPIO3.associatedPins[1].$name        = "EEPROM_CS";
    GPIO3.associatedPins[1].initialValue = "SET";
    GPIO3.associatedPins[1].pin.$assign  = "PB24";
    
    GPIO4.$name                         = "INTERLOCK";
    GPIO4.associatedPins[0].$name       = "STATUS_DB";
    GPIO4.associatedPins[0].direction   = "INPUT";
    GPIO4.associatedPins[0].pin.$assign = "PA17";
    
    GPIO5.$name                         = "DIG_DB";
    GPIO5.associatedPins.create(3);
    GPIO5.associatedPins[0].$name       = "ADC1Toggle";
    GPIO5.associatedPins[0].pin.$assign = "PB13";
    GPIO5.associatedPins[1].$name       = "ADC0Toggle";
    GPIO5.associatedPins[1].pin.$assign = "PB4";
    GPIO5.associatedPins[2].$name       = "GPIO3";
    GPIO5.associatedPins[2].pin.$assign = "PB19";
    
    GPIO6.$name                         = "MUX_CONTROL";
    GPIO6.port                          = "PORTA";
    GPIO6.associatedPins.create(6);
    GPIO6.associatedPins[0].$name       = "COL_CTRL1_DB";
    GPIO6.associatedPins[0].pin.$assign = "PA21";
    GPIO6.associatedPins[1].$name       = "COL_CTRL2_DB";
    GPIO6.associatedPins[1].pin.$assign = "PA22";
    GPIO6.associatedPins[2].$name       = "ROW_CTRL1_DB";
    GPIO6.associatedPins[2].pin.$assign = "PA24";
    GPIO6.associatedPins[3].$name       = "ROW_CTRL2_DB";
    GPIO6.associatedPins[3].pin.$assign = "PA25";
    GPIO6.associatedPins[4].$name       = "COL_CTRL3_DB";
    GPIO6.associatedPins[4].pin.$assign = "PA23";
    GPIO6.associatedPins[5].$name       = "ROW_CTRL3_DB";
    GPIO6.associatedPins[5].pin.$assign = "PA28";
    
    I2C1.basicEnableController             = true;
    I2C1.$name                             = "MC_I2C_DB";
    I2C1.peripheral.$assign                = "I2C1";
    I2C1.peripheral.sdaPin.$assign         = "PB3";
    I2C1.peripheral.sclPin.$assign         = "PB2";
    I2C1.sdaPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric2";
    I2C1.sdaPinConfig.hideOutputInversion  = scripting.forceWrite(false);
    I2C1.sdaPinConfig.onlyInternalResistor = scripting.forceWrite(false);
    I2C1.sdaPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
    I2C1.sclPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric3";
    I2C1.sclPinConfig.hideOutputInversion  = scripting.forceWrite(false);
    I2C1.sclPinConfig.onlyInternalResistor = scripting.forceWrite(false);
    I2C1.sclPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
    
    PWM1.$name                      = "DUT_EN";
    PWM1.enableShadowLoad           = true;
    PWM1.ccIndex                    = [2];
    PWM1.timerCount                 = 16000;
    PWM1.peripheral.$assign         = "TIMA0";
    PWM1.peripheral.ccp2Pin.$assign = "PB20";
    PWM1.PWM_CHANNEL_2.$name        = "ti_driverlib_pwm_PWMTimerCC0";
    PWM1.PWM_CHANNEL_2.dutyCycle    = 50;
    PWM1.ccp2PinConfig.$name        = "ti_driverlib_gpio_GPIOPinGeneric13";
    PWM1.ccp2PinConfig.enableConfig = true;
    
    SPI1.chipSelect                         = ["0","1"];
    SPI1.$name                              = "MC_SPI_DB";
    SPI1.enabledInterrupts                  = ["DMA_DONE_RX","DMA_DONE_TX","IDLE","RX","RX_TIMEOUT","TX"];
    SPI1.frameFormat                        = "MOTO3";
    SPI1.targetBitRate                      = 1000000;
    SPI1.peripheral.$assign                 = "SPI0";
    SPI1.peripheral.sclkPin.$assign         = "PA11";
    SPI1.peripheral.mosiPin.$assign         = "PA9";
    SPI1.peripheral.misoPin.$assign         = "PA10";
    SPI1.sclkPinConfig.direction            = scripting.forceWrite("OUTPUT");
    SPI1.sclkPinConfig.onlyInternalResistor = scripting.forceWrite(false);
    SPI1.sclkPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
    SPI1.sclkPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric4";
    SPI1.mosiPinConfig.direction            = scripting.forceWrite("OUTPUT");
    SPI1.mosiPinConfig.hideOutputInversion  = scripting.forceWrite(false);
    SPI1.mosiPinConfig.onlyInternalResistor = scripting.forceWrite(false);
    SPI1.mosiPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
    SPI1.mosiPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric5";
    SPI1.misoPinConfig.onlyInternalResistor = scripting.forceWrite(false);
    SPI1.misoPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
    SPI1.misoPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric6";
    
    SYSCTL.clockTreeEn = true;
    
    TIMER1.$name              = "Modbus_TIMER_0";
    TIMER1.timerPeriod        = "60us";
    TIMER1.timerMode          = "ONE_SHOT_UP";
    TIMER1.peripheral.$assign = "TIMG0";
    
    TIMER2.timerPeriod        = "60us";
    TIMER2.timerMode          = "ONE_SHOT_UP";
    TIMER2.interrupts         = ["ZERO"];
    TIMER2.$name              = "TimeOut_TIMER";
    TIMER2.peripheral.$assign = "TIMG6";
    
    UART1.$name                                = "MODBUS_UART_0";
    UART1.enableFIFO                           = true;
    UART1.txFifoThreshold                      = "DL_UART_TX_FIFO_LEVEL_3_4_EMPTY";
    UART1.rxFifoThreshold                      = "DL_UART_RX_FIFO_LEVEL_ONE_ENTRY";
    UART1.uartMode                             = "RS485";
    UART1.enabledDMATXTriggers                 = "DL_UART_DMA_INTERRUPT_TX";
    UART1.analogGlitchFilter                   = "DL_UART_PULSE_WIDTH_50_NS";
    UART1.digitalGlitchFilter                  = 2;
    UART1.enabledInterrupts                    = ["BREAK_ERROR","DMA_DONE_TX","EOT_DONE","FRAMING_ERROR","PARITY_ERROR","RX"];
    UART1.peripheral.$assign                   = "UART0";
    UART1.peripheral.rxPin.$assign             = "PA1";
    UART1.peripheral.txPin.$assign             = "PA0";
    UART1.txPinConfig.direction                = scripting.forceWrite("OUTPUT");
    UART1.txPinConfig.hideOutputInversion      = scripting.forceWrite(false);
    UART1.txPinConfig.onlyInternalResistor     = scripting.forceWrite(false);
    UART1.txPinConfig.passedPeripheralType     = scripting.forceWrite("Digital");
    UART1.txPinConfig.$name                    = "ti_driverlib_gpio_GPIOPinGeneric0";
    UART1.rxPinConfig.hideOutputInversion      = scripting.forceWrite(false);
    UART1.rxPinConfig.onlyInternalResistor     = scripting.forceWrite(false);
    UART1.rxPinConfig.passedPeripheralType     = scripting.forceWrite("Digital");
    UART1.rxPinConfig.$name                    = "ti_driverlib_gpio_GPIOPinGeneric1";
    UART1.DMA_CHANNEL_TX.$name                 = "UART0_DMA_CH0";
    UART1.DMA_CHANNEL_TX.addressMode           = "b2f";
    UART1.DMA_CHANNEL_TX.srcLength             = "BYTE";
    UART1.DMA_CHANNEL_TX.dstLength             = "BYTE";
    UART1.DMA_CHANNEL_TX.configureTransferSize = true;
    UART1.DMA_CHANNEL_TX.enableInterrupt       = true;
    UART1.DMA_CHANNEL_TX.peripheral.$assign    = "DMA_CH0";
    
    ProjectConfig.deviceSpin = "MSPM0G3507";
    

  • Hi Sethulakshmi,

    Please provide guidance on increasing the sample count. As per datasheet adc has sampling frequency of 4MSPS and I am not able to measure even 50kHz or 100 kHz.

    As I mentioned, you should enable more DMA trigger source when working in FIFO mode.

    DMA trigger setting:

    In current setting, you will miss 5 additional samples.

    The reason is that FIFO will use all MEMRES register to create a virtual FIFO, the FIFO depth is 12 in this case.

    B.R.

    Sal

  • Additionally, I see the transfer size is incorrect:

    One word access to FIFO is 32-bit which contains 2x 16-bit data, and including channel0&1 sample.

    This doesn't impact your transfer behavior, just impact DMA done interrupt trigger times.

    B.R.

    Sak 

  • Thanks Sal for your guidance. I am able to capture high frequency samples by enabling more DMA triggers.

**Attention** This is a public forum