Arduino MEGA Hardware UART serial communication with MSP430

Hi All,

I want to send a character/byte/String from the MSP430 to the Arduino Mega using the hardware uart on both sides. I did write some MSP430 code to sent up the UART at 9600bps and on the Arduino side I am using Serial2's RX pin(also set at 9600bps) to receive the data sent by the MSP430. However I am not getting what I am sending, so what I can assume is there is a difference in the dataframe that MSP430 is using for the communication while my Arduino expects some other frame format. How can I solve this issue? I am not using a launchpad so using Energia is not an option for me. I am also too much of an expert on Microcontroller programming at the register level, have been programming the Arduino boards with the help of its already available libraries so digging into the data sheets of the two controllers is proving to be something really difficult for me. The only option left for me was to check what kind of frames is Hardware Serial library code on the Arduino side expecting, but this is somthing I am really new to. Can anyone help me point to the correct direction?

Would that be the 5V version of the MSP430 processor? Or is your Arduino Mega operating at 3.3V?

My MSP430 operates at 3.3V and I am powering my Arduino from the usb itself. What do you suggest? Can this be really an operating voltage issue?

Absolute Maximum Ratings(1)
Voltage applied at VCC to VSS –0.3 V to 4.1 V
Voltage applied to any pin(2) –0.3 V to VCC + 0.3 V

(1) Stresses beyond those listed under “absolute maximum ratings” may cause permanent damage to the device. These are stress ratings only, and functional operation of the device at these or any other conditions beyond those indicated under “recommended operating conditions” is not implied. Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability.

Yes, I get that, however I am not exceeding the limit, so as to cause any harm to the microcontroller. I am running my MSP430 at 3 Volts with an external power supply and am powering the Arduino from the PC itself via USB. What am I doing wrong?

If you measure the voltage of the serial pins on your Arduino, you will see that it is higher than the limit for your MSP430, so connecting theese lines is a bad idea.

You could use a level-shifter like this

http://husstechlabs.com/support/tutorials/bi-directional-level-shifter/

or simply a 4050.

BTW I have tried communicating from my launchpad to my Arduino using seial at 9600 baud, without any trouble. I use Energia, I don't know if that makes any differece

xenonforlife: Yes, I get that, however I am not exceeding the limit, so as to cause any harm to the microcontroller. I am running my MSP430 at 3 Volts with an external power supply and am powering the Arduino from the PC itself via USB. What am I doing wrong?

VCC of the MSP430 is 3 V. The absolute maximum limit is VCC + 0.3 which is 3.3V.

VCC of the Arduino is 5 V.

5 V is much greater than 3.3V. Connecting your 5V Arduino to your MSP430 exceeds the absolute maximum voltage you can apply to your MSP430. You will damage your MSP430. May have already damaged your MSP430.

Erni: If you measure the voltage of the serial pins on your Arduino, you will see that it is higher than the limit for your MSP430, so connecting theese lines is a bad idea.

You could use a level-shifter like this

http://husstechlabs.com/support/tutorials/bi-directional-level-shifter/

or simply a 4050.

BTW I have tried communicating from my launchpad to my Arduino using seial at 9600 baud, without any trouble. I use Energia, I don't know if that makes any differece

Thank you so much for your reply...That was exactly what I was looking for...yes I did find a lot of info on Energia and using the launchpad..I guess the libraries written for Energia and Arduino are similar so the UART initialization and framing must be similar too..btw could you tell me which MSP did you use on your launchpad to do this? was it the MSP430g2553? I have ordered a launchpad myself..I wish to try with that...which level shifter did you use?

:slight_smile: No I did not damage it…thanks to your help…I stopped using it the way I did immediately…till I heard from you again…now I am not making the same mistake again…thanks again…will see if I can catch hold of a level shifter…

I have had success going from a higher voltage to a lower voltage using a simple voltage divider. Keep the wires as short as possible, use resistors in the low to mid kilo-ohm range, and shoot for a voltage at or just below 3V (but well above the HIGH threshold).

Going the other way, a pair of NPN transistors will work.

Erni: or simply a 4050.

I don't think I can use the 4050 as I am using the MSP430 as my transmitter, I need an up converter...however the point which is still a bit confusing to me is...how can my MSP be destroyed if I am not "supplying" a higher voltage in its pin...my problem is I am getting a 3.3v output whereas my arduino expects a 5v input..if I am getting this correctly..is there still a possibility of board damage..might be a noob question but just curious since this came up a few times...

[quote author=Coding Badly link=topic=162856.msg1222269#msg1222269 date=1367310398] Going the other way, a pair of NPN transistors will work. [/quote]

Yes I actually need this as I plan to use my MSP430 as a one-way transmitter...I need a upconvert a 3.3 to 5v to feed it to my Arduino...

That may work without doing anything special... be back in a minute...

VIH --> Input High Voltage, except XTAL1 and RESET pins --> VCC = 2.4V - 5.5V --> Min = 0.6VCC “Min.” means the lowest value where the pin is guaranteed to be read as high

5.0 * 0.6 = 3.0V.

My MSP430 operates at 3.3V

You are just past the threshold of it working. 3.0V to 5.0V on an Arduino input pin is HIGH. So 3.3V should work reasonably well. An output from the MSP430 connected to an input on the Arduino should work (don't forget to connect the GNDs).

An output from the Arduino connected directly to an input on the MSP430 exceed the limits of the MSP430 and may damage the MSP430.

[quote author=Coding Badly link=topic=162856.msg1222291#msg1222291 date=1367311225] You are just past the threshold of it working. 3.0V to 5.0V on an Arduino input pin is HIGH. So 3.3V should work reasonably well. An output from the MSP430 connected to an input on the Arduino should work (don't forget to connect the GNDs).

An output from the Arduino connected directly to an input on the MSP430 exceed the limits of the MSP430 and may damage the MSP430.

[/quote] That was exactly what I was wondering, in this case there is no reason for board damage...but anyhow I had stopped using it...just in case there was something that I myself did not understand...That means I am back to square one...maybe trying it out with a launchpad is the only thing I can do now...or I should try and take a look at the HardwareSerial implementation of Arduino and find out what exactly it is expecting..what do you suggest?

I was under the impression that you would need a levelconverter even if you use tx from MSP430 -> Arduino. If I measure the voltage on the RX pin on my Arduino it is 5V, so if I connect this directly to the MSP430 tx, wouldn't I exceed the limit ?

could you tell me which MSP did you use on your launchpad to do this? was it the MSP430g2553?

Yes it is a M430G2553

Erni: If I measure the voltage on the RX pin on my Arduino it is 5V, so if I connect this directly to the MSP430 tx, wouldn't I exceed the limit ?

Good catch! I have a bad habit of forgetting about the USB-to-serial converter. You should not use the Serial pins / USART0 because of the converter.