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.

MSP432 ADC Data acquisition UART



Hello every one

The MSP432 ADC uses has a resolution of 14 bits, but de ADC14MEMx (where the ADC data is saved)  has 16 bits, I want to transfer that information through UART to my PC, but  UART let me transfer only 8 bits, so I have to split the 16 bits of the ADCMEMx in two parts and send them one afther another.   


this is a ADC14:           0001111110111000

this is his HEX:             1FB8


Then I have to send the HEX value through UCA0TXBUF:

UCA0TXBUF = 0xB8;      // First

UCA0TXBUF = 0x1F;      //Second

My question is: How I can save de binary data of ADC14MEM in an hexadecimal variable and split it to send it?

My goal is to use all the speed of UART to transfer the data of an analog Acelerometer.

  • Can you use AND operation with 0x00ff and 0xff00 to get lower and higher 16 bits respectively?

    Teja

  • Sending binary data via UART is not a good idea. What happens if one character gets lost or corrupted ?

    Having worked with UARTs for years and on different systems, that happens more often than you think.

    Rather convert to a string, and send as such.

    But still, think how to deal with corrupted or lost characters, to resync your transmission without resetting both transmitter and receiver.

    My goal is to use all the speed of UART to transfer the data of an analog Acelerometer.

    You don't need to be as fast as possible, just faster than the acquisition. And when using DMA or interrupts for sending, it requires a minimum of core performance.

  • Hi f.m, thanks for your knowledge, but I need to know how to be as fast as possible, because in other application that I am working I am using a microphone.
    The sound is located in a frequency dominion of 20Hz to 20KHz, so, to be able to get a very clear signal to my computer using the MSP432 as a data acquisition system is necessary to get at least 40000 samples per second, each sample has a resolution of 14 bits,  but the ADC14MEMx uses 16 bits, so that mean I need to transfer (40000*16= 640000 bits per second to my computer), UART is able to transfer 921,6 Kbps,  that is why I believe that is possible to use the MSP432 as a Data Acquisition System.
    I didn't know that in such small distance (small USB cable) the information could get seriously corrupted, can you explain me more of that please?.
    Again Thank you very much

    one more thing, i dont want to use a string, because if I send each caracter of an hexadecimal value as a char i will use 8 bits in each case, that mean a waste of band with for me.

    UCA0TXBUF = 0xB8; // 8 bits   

    UCA0TXBUF = 0x1F;  //8 bits
    //16 bits only

    Using a string will demand (4*8=32 bits)

  • ... to be able to get a very clear signal to my computer using the MSP432 as a data acquisition system is necessary to get at least 40000 samples per second ...

    You didn't mention those real-time requirements before.

    I didn't know that in such small distance (small USB cable) the information could get seriously corrupted, can you explain me more of that please?.

    UART implies RS232 to me. VCP usually works with very short distances (for the actual UART signal), so corruption via EMI would be less of a problem. However, I'm not sure if your VCP adapter or PC application is fit to sustain such high data rates. And, as noted below, you don't need "serious corruption" to kill the transfer, but just one byte.

    For real-time data transfer, I would have recommended USB (which has a RT audio profile), or I2S.

    Using a string will demand (4*8=32 bits)

    No, even more. At least ten bits for each byte (start + stop bits), possibly separators, and line termination.

    Protocol robustness is introduced by redundancy, i.e. "additional" information. If you transfer pure binary data, your application is dead as soon as a character/byte is lost. Because "binary" includes any possible byte value, you can't tell on the receiver side where one value (made up of two bytes) starts and ends. That's what a text transmission would be good for.

    The less safe a physical transmission line is, the more "redundant" information is added. A good protocol will detect errors, ignoring them or requesting a re-transmit, and resynchronize.

  • Good advice on the redundant information!!!, what do you recommend me to transfer the biggest amount of data, what method, and how much speed (bps) do you think I will be able to reach using the UART and MSP432.

**Attention** This is a public forum