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.

MSP430F5438A: Data read and write from and to a file

Part Number: MSP430F5438A
Other Parts Discussed in Thread: MSP430WARE, MSP-FET

Hello,

I have been trying to read a file containing 1000 signed data. The file is stored in a PC. I am using MSP430F5438A and my IDE is Code Composer Studio (CCS). In my code I am trying to read the 1000 data and do some processing and then finally I like to write those processed 1000 data in another file in the PC. How can I handle all of this? It looks like C type file read-write coding is not working here as the MSP430 doesn't have any file system. Anyone, please help if you know how to handle this. 

Thanks,

Row

  • Hi Row,

    As you have already known, MSP430 is unable to directly read/write files on a PC. Please consider sending your data from your PC to MSP430 via a communication interface (such as USB, UART, SPI or I2C). MSP430 could receive and process the data, and then send back to your PC via the same communication interface. In that case, you could develop your own PC software that could read/write your file.

    If you decide to use USB as the communication interface, you might need MSP430 USB Developers Package.

    If you are using MSP-FET then you could take advantage of the backchannel UART interface on it. You can read more about that in MSP Debuggers User's Guide. In addition, you can find code examples of using MSP430 UART interface in MSP430Ware such as this one.

  • Hello Philo,
    Thanks for your response and the information you provided. But I need a bit more help.
    So, I am going to use MSP-FET430UIF and try to do it through UART. I looked at the example code you shared. I was wondering how I should navigate the file to the RX pin of the msp430f5438a board? I can't catch how the msp430 board understands it is reading a byte from the file? Can you help me with the setup? Also, where should my file be kept in the PC? Is this be the same directory of the project?

    Thanks,
    Row.
  • Hi Row,

    Unfortunately, MSP-FET430UIF does not have a backchannel UART interface and it is not recommended for new designs as well. If possible, please kindly try to get a MSP-FET.

  • Hi Philo,
    Alright I'll try to get one. In fact, I do have one. I am not sure what do you mean by backchannel UART? I implemented UART using the MSP-FET430UIF. From a sensor I collected data using ADC and then send that data to PC using UART. I observed the data in tera term and it works.

    Now whatever it is let's say if I continue with MSP-FET then still I do have the question. Please assist me with following:

    " I was wondering how I should navigate the file to the RX pin of the msp430f5438a board? I can't catch how the msp430 board understands it is reading a byte from the file? Can you help me with the setup? Also, where should my file be kept in the PC? Is this be the same directory of the project? "

    Thanks for your time

    Regards,
    Row
  • Hi Row,

    As posted earlier, you can find more info about backchannel UART in MSP Debuggers User's Guide.

    The backchannel UART interface will be emulated as a serial COM port on your PC, and you need to develop your own PC software (might be similar to that "tera term" you refereed to) to send data to that emulated serial COM port. Unfortunately, that is beyond TI support and you need to do that by yourself.

  • Thanks, I'll follow the doc. Yes, I understand, and I'll definitely write it on my own. But the problem I am having is handling the file. I can do it if I know how to navigate a file to RX pin of an msp430 so that I can read the data from the file to the board. And I didn't get any documentation on how to handle it. SO if it is beyond TI support then ignore it!

    Thanks,
    Row.
  • Hi Row,

    Maybe you can refer to the following idea about that PC software you need. Let's say we are going to use Python, then generally you need to do these steps.

    1. Use Python to read your file
    2. Use Python to send data to the emulated serial COM port. Usually you can do that by the pySerial module, and you can find more about it at: pypi.org/.../
    3. At the same time, use Python to receive data from the emulated serial COM port. Similarly, you can do that by the pySerial module.
    4. Use Python to write your file

    You can search for "Python serial communication" and there are a lot of helpful videos and documents. You may even search for "Python serial communication with Arduino" for more videos, since Arduino and MSP430 are both microcontrollers and serial communication is the same.

    Of course you can choose any other programming language (such as C++, C# or Java) that you like.

    Last but not least, for hardware connection, don't forget to connect the MSP-FET backchannel UART interface to the UART interface of your MSP430.

**Attention** This is a public forum