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.

CCS/ADS1274EVM-PDK: Problem with graphing Expression in 2-Channel Reading

Part Number: ADS1274EVM-PDK
Other Parts Discussed in Thread: ADS1274

Tool/software: Code Composer Studio

Hi! I'd like to present two problems I've experienced while working with acquiring data from the ADS1274EVM on the 1294XL Launchpad. As a background, I'd like to provide the following information:

  • I am attempting to read multiple Channels in the ADS1274 using the 1294XL ICDI, without using the MMB0
  • The analog input is a sine wave, and the function generator is connected to all of the analog inputs, which is what I'm looking for in the CCS graph
  • In order to start simple, I start out using just two channels. One channel shows the expected sine wave, and the other channel shows half a sine wave, then complete garbage. Like this
    //This code contains the SPI with the timer and interrupt
    
    #define INPUT_VECTOR_SIZE 100
    
    uint32_t ui32SysClkFreq;                          //Clock frequency (Also can be called by SysClockFreqGet())
    uint32_t ui32Period;                              //Number of Clock cycles before the next interrupt is sent
    uint16_t DummyData = 0x0000;
    uint32_t counter = 0;
    uint16_t pui16DataRx0[INPUT_VECTOR_SIZE] = {0x0000};    //Create Empty Input Vector for Channel 1
    uint16_t pui16DataRx1[INPUT_VECTOR_SIZE] = {0x0000};    //Create Empty Input Vector for Channel 2
    uint16_t pui16DataRx2[INPUT_VECTOR_SIZE] = {0x0000};    //Create Empty Input Vector for Channel 3
    uint16_t pui16DataRx3[INPUT_VECTOR_SIZE] = {0x0000};    //Create Empty Input Vector for Channel 4
    uint32_t pui32DataRxBuffer[7]            = {0x0000};    //Rx buffer, will be Rearranged in DRDY ISR
    
    void GPIOPortFIntHandler(void);
    
    int main(void)
    {
        //Configure the Clock
        ui32SysClkFreq = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);
    
    
        //Enable Associated GPIO and SSI Peripherals For SSI1
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI1);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    
    
        //Configure and Activate Pins for SSI (Pg 743 of Datasheet for reference)
        GPIOPinConfigure(GPIO_PB5_SSI1CLK);
        GPIOPinConfigure(GPIO_PE4_SSI1XDAT0);
        GPIOPinConfigure(GPIO_PE5_SSI1XDAT1);
        GPIOPinTypeSSI(GPIO_PORTB_BASE,GPIO_PIN_5);
        GPIOPinTypeSSI(GPIO_PORTE_BASE,GPIO_PIN_4|GPIO_PIN_5);
    
        //Configure Constant GPIO Pins (SYNC, MODE and FORMAT Pins)
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
        GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3
                                             | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0 );
        GPIOPinWrite(GPIO_PORTK_BASE, 0x3F, 0x20);                      // /SYNC: 1b'1; FORMAT: 3b'000; MODE: 2b'00
    
        // Pin F4 setup for DRDY-Inverse
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);        // Enable port F
        GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_0);  // Init PF0 as input
    
        // Interrupt setup
        GPIOIntDisable(GPIO_PORTF_BASE, GPIO_PIN_0);                // Disable interrupt for PF0 (in case it was enabled)
        GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_FALLING_EDGE);                          // Configure PF0 for falling edge trigger
        GPIOIntClear(GPIO_PORTF_BASE, GPIO_PIN_0);                  // Clear pending interrupts for PF0
        GPIOIntRegister(GPIO_PORTF_BASE, GPIOPortFIntHandler);      // Register ISR for port F
        GPIOIntEnable(GPIO_PORTF_BASE, GPIO_PIN_0);                 // Enable interrupt for PF0
    
    
    
    
        //Configure SSI: DAC Reads on Rising Edge (Phase = 1), Idle Mode is High (Polarity = 1)
        SSIConfigSetExpClk(SSI1_BASE, ui32SysClkFreq, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 20000000, 16);
        SSIEnable(SSI1_BASE);
        //Continue
        while(1){}
    }
    
    
    //Interrupt Service Routine (ISR) or Interrupt Handler
    void GPIOPortFIntHandler(void)
    {
    
            //Clear the GPIO interrupt
            GPIOIntClear(GPIO_PORTF_BASE, GPIO_INT_PIN_0);
    
    
            //Fill the buffer elements one by one; collect 64 bits
            SSIDataPut(SSI1_BASE, DummyData);
            SSIDataGet(SSI1_BASE,&pui32DataRxBuffer[0]);             //Get first 16 bits [111:96]
            SSIDataPut(SSI1_BASE, DummyData);
            SSIDataGet(SSI1_BASE,&pui32DataRxBuffer[1]);             //Get second  16 bits [95:80]
            SSIDataPut(SSI1_BASE, DummyData);
            SSIDataGet(SSI1_BASE,&pui32DataRxBuffer[2]);             //Get third 16 bits [79:64]
            SSIDataPut(SSI1_BASE, DummyData);
            SSIDataGet(SSI1_BASE,&pui32DataRxBuffer[3]);             //Get fourth  16 bits [63:48]
            //SSIDataPut(SSI1_BASE, DummyData);
            //SSIDataGet(SSI1_BASE,&pui32DataRxBuffer[4]);             //Get fifth 16 bits [47:32]
            //SSIDataPut(SSI1_BASE, DummyData);
            //SSIDataGet(SSI1_BASE,&pui32DataRxBuffer[5]);             //Get sixth 16 bits [31:16]
            //SSIDataPut(SSI1_BASE, DummyData);
            //SSIDataGet(SSI1_BASE,&pui32DataRxBuffer[6]);             //Get seventh 16 bits [15: 0]
    
            //Consolidate and concatenate the elements to get Channel 1 and 2
            pui16DataRx0[counter] = ((uint16_t)(pui32DataRxBuffer[0]) << 1) | ((uint16_t)(pui32DataRxBuffer[1]) >> 15);
            pui16DataRx1[counter] = ((uint16_t)(pui32DataRxBuffer[1]) << 9) | ((uint16_t)(pui32DataRxBuffer[2]) >>  7);
            //pui16DataRx2[counter] = ((uint16_t)(pui32DataRxBuffer[3]) << 1) | ((uint16_t)(pui32DataRxBuffer[4]) >> 15);
            //pui16DataRx3[counter] = ((uint16_t)(pui32DataRxBuffer[4]) << 9) | ((uint16_t)(pui32DataRxBuffer[5]) >>  7);
    
            //Counter Update
            if(counter < INPUT_VECTOR_SIZE - 1) {counter++;}        //Increment Counter as long as it's below 4999
            else{counter = 0;}                                      //Reset Counter to Zero if it is 4999
            while(SSIBusy(SSI1_BASE)){}
    
    }

    Output for pui16DataRx0:

    Output for pui16DataRx1:

    I also checked the expression values for the elements of pui16DataRx1 from element 50 to 100, and it looks pretty okay (like a sine wave), unlike what I see on the graph. It's given below. Can anyone suggest what could be wrong here?

Another issue I've been having is that when I turn on all 4 channels and I uncomment all the commented sections in the code above to accommodate the extra data, I get garbage values in my input buffer (looks like noise on the graphing function, and the hex values on the expression viewer don't look any more meaningful).

I'd appreciate anyone's help on the issues presented above. Please let me know if more information is required, I'll provide it asap.

Regards,

Stefan

  • Stefan,

    It is difficult to pinpoint the exact reason why the second graph is acting this way, but how are you creating these graphs? I vaguely recall there was an issue with the Dual Graph feature that was unable to properly draw the data. In this case the workaround was to use more than one Single Graph.

    Also, how are the settings for both graphs? Are they pointing to the correct addresses? The reason I ask this is because I make this mistake quite frequently. You can try to graph the variable directly from the Expressions view by right-clicking on the variable name and selecting "Graph". It tends to do a good job in pre-populating the parameters with meaningful settings - obviously that things such as Q-value, sample rate and others are not guessed and you need to input them manually.

    Unfortunately I don't have the same hardware as you, but I have been working with graphs for a while now and similar issues used to plague this feature in the past. Which reminds me: which version of CCS are you using? Several fixes were added to this over the years.

    Regards,
    Rafael