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 not plotting uint32_t array

I'm trying to plot an array of uint32_t but the values are truncated, not showing the correct value.

The values are originated in the SD24 of MSP430. To force the plotting process I need to scale each value to an array of uint16_t, but I lost the 8 lsb.

There is one way to plot uint32_t?

  • Hi,

    Can you send a screenshot of the graph parameters you are using? CCS graphs support 32-bit signed and unsigned integers and, for a SD24, you would forcefully need to set the Q value.

    Regards,
    Rafael
  • The first plot is the array in uint32_t (unsigned long), the secund in uint16_t (unsigned int).

    CCS Version: 6.1.1.00022

  • Hi,

    Thanks for sending the screenshots, but the most useful information can be obtained from the graph parameters (not the displayed data) of each graph.

    By looking at the data I suspect you have either done one of a few things:
    1) set the Acquisition Buffer Size to anything other than 64 (the size of your buffer in memory)
    2) set the Dsp Data Type to anything other than 32-bit unsigned integer
    3) set the Start Address to an invalid location.

    Hope this helps,
    Rafael
  • The code is based on the example provided with the DriverLib, just few changes were made (the size of buffer and a new buffer of uint16_t).

    #include "driverlib.h"
    
    //#define Num_of_Results 8
    
    #define Num_of_Results 64
    
    /* Array to store SD24_B conversion results */
    uint32_t results[Num_of_Results];
    uint16_t results_16[Num_of_Results];
    
    void main(void)
    {
    WDT_A_hold(WDT_A_BASE); // Stop WDT
    
    // Select internal REF
    // Select SMCLK as SD24_B clock source
    SD24_B_initParam initParam = {0};
    initParam.clockSourceSelect = SD24_B_CLOCKSOURCE_SMCLK;
    initParam.clockPreDivider = SD24_B_PRECLOCKDIVIDER_1;
    initParam.clockDivider = SD24_B_CLOCKDIVIDER_1;
    initParam.referenceSelect = SD24_B_REF_INTERNAL;
    SD24_B_init(SD24_BASE, &initParam);
    
    SD24_B_setInterruptDelay(SD24_BASE,
    SD24_B_CONVERTER_2,
    SD24_B_THIRD_SAMPLE_INTERRUPT);
    
    // Enable channel 2 interrupt
    
    SD24_B_clearInterrupt(SD24_BASE,
    SD24_B_CONVERTER_2,
    SD24_B_CONVERTER_INTERRUPT);
    SD24_B_enableInterrupt(SD24_BASE,
    SD24_B_CONVERTER_2,
    SD24_B_CONVERTER_INTERRUPT);
    
    __delay_cycles(0x3600); // Delay for 1.5V REF startup
    
    SD24_B_startConverterConversion(SD24_BASE,
    SD24_B_CONVERTER_2); // Set bit to start conversion
    
    __bis_SR_register(LPM0_bits | GIE); // Enter LPM0 w/ interrupts
    }
    
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=SD24B_VECTOR
    __interrupt
    #elif defined(__GNUC__)
    __attribute__((interrupt(SD24B_VECTOR)))
    #endif
    void SD24BISR(void)
    {
    static uint16_t index = 0;
    
    switch(SD24BIV)
    {
    case SD24BIV_SD24OVIFG: // SD24MEM Overflow
    break;
    case SD24BIV_SD24TRGIFG: // SD24 Trigger IFG
    break;
    case SD24BIV_SD24IFG0: // SD24MEM0 IFG
    break;
    case SD24BIV_SD24IFG1: // SD24MEM1 IFG
    break;
    case SD24BIV_SD24IFG2: // SD24MEM2 IFG
    results[index] = SD24_B_getResults(SD24_BASE,
    SD24_B_CONVERTER_2); // Save CH2 results (clears IFG)
    results_16[index] = (results[index] >> 8) & 0xFFFF;
    
    if(++index == Num_of_Results)
    {
    index = 0; // SET BREAKPOINT HERE
    }
    break;
    }
    }

  • Hi,

    I discovered the problem. The graph starts with the native size of 16 bit unsigned, it's necessary to change the property.

    Now it works well.