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.
The question:
How do I interface the MSP430FG4618 Experimenter's Board with a PC using Hyperterminal so that I may send a character to the computer screen?
My text:
Hello, my name is Patrick. I am a student at Texas Tech University in Lubbock, Texas. I have had some experience using the MSP430 Experimenter's Board in the past, but even so, this microcontroller is my first and only microcontroller experience, and that experience is very limited ( I know how to control LEDs and the LCD, and a few other things with the timers to create a PWM signal, but not much else ). I now need to learn how to interface the Experimenter's Board with my PC using Hyperterminal so that I can send character data to the computer monitor. I have a rough idea of how this should go, and I believe you use the serial port and USART of the experimenter's board, but my main reason for posting this is to request any guidance that anyone here would care to give me. I do not know how to configure Hyperterminal for this type of application, and in general, at this moment, I simply do not know how to do it. I will be looking at RS-232, the serial port of the board, the MAX 3222 and the USART until I figure more out. Also, for a now Windows 7 user, is there a "best" Hyperterminal to use? I'm reaching out for any help with this whether it is a very technical and detailed description, or if it's a rough explanation of the basics. Thank you for your time.
Hi Patrick,
The MSP430FG4618 on the Experimenter's Board is connected to the RS232 port via the USCI module - channel A0. You should configure this channel for communication with that port. I recommend loading a code example that uses that port, such as the echo example
msp430xG46x_uscia0_uart_9600.c from http://focus.ti.com/lit/ml/slaa441/slaa441.pdf
For the hyperterminal: there are many programs out there. I use the simple "Windows Hyperterminal" that comes standard with the OS. You should choose the following port settings:
9600 baud, 8 data bits, 1 stop bit, no parity and no flow control.
Brandon, thank you for your reply. I appreciate your help, but I have a couple of questions that may be pretty simply. Just to verify, the code that you directed me to is an example of a situation in which you are first transferring a character to the MCU from Hyperterminal, and then the MCU echoes that character back to the PC on Hyperterminal...correct? So, I could use a notepad file with some text and use Hyperterminal to send that text from the file to the MCU and then have it echoed back to the PC onto hyperterminal. Or do you simply type into Hyperterminal and then have what you type echoed back? Perhaps either or. Second, do you perhaps know if it is required for me to use something such as a MAX 3222 for this type of porject? What exactly do I need a MAX 3222 for? I only mention the MAX 3222 because I have heard of others needing it for their projects doing something similar with Hyperterminal. Again, thank you for your time.
P.S. I actually have somewhat limited use of the MSP430 Experimenter's Board right now and so unfortunately I can't trial and error as much as I would like. Hopefully with just a little bit more info I can figure out the rest.
I also forgot to add a question to my previous thought process, but is it sufficient to simply have a serial port cable between the port on the MCU and the port on the computer? Is there a possible problem with output and input voltages there? Thanks
Yes, the input voltages are a problem and this is the reason for the use of a MAX232 or similar.
The V.24 interface on PCs uses -3..-12V for the 'mark' level and +3..+12V for the 'space' level. The MSP, however, uses VCC for mark and 0V for space (TTL compatible). Both versions are called 'RS232'. The TTL variant id mainly used for short distances on the same PCB, while V.24 is user over longer cables and between different devices.
The MAX232 is used to interface between the two variants. It takes 5V supply voltage and creates +-10V through the capacitors. Also it inverts the signals and protects the TTL side against voltage spikes on the V.24 (out-)side.
On my current experimental board, I feed the MAX232 with the same 3.6V the MSP is powered by. Below 3.2V, my PC loses connection (many PC cards do not accept voltages down to 3V, as they should, following the specs) but with 3.6V it works fine.
The MSP hardware does not support RS232 handshake, so the only lines you need to connect are RX, TX and GND. (you can support RTS/CTS handshake but then your MSP software has to do it manually - and you need a 'bigger' chip than the relatively cheap MAX232, one with more lines, such as teh MAX238)
Thank you very much for the information. I have seen people construct their circuits with wires going directly from the max 232 pins into the holes of the PC's serial port, and I think I remember them using three, one for RX, TX and GND as you mentioned, but is there a way to know which pin-holes on the PC's D9 connector to connect the MAX 232 to? Im pretty sure I can find the pin configuration for the MSP430's serial port, but is the PC's the same? Also, I ordered a MAX 3232 ( thirty-two thirty-two), which I believe will provide nearly the same functionality as a MAX 232, but not totally sure. When you say "does not support RS 232 handshake", I suppose you mean I cannot simply use a serial cable? Thank you again. I appreciate all help I have received.
Patrick8918 said:
When you say "does not support RS 232 handshake", I suppose you mean I cannot simply use a serial cable?
If you are using the black FG4618/F2013 experimenter's board, and you are using USCI channel A0, you should be able to connect a serial cable from PC directly to the DB9 on the board and establish communication. No intermediate circuit should be required.
Today, I can't help you with the wiring, as our server is down most of the time (and unstable in between), so I cannot look at the docs or the existing layouts.
Brandons answer seems to indicate that some comparable circuitry is already on the experimenters board you have. At least for USCIA0. It's a feature that really should be there on an experimenters board. You should check.
With 'does not support handshake' I mean that the USCI hardware on the MSP does not have any hardwired support for the (optional) RTS/CTS signals which are used to indicate that one side is busy and cannot receive additional characters. If you want (or need) this faeature, you can dedicate two port pins to this job and of course need to too route them through an RS232 driver such as the MAX232. And your MSP software needs to check/set the lines and stop sending etc. manually. Required for the connection are just RX and TX and GND. You just have to disable handshake when settign up hyper terminal (or any other software)
You can use a common serial cable in any case. There are just some unused lines.
The MAX3232, compared to the MAX232, is specified to 3..5.5V supply voltage (MAX232 is officially 5V only, our ST232C, a replacement chip, works down to 3.6V, even if specified only 4.5..5.5V) and it has a higher maximum baudrate of 1 MBd (MAX232 is only 220kBd). Most PCs are limited to 115kBd, but the MSP can go as high as 1MBd. Both have two receiver and two transmitter lines.
I actually have the somewhat older GREEN Experimenter's Board, but I believe they have near identicle functionality? Anyways, you both have helped me very much, Im at school now trying to get it to work. I will try to take it from here now. If you have any other comments or helpful info though feel free to let me know. I won't guarantee that I don't have more questions here soon haha.
So I've spent 6 hours today/tonight trying to get this to work and to no success so far.
I have a lot more details though of what I've been doing. Other than the posts I have received on here, I've listed 3 sources I used at the bottom of this long post.
These are all the details of my setup that I can think of. I understand this post is really long, but at the very least look at my questions if you care to read anything at all. Thank you.
I setup a circuit on a breadboard using the MAX 3222, I supplied it with 3.7 Volts, though it can take between 3.3 and 5.5 Volts. I use 5 capacitors , C1 = .2uF, C2-C4 = 1uF, and then also use a .1uF on at Vcc. I followed the pin-out for the serial connectors and followed the instructiona from a website that I listed below as number 3 of sources I've used. Again, I am using the MSP430 Experimenter's Board, it is the green one, and I am using the USCIA0 9600 sample code for echoing a character. I simply copied and pasted this code into CCE and, debugged the active project, and ran it onto the Experimenter's Board. The board is being powered and is connected to the PC through the MSP430UIF FET USB cable adapter. As unrefined as it may be, I simply had 22 gauge solid wires stuck into the pin-holes of pins 2,3,and 5 for Rx, Tx, and GND respectively with the wires routing to my breadboard-MAX3222 circuit. Experimenter' Board Tx --> T1in and ExpB Rx ---> R1out just like in the circuit if you look at the #3 link I posted. I have the Enable connected to ground and the SHD connected to Vcc with all the extra T2 and R2 pins grounded. At first I used a serial-cable to connect to the MAX3222 circuit but it didnt work so I just directly connected wires from that board into a D9 connector connected to the serial port on the PC making sure to keep in mind that the pins are mirrored for female and male connectors. I've measured the input into the serial port transfer port with a multimeter and it's reading right at 5 V like I think it should. I've gone into Device Manager to make sure that the COM1 port is 9600 baud, no flow control, no parity, and verified that it matches what is setup on hyperterminal. In frustration I actually just simply connected a power supply to the ground and Tx pin on the serial port of the PC and put it at about 7 Volts, and hyperterminal actually reads in some weird random traingular-like character everytime I flip the supply on/off.
Questions :
Do I really need to simply have the MAX 232 instead of the MAX 3222?
From what I've read on the datasheet of the MAX 3222, it should work just as fine as the MAX 232, but perhaps not.
How to I send character data to the board with Hyperterminal?
Also, maybe I just do not know how to use hyperterminal correctly. After I have everthing setup, what is the best way to echo a character? Do I simply type on the keyboard? That does not seem to do anything when I type. I read somewhere else to just make a notepad text file and go to Transfer and send the text file that way, but it's not doing anything either.
The Circuit I'm following....should it work the same for the MAX 3222?
There is a page in the datasheet that seems to mimic the circuit in my third source identically other than having enable and SHD pins.
Serial port on the computer?
There is one 9 pin serial port on the PC, it is green on the back of the PC and it is marked with |O|O| and I dont know exactly what that means honestly. In the device manage under ports it claims I have 3 ports, printer port, COM1 and COM3 which is where the USB Fet is, so I'm assuming the one I need is COM1.
I've gone into Device Manager to make sure that the COM1 port is 9600 baud, no flow control, no parity, and verified that it matches what is setup on hyperterminal. In frustration I actually just simply connected a power supply to the ground and Tx pin on the serial port of the PC and put it at about 7 Volts, and hyperterminal actually reads in some weird random traingular-like character everytime I flip the supply on/off.
For all I know, the serial port on the MSP430 is messed up. The boards have been used repeatedly by others and is property of the university, but I would much sooner blame my lack of knowledge of this then the board; it's just a possibility. I've gone into Device Manager to make sure that the COM1 port is 9600 baud, no flow control, no parity, and verified that it matches what is setup on hyperterminal. In frustration I actually just simply connected a power supply to the ground and Tx pin on the serial port of the PC and put it at about 7 Volts, and hyperterminal actually reads in some weird random traingular-like character everytime I flip the supply on/off.
Any help is greatly appreciated. I will be continuing to work on this tomorrow (Wednesday)
1. MAX 3222 Datasheet
http://datasheets.maxim-ic.com/en/ds/MAX3222-MAX3241.pdf
2. Pins on serial port
3. Does RS232 work ? Five simple rules to ensure your RS232 system works.
I had a big long post that I tried to post last night with all tyhe details of my experiment, but then I didnt save it and when I hit post it gave me some crap about the administrator blah blah. So, anyways, I will just say that I still cannot get it to work. I have the settings on the COM1 port and the Hyperterminal the same. I've tried with a serial cable plugged directly in and now also with a MAX 3222 circuit setup. I have made sure, by looking at the faces of each port whether it is male or female that I am using the pins 2,3, and 5 for RX TX and GND respectively. I am using 2 .1uF caps and 3 1uF caps and the circuit in the datasheet as well as the circuit in link 2. I will post 3 links to things that I have used pretty extensively. When using my MAX 3222 circuit I have 22 guage solid wire connetic the pins of the MSP to my circuit and then to the PC. I read somewhere else that someone maybe had a problem with the sample code used? I don't know, I will try a couple of the other sample programs to see if possibly they work. Also I am not 100% sure if the MAX 3222 will work but I'm almost positive that other than the EN and SHD pins, it is the same as the MAX 232. A main question I have is, if I am using a sample program that echoes characters sent from the PC to the MSP, then how do I send the characters from the PC using hyperterminal? Do I simply type on the keyboard and it should work? Or do I need to send a text file using the Transfer button? So, anyways, anyone with any possible guidance with this informatiuon, feel free to reply. Thank you for your time again.
1. Serial port pin-out
2. Getting RS232 to work
3. MAX 3222 Datasheet
I just looked into the MAX3222 datasheet.
Patrick8918 said:I use 5 capacitors , C1 = .2uF, C2-C4 = 1uF, and then also use a .1uF on at Vcc.
hmmm, the datasheet talks about 5 times 0.1µ @3.0..3.6V. 1µF is probably too much for the charge pump drivers. Only the MAX3237 (and the original old MAX232)requires 1µF for proper operation over full supply range (the newer MAX202 uses 0.1µF too).
The MAX3222 is fully function compatible to the MAX232, with two exceptions: You need to pull EN to GND or you won't see any activity on the receiving end (your MSP won't see anything), also you'll need to tie SHDN to VCC or it will deactivate the chip completely. The MAX232 does not have these two controls. THis is the main difference and you already did that.
Maybe you mixed up RX and TX? What's TX for the MSP is RX for the PC and vice versa. So the MSP needs to be connected with Tx_IN and Rx_OUT while the PC side is Tx_OUT (connected to PCs RX pin) and Rx_IN (connected to PCs TX pin). It really can be a bit confusing.
There's no need to check the OCM port settings in device manager. They are overridden by HyperTerm (or any other application that uses them). It's just an initial (default) setting. The only thing in the device manager that might have some influence (as it affects the port driver itself rather than the application) is the FIFO control. Most PC software simply does not care about a FIFO active or not. The windows driver handles it. But all other settings can be (and usually are) set by the application.
It is, however, important, that the baudrate you calculated for setting up the MSP UART matches the settings in HyperTerminal.
Your experiment with the power supply, while being a bit risky, indicates that HyperTerminal is running as it should and has the right port selected and open. The 'triangular character' is just something that comes in due to line bouncing when you activate the power supply. It shows that the port is 'alive' and something undetermined is happening. You may see similar random characters if the baudrates or stopbit/parity settings do not match properly.
I just checked my application (our server is up again) and I have the following wiring for MSP through MAX onto 9 pin female D-Sub connector (using a standard serial cable to the PC):
MSP TX to T1IN, T1OUT to Pin 2
MSP RX to R2OUT, R2IN to pin 3
VCC to T2IN, T2OUT to pin 8 (this is a permanent CTS signal, so the PC thinks the MSP is ready to receive data, if hardware handshake is enabled)
Pin 5 and shield connected to GND.
You can switch T1 and T2 pins as well as R1 and R2 pins if you want. It is basically the same as in the drawing in your first link.
Since we use the MAX202 on 5V, I have a diode and pullup on T1IN rather than a direct connection to MSP TX, and a protection resistor in the line from R2OUT to MSP RX. I'll have to check whether using the MAX3222 is cheaper than using the MAX202 plus two resistors plus a diode. :)
I use RS232 on four different projects (with three different microcontrollers) and with 115.200 Baud. No problems. (On even more projects and processors, I use an RS485 connection with 9600 and 38400 Baud) so chances are that you'll figure out sooner or later how to make it work.
One suggestion: in the demo code, just after reading RXBUF, you should toggle an LED on your board. So you'll see that the MSP has received a char even if sending back doesn't work. Else you'll never know on which end things are broken. When I started with the 5438, all I had was a single LED on the adapter board. You won't believe what you can do with just an LED (and no debugger). I must agree that a serial console is much better, but until I had my UART stack running on the new USCI module...
P.s.: your 'big long post' finally made it into the thread. I know this kind of problems. If you have online games with banner advertising, sometimes the ad steals the system key focus while you are typing. If you then hit backspace to correct a typo, the browser goes to the previous page and all your typing is lost. great. I usually type in an external editor and copy/paste the result when finished. This board and its editor is an exception (it has a protection popup against accidental loss of the text by leaving the page). I still mark all and copy into clipboard, before I post. Just in case.
It has been a couple days since I have looked at this. Actually since Thursday, but I see now that my "big long post" or posts actually have made it on here now. I got some feedback from the professor about this as well and along with this information you have given me I should find some success soon enough when I start this up again Monday. I'm impressed with the patience and support I've been provided with this. I will post on here as soon as I get this working to let you know that it was worth it. Thank you again.
The main reason for this post is to say that I have gotten the character echoing to work and to say Thank You to everyone on here that has helped me. When I type on the keyboard, the characters are simply sent to the Experimenter's Board and then echoed back onto the screen.The rest of this is to describe the details of my experiments for those who care to read.
Ok! So finally I got this to work a couple days ago. It turned out I was making a couple silly mistakes. First off, I was grounding the inputs of the chip as well as the output which was not good. Luckily I have 3 of these Max3222 chips. Secondly, I was directly hooking the wires from my MAX3222 circuit into the Female DB9 connector on the Experimenter's Board. I thought it was intuitive to have the DB9 connector of the PC connect to the MAX3222 circuit and then that circuit directly connect to the DB9 connector on the Experimenter's Board, but apprently that is not the case for whatever reason. I think it depends on what type of mode you are using? I am honestly not completely sure. If I had payed more attention to the sample code diagram, in the commented-description at the top of the code file, I may have noticed this earlier.
On header1 of the board there are a couple of pins that are for receive and transmit for the USART in UART mode. Once I fixed my circuit and connected to these pins rather than the DB9 connector it began to work on Hyperterminal and Putty both. The receive and transmit pins I described are for one piece of sample code in particular, the MSP430xG46x_USART1_UART_9600 C code file which is in the slac118d code examples. Before I was trying the MSP430xG46x_USCIA0_UART_9600 C file also in slac118d, but when I was trying to get things to work in frustration I ended up switching just to see if I could get it to work, and now it works with the UART mode of the USART, but not with the USCI, even when I switch the Tx and Rx to what I believe to be the appropriate pins on the Experimenter's board ( pins 5 and 6 of Header 4 ). Anyways, I will be reading any notes that anyone may care to add, otherwise, thank you again.
Patrick8918 said:now it works with the UART mode of the USART, but not with the USCI
I don't know what you mean by this. I do not know the experimenters board, but AFAIK an MSP has only an USART or an USCI module. I'm surprised to see that there is demo code for both types for the MSP430xG46x. Maybe which one to use depends on the 'x'?
While both do have an UART mode, USART and USCI are different. The biggest difference is that USART have two separate interrupt vectors for RX and TX (on some devices shared between devices), while the USCIs have one single interrupt vector for RX and TX (per sub-module) and an interrupt vector register to determine whether the interrupt was an RX or TX interrupt.
Unfortunately, TI hasn't bee very straightforward with this, so there are some devices with a mixture of both.
So the required code highly depends on the actual MSP device.
Hi Mr Patrik,
I just gone through your project, its sounds good. So did u finish your project and got the required functioning of UART using MSP430FG4618.
Please let me know about your current status on the project so that i can help you if you need me.
Thanks,
**Attention** This is a public forum