Jump to content
43oh

Serial communication (UART) with other Wifi modules MSP430


Recommended Posts

I understand the code about UART with the serial monitor, What should I change if I want to have TX,RX send data to TX RX on another wifi module?? Please help!!!!

 

 

const int analogInPin = P1_3; //Analog input pin that the output from the current sensor is attached to


int ADCValue = 0; //value read from the output
void setup()
{


  Serial.begin(9600);
  pinMode(analogInPin,INPUT);


}
void loop()
{


  ADCValue = analogRead(analogInPin); 


  
  Serial.print("ADC = " );                       
  Serial.println(ADCValue);   
  delay(20); // fs=1/T sampling time with approx.50Hz signal    
}
Link to post
Share on other sites

I assume you have to have code to talk over a wifi module? And know the other node's IP address, TCP or UDP port it's listening on, etc?

 

This wifi module can be considered as another mcu, which does not need to know the IP address, but I wanted to ask how to write to the module using UART i.e. write to specific pins

Link to post
Share on other sites

This wifi module can be considered as another mcu, which does not need to know the IP address, but I wanted to ask how to write to the module using UART i.e. write to specific pins

A second UART (e.g. Serial1 available on some MCUs), or disconnect the backchannel UART bridge jumpers and use the standard UART referenced by Serial.

Link to post
Share on other sites

A second UART (e.g. Serial1 available on some MCUs), or disconnect the backchannel UART bridge jumpers and use the standard UART referenced by Serial.

Can you explain in a bit more details please? I have tried 'Serial 1' but it says undefined reference to `Serial1 :( I am not good at doing this 

Link to post
Share on other sites

Can you explain in a bit more details please? I have tried 'Serial 1' but it says undefined reference to `Serial1 :( I am not good at doing this 

Chances are then the chip you're using doesn't have 2 serial ports.  See if SoftwareSerial would work for your scenario or see if you even need the serial port at all...

 

Fwiw, the MSP430 F5529 launchpad, FR5969 launchpads, the Tiva-C series launchpads all have more than 1 serial port.

Link to post
Share on other sites

Chances are then the chip you're using doesn't have 2 serial ports.  See if SoftwareSerial would work for your scenario or see if you even need the serial port at all...

 

Fwiw, the MSP430 F5529 launchpad, FR5969 launchpads, the Tiva-C series launchpads all have more than 1 serial port.

 

Thank you so much for your reply! I am using MSP430G2553 launch pad. When i put SoftwareSerial it says 'SoftwareSerial' does not name a type, I can print onto serial monitor normally to read the ADC value but could not transmit that from pin 1.1 TXD to my wifi module RXD pin. When the msp430 is doing print to serial monitor, does that mean the pin1 and pin 2 would have the output as well?

Link to post
Share on other sites

Thank you so much for your reply! I am using MSP430G2553 launch pad. When i put SoftwareSerial it says 'SoftwareSerial' does not name a type, I can print onto serial monitor normally to read the ADC value but could not transmit that from pin 1.1 TXD to my wifi module RXD pin. When the msp430 is doing print to serial monitor, does that mean the pin1 and pin 2 would have the output as well?

Yes, because on the MSP430G2 launchpad, the "backchannel UART" that you see over the USB just happens to be the same as the UART on pins (3 & 4, technically).

 

So from here, you need to analyze what you intend to do with this - and whether that scenario is OK.  I saw you post in another thread about connecting two launchpads with I2C or SPI or something.  I recommend playing with that for now if you have another G2 launchpad.  Getting experience with the "Wire" library (I2C) is good.  Don't forget the pullup resistors you'll need on both those lines, and be sure to connect their GND's together.  Otherwise I would recommend getting the F5529LP or FR5969LP for more I/O capability.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...