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.

Transfer of data from PC to mcu(FG4619) on a real time basis

Other Parts Discussed in Thread: MSP430FG4619

hi everyone,

I am new to the field of microcontrollers. I have been given the MSP430FG4619 to work on by my guide, changing which is not an option for me. I have gone through the basics of the programming and i have also learnt to write some basic programs to use the I/P O/P ports and also burn them using JTAG. 

But now i have a task to communicate it with the PC and i have gone through a large no of examples for doing so but m unable to understand them, the terminology and the need for various statements.

I hope someone can plz help me out coz i could not figure it out myself though i have tried reading a lot for it and i dont have much time to read and learn it anymore.

 

my prob is:

- I need to send some alphanumeric data from PC to the mcu on a real time basis through a USB port.

It would be of a great help if anyone can give me a code written in "C" to do the same. And also with some explanation that would help me learn it.

ANY help is appreciated..

Regards

DEV 

  • Well, USB doesn't provide much 'real time' capabilities, and a typical PC doesn't too. (this is why there are extensions to Linux like RTLinux)

    The quesiton is: how much realtime do you need?
    Is a microsecond important? Or are a few hundred milliseconds still acceptable?

    Does the arrival of the data have to be jitter-free?

    Do you need to receive the data at the exact moment or is it enough to knwo when the data has been sent,e v eif it arrives a smaller or larger amount of time later?

    The FG4619 doe snto have an internal USB controller, so the way to send data is a serial (UART) communication. If you don't have a real COM port on your PC, you can use a virtual COM port using an USB->serial converter. This adds, however, quite much latency. A real COM port sends out data when you write teh data byte to its output register. On both, MSP and PC. But on USB, the data byte is collected (in case there ar emore), then packed, sent as packet with header and addressing to the converter, where the wole packag eis unpackaged. Then the converter writes the data byte to its output. You cannot say for sure how long this takes, you'll have latency, jitter and delays.
    If you need realtime, a real COM port on the PC woudl do it. An old XT with 4.77MHz and a real COM port will provide more real-time than a 4GHz PC with Windows and a virtual COM port. Hence the question: how much realtime do you need?

  • Thanx Michael,

    I am actually working on development board which has got a USB port and i have appropriate jumpers available to connect the USB port to the USCI ports of FG4619(UCA0TXD & UCA0RXD).

    And about ur question for "how much real time?" 

    A delay of few milliseconds is acceptable(say max of 20 to 30 ms).

    Regards 

    Dev

  • Okay, so back to the original post, youi said you have problem siwth the terminology in the example code you got.

    Did you read teh 4x family users guide? It explains the the various modules found on any (but not necessarily all) 4x family devices.
    In your case, teh chapters of interest are the clock system (FLL+ clock module), the Universal Serial Communications Interface (USCI, UART mode) and maybe the part about system resets, interrupts etc.
    Readign about the Timers, especially TiemrA won't hurt. And the Digital I/O chapter dontains information about how to reconfigure the port pins for use with the USCI (default state for most pins is GPIO usage).

    Dev Ashish N said:
    A delay of few milliseconds is acceptable(say max of 20 to 30 ms).

    20-30ms latency should be no problem. How fast is your UART/USB baudrate of the onboard USB->ser converter?  With 9600Bd, sending 10 bytes takes 10ms for the plain UART transfer, so this needs to be considered too.

**Attention** This is a public forum