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 reading from db9 serial


  • Please log in to reply
7 replies to this topic

#1 allen

allen

    Member

  • Members
  • PipPip
  • 21 posts

Posted 11 April 2012 - 06:18 AM

I have a device that has a db9 male cable coming from it and I'm told talks SPI. I need to be able to read this over the netduino digital I/O pins. What do I need to do, buy or write to make this happen? $ isn't a problem, I just need this to work. Even if that requires doing something strange like converting to some other protocol using a uart or something? (yes, I'm clueless on this and I deeply apologize). But I really need to figure out a way to get this to work. Any and all suggestions are welcomed.

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 11 April 2012 - 07:04 AM

Hello Allen. I don't think you'd find SPI signals over a DB9 connector, unless the manufacturer drove crazy. Instead, I bet on a RS232, which is a normal UART. You only need a level converter such as a MAX232 chip, or any ready-to-go decent shield doing that. Anyway, if I were in you, I'd check the signals with a scope. In case, just ask someone able to check it. You should not rely on thoughts, but on truths. Cheers
Biggest fault of Netduino? It runs by electricity.

#3 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 11 April 2012 - 08:03 AM

Hi Allen, I agree with Mario that it is more likely to be RS232 on a DB9. If you don't have a scope, you could use a voltmeter to check the voltages between pins 2 and 5, and pins 3 and 5. Pin 5 is normally the ground, and pin 3 is normally the output on a male connector (sometimes pins 2 & 3 get swapped). If it is RS232 you will see voltages like +/- 5V or greater on those pins. If you see that pin 2 or 3 are ever negative with respect to pin 5, that is probably proof of RS232. If you only see positive at 5V or less, it does not prove its RS232 since SPI logic signals could be using 5V, but more than 5V would probably be proof enough. (If it does turn out to be SPI, I understand that the Netduino can only act as an SPI master. That might be an issue.) Hope this helps - Paul

#4 Gorf

Gorf

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 11 April 2012 - 09:31 AM

If it does turn out to be a RS232 serial device, I bought one of these to get my comms working. It works, it arrived quickly (2 weeks - not bad considering it came from China), it was inexpensive, and considering it's an eBay seller, the feedback for me (the buyer) was left as soon as payment had been sent - which is the way it should be.

It needs pins 0 and 1 on the ND+ connecting to RxOUT and TxIN respectively, the GND next to pin 13 goes to GND and (where I made my mistake) 3v3 near the microSD goes to VCC.

#5 allen

allen

    Member

  • Members
  • PipPip
  • 21 posts

Posted 11 April 2012 - 05:43 PM

spoke with the rep for the device I'm trying to communicate with. He's saying it may not be SPI. Can anyone decode what he is saying here? he tells me "You can communicate with the LMU itself using either serial cable adapter on Aux1 @ 15200 8-n-1. The only difference is that the 133564-1/A serial adapter requires a null modem cable." is this rs232?

#6 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 11 April 2012 - 06:12 PM


"You can communicate with the LMU itself using either serial cable adapter on Aux1 @ 15200 8-n-1. The only difference is that the 133564-1/A serial adapter requires a null modem cable."


Hi Allen,

Yes it is RS232.

My take on the numbers he gives are:
  • baud rate 15200 EDIT: 15200 is not a standard baud rate. 19200 and 115200 are standard.
  • 8 data bits
  • no parity bit
  • one stop bit
A null modem cable is a cable that swaps pins 2 and 3 over. I don't think you need one.

If you were connecting this device to a PC, you would find that the sex of the DB-9 connector is wrong to connect it directly to the PC. Hence you would need a "null modem" cable that allows you to connect two male connectors together, and swaps pins 2 and 3 over so that both ends don't try and drive the same wire.
Normally a PC would connect to a modem, a modem has a female DB-9. Pin 2 is the data out of the modem, and pin 3 is the data into the modem. (Pin 5 is ground).
EDIT: When you join two PCs together directly, you don't have a modem - hence the name "Null Modem"


So it sounds like your DB-9 male has ground on pin 5, data from the device on pin 3, and data to the device on pin 2.

You will need a level shifter to connect it to the Netduino. Gorf's link took me to a "Arduino Mini MAX3232 RS232 Shield" on Amazon, and this looks perfect for the job (correct sex).

Paul

#7 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 11 April 2012 - 07:25 PM

Allen,

I think you need to go back to the rep and ask him to confirm the actual baud rate.
15200 is not one I have seen before, I think he may have intended to write 115200 or 19200 baud.

I just edited my post above to reflect this.

Typical rates I have used are: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200.

Paul

#8 allen

allen

    Member

  • Members
  • PipPip
  • 21 posts

Posted 17 April 2012 - 01:19 AM

I believe you were right about the baud rate. Typo there. I'm trying to communicate with the setup now and it's turning into a real beast.




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.