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/MSP432P401R: export data to computer

Part Number: MSP432P401R


Tool/software: Code Composer Studio

Hi there,

I am writing this code and trying to print out array when it is all filled (16000 indices). Is there any driverlib functions that I can print out variables or arrays (basically values that store in memory) as a txt file automatically?

Here is the code that I wrote,

#include <ti/devices/msp432p4xx/driverlib/driverlib.h>

/* Standard Includes */

#include <stdint.h>

#include <stdbool.h>

//s#include <stdio.h>

volatile float array[16000];

int count = 0;

volatile int index;

int main(void)

{

    /* Halting the Watchdog */

    MAP_WDT_A_holdTimer();

    //![Simple CS Config]

    /* Configuring pins for peripheral/crystal usage and LED for output */

    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(

            GPIO_PORT_PJ,

            GPIO_PIN3 | GPIO_PIN2,

            GPIO_PRIMARY_MODULE_FUNCTION);

    MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);

    MAP_GPIO_interruptEdgeSelect(GPIO_PORT_P1, GPIO_PIN1,

    GPIO_HIGH_TO_LOW_TRANSITION);

    /* Just in case the user wants to use the getACLK, getMCLK, etc. functions,

     * let's set the clock frequency in the code.

     */

    CS_setExternalClockSourceFrequency(32000, 36000000);

    /* Starting HFXT in non-bypass mode without a timeout. Before we start

     * we have to change VCORE to 1 to support the 48MHz frequency */

    MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);

    MAP_FlashCtl_setWaitState(FLASH_BANK0, 1);

    MAP_FlashCtl_setWaitState(FLASH_BANK1, 1);

    CS_startHFXT(false);

    /* Initializing MCLK to HFXT (effectively 48MHz) */

    MAP_CS_initClockSignal(CS_MCLK, CS_HFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);

    //![Simple CS Config]

    /* Configuring SysTick to trigger at 12000000 (MCLK is 48MHz so this will

     * make it toggle every 0.025s) */

    MAP_SysTick_enableModule();

    MAP_SysTick_setPeriod(1200000);

    MAP_Interrupt_enableSleepOnIsrExit();

    MAP_SysTick_enableInterrupt();

    /* Enabling MASTER interrupts */

    MAP_Interrupt_enableMaster();

    while (1)

    {

    }

}

void SysTick_Handler(void)

{

    volatile float subarray[6];

    volatile float sum;

    int i;

    count++;

    subarray[count] = MAP_GPIO_getInputPinValue(GPIO_PORT_P1, GPIO_PIN1);

    if (count % 6 == 0)

    {

        for (i = 0; i < 6; i++)

        {

            sum += subarray[i];

        }

        array[index] = sum;

        sum = 0;

        i = 0;

        count = 0;

        index++;

    }

}

  • HI Keith,

    Keith Xia said:
    I am writing this code and trying to print out array when it is all filled (16000 indices). Is there any driverlib functions that I can print out variables or arrays (basically values that store in memory) as a txt file automatically?

    Do you want to do this without a JTAG connection also? If this is only for debug purposes and there will be a JTAG debug connection, C I/O is always an option (though an intrusive one). 

    Thanks

    ki

  • Hi Ki,

    I just need to have the board debugged and the txt file will be printed and saved locally in my laptop. I try to search if there is any function that does the job but so far I cannot fin any available functions/examples that works. Do you have any example code that I can refer to?

    Keith

  • Keith Xia said:
    I just need to have the board debugged and the txt file will be printed and saved locally in my laptop.

    If you will have CCS debug connection and are not concerned about the intrusiveness (processor halts), then C file I/O like fwrite should do the trick.

    Note that there are a some considerations when using C I/O on embedded devices. See the below article for more details:

    https://dev.ti.com/tirex/explore/node?node=ADxuQu8gX3MLBUkurarz8A__FUz-xrs__LATEST

    You can also have the CCS debugger do this automatically by setting a breakpoint with an action to save memory location to a file.

    Thanks

    ki