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: cross platform between MAC and Windows - data output serial stream

Part Number: MSP432P401R

Tool/software: Code Composer Studio

Hi,

I developed a code on CCS for a booster pack I designed which has a ADC on the MSP432. The program just reads data from the ADC and stream it through the serial port on to the laptop from the msp432. There is something weird which is causing us a problem. When we load the code onto the MSP432 on a MAC and stream the data on a MAC, it works fine and similarly if we load the code onto the MSP432 on a windows machine and stream the data on a windows machine, it works fine. The problem arises when we load the code on one platform (say a MAC) and stream the data on a different platform (say a windows machine) then the stream rate drastically reduces. The rate reduces like 4-5 times. 

So I started debugging and tried to find at what lines this is happening and if I comment the following lines in my code, it works fine cross platform (in the sense - load it on one OS and stream it on a different OS). And when I uncomment the following lines of code then the problem comes back. The following lines of code is just a cyclic buffer which is used for averages (down sampling the values).

    //  zero out the circular buffers at startup
    for (n=0; n<BUFLEN; n++)
    {
        sig0buf[n] = 0;
        sig1buf[n] = 0;
        sig2buf[n] = 0;
        sig0sum = 0;
        sig1sum = 0;
        sig2sum = 0;
    }

        //  Initialize the circular buffers
        if (global_switch_mode)
        {
            // populate all elements of the circular buffers with the current samples
            for (n=0; n<BUFLEN; n++)
            {
                sig0buf[n] = sig0;
                sig1buf[n] = sig1;
                sig2buf[n] = sig2;
            }

            // compute the initial sum
            sig0sum = sig0*BUFLEN;
            sig1sum = sig1*BUFLEN;
            sig2sum = sig2*BUFLEN;

            // set the initial pointer to zero
            ptr = 0;

            // reset the global switch mode
            global_switch_mode = false;
        }


        //  Average the raw data samples
        sig0sum = sig0sum - sig0buf[ptr] + sig0;    // subtract oldest, add newest
        sig0buf[ptr] = sig0;                        // store the newest value
        sig0 = sig0sum / BUFLEN;                    // compute new average

        sig1sum = sig1sum - sig1buf[ptr] + sig1;    // subtract oldest, add newest
        sig1buf[ptr] = sig1;                        // store the newest value
        sig1 = sig1sum / BUFLEN;                    // compute new average

        sig2sum = sig2sum - sig2buf[ptr] + sig2;    // subtract oldest, add newest
        sig2buf[ptr] = sig2;                        // store the newest value
        sig2 = sig2sum / BUFLEN;                    // compute new average

        ptr = (ptr + 1) % BUFLEN;                   // increment pointer modulo the buffer length

  • Can you use a oscilloscope to read the serial signal to check with part the problem lies on. The MSP432 or the PC. 

  • So when you say check the serial connections, do you mean to say tap into the USB ports? But could that just be done using the terminal on a laptop, just read the output from the terminal?

    I am more curious is why the problem disappears when I comment those set of lines.

  • I don't have a mac and only can tell you how to debug it. I don't see any uart related function in your commented code.

    Here is my thought:

    1. Check if the problem lies on MSP432, XDS110 or the PC: Use oscilloscope to tack the uart data between MSP432 and XDS110(data on TX and RX) at the condition of MAC compile and  Win steam data. 

    2. If it doesn't send any data. The problem may lie on the code difference between different platform: Please generate the TI_TXT file on MAC and Win and compare it. Or you can also read the code out on different platform.

    The problem is that I don't know which software that you use to accept the uart data on PC. Please debug the problem one by one.(MSP432 -> XDS110 -> PC -> software)

**Attention** This is a public forum