Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino plus 2 & Serial Communication


  • Please log in to reply
5 replies to this topic

#1 PapaPep

PapaPep

    New Member

  • Members
  • Pip
  • 3 posts

Posted 26 February 2013 - 12:46 AM

Hello,

I'm brand new to microcontrollers/netduino so please go easy on me...it's my first post!

Here is the issue:

I am trying to communicate via a serial port (com1) on the netduino plus 2. I'm using a rs232 shifter from spark fun. (https://www.sparkfun.com/products/449) I have it hooked up to the 3.3v pin for power and have the tx and Rx lines 'swapped'. The tx and rx LEDs on the shifter light up when sending and receiving data. However the serialport_ datareceived event never fires! I've tried swapping the tx and Rx pins to no avail. (The event fires if i pull the rx wire from the netduino...although with no data...so im pretty sure the software is hooked up properly. Any suggestions?

I'm attempting to replace a pc to do my serial communication...so the netduino is acting as a 'host'. Would the cabling need to be different in this case? The device I'm communicating with requires a crossover cable rather than straight through when communicating with a pc. Do I now need to use a straight through cable?

Any suggestions would be appreciated. I'm hoping this simple project will lead to more complex (and fun) projects in the future.

Thanks!
-Greg



#2 PapaPep

PapaPep

    New Member

  • Members
  • Pip
  • 3 posts

Posted 26 February 2013 - 04:50 PM

I was able to get my hands on a straight-through serial cable.  That was the issue!  The only problem now is that existing cables won't work.  Does anyone know of a little adapter to switch the tx/rx pins?



#3 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 26 February 2013 - 11:24 PM

Welcome to the forum PapaPep!

As far as I know, a serial cross over cable (or null modem) simply has the tx/rx lines swapped. This would mean the crossover should work when lines are swapped with respect to using a straight cable.

In serial communication, there is no master or slave roles, this is more a matter of what "protocol" your software uses.

If you are using the handshake lines, things can get more complicated. Here's a bit of reading that might help:
http://en.wikipedia....wiki/Null_modem

What kind of device sits on the other end of the Netduino?

I'm not sure what the adapter would do and what you need it for. Will you be using different cables from time to time or is it that the crossover is fixed to the device and that you need to switch between debugging and actual communication with the device?

#4 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 27 February 2013 - 12:03 AM

PapaPep,

 

Another good source of information is the CodeBlack blog http://blog.codeblac...with-RS232.aspx He has a series of articles on using the Netduino.

 

Chuck



#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 27 February 2013 - 02:25 AM

Hi PapaPep,

It's possible that the data lines on your RS-232 to TTL level converter are unidirectional. In that case you will need the swap the pins on the cable (as you have done) instead of at the Netduino.

Here's a Male-to-Female null modem adapter:
http://www.monoprice...&seq=1&format=2

The adapter should swap pins 2 and 3 (TX and XX) on the RS-232 cable for you.

Chris

#6 PapaPep

PapaPep

    New Member

  • Members
  • Pip
  • 3 posts

Posted 12 March 2013 - 07:57 PM

Hey guys,

 

Thanks for all of the replies!  I am using the netduino the read data from the serial port of a medical device.  Unfortunately each of these devices have 'proprietary' serial pinouts.  It would be nice to use the cabling that comes bundled with the device rather than having to source it separately.  That's why it would be nice to have an easy way to swap the tx and rx pins.  The only thing I can think of is buying a version of the serial converter without the db9 connector and swapping the lines between the db9 and the board.

 

Thanks again for your help, I really appreciated it!

 

-Greg






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.