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

Serial communication problem


  • Please log in to reply
5 replies to this topic

#1 magray

magray

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationAustralia

Posted 21 January 2013 - 01:36 PM

Hi, I am having real trouble trying to communicate over the serial bus.

I have exactly copied both these c# programs line for line and run them,

http://blog.codeblac...with-RS232.aspx

 

but the echo back is not at all like it should be, for example if I type

hello

_???

 

world

?+?d

 

my name is matt

[^r????i?[X.?

 

is my netduino broken? I can't work it out?

all settings match exacly on the console program and the netduino code



#2 Cole Prince

Cole Prince

    New Member

  • Members
  • Pip
  • 8 posts
  • LocationJonesboro, AR, USA

Posted 21 January 2013 - 05:05 PM

What are you using to send the serial commands to the Netduino?  Also, are you using the same converter as shown on the webpage?

 

 

Most of the time that I am seeing the serial work correctly but the responses are gibberish it is because I have the serial setup differently on each device.  Since you seem to be getting responses when expected but they are incorrect, I think that your Netduino is most likely working fine but it is just a setup issue.

 

Have you verified that your converter is set to 9600 Baud rate, 8,n,1 as it is using on the Netduino in the example? 



#3 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 21 January 2013 - 06:32 PM

Hi Matt,

 

Welcome to the forums! I think Prince has nailed the two most likely causes - not using an RS232-TTL converter, or using the wrong settings for the baud rate and bits.

 

One thing I like to do in a situation like this, is to loop back the signal in hardware. This will rule out any other cause.

For example, pull the wires out of D1 and D0, and join them. This rules out the Netduino softwareand hardware.

If that does not work, disconnect the RS232-TTL adapter and join pins 2 and 3 on the PC's 9-way serial lead. This rules out the Netduino software/ hardware and the converter hardware.

 

Remember to have fun - Paul



#4 magray

magray

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationAustralia

Posted 22 January 2013 - 04:58 AM

Hi firstly I want to thank you guys for the responses. I am not using the USB in the demo to send commands but an old 9pin DB9 connector with wire straight out the back to the netduino Tx->Rx Rx->Tx and Gnd->Gnd, with COM port, baud and parity all matching correctly

 

But have now realised that is won't work that way unless I have a TTL adapter? Is that correct?

 

So I have ordered a few components that do this TTL with a DB9 connector and a USB connector.

http://littlebirdele...2-ttl-converter

http://littlebirdele...converter-cp210

 

see how I go



#5 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 22 January 2013 - 07:12 AM

Yes, you need the TTL-RS232 adapter.

You can use it with the PC serial port, or buy a USB-serial adapter.

The USB adapters come with different varieties - some have TTL for connection to micros, others have RS232 levels for conection to modems, etc.

The one above is actually USB-TTL so you won't need the converter when using it.

Paul



#6 caEstrada

caEstrada

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 22 January 2013 - 07:18 AM

I would suggest double check the baudrate, stop bits, parity and data bits.  These options should be exactly the same

on both sides, I mean, on the netduino and your terminal.  I use Hyperterminal for these testings.

 

There is another issue I faced once:

 

// read a single byte

serial.Read(bytes, 0, bytes.Length);
 
brought problems in my app.  Instead, I read byte per byte, in a loop.  Yes, sound slow but works perfect, very stable and in an industrial environment.
 
Hope it helps.
 
Regards,





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.