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 data problems


  • Please log in to reply
21 replies to this topic

#1 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 10 February 2011 - 04:28 AM

I have a Netduino plus, and a ID-20 RFID reader. I've been able to read the serial data off the ID-20 exactly 2 times then everything quit working. I've verified on my o-scope that the ID-20 is still putting out what looks like serial data.

One thing I did notice that was interesting with the ID-20, is it keeps the serial line high when no data is present. I'm not sure what the ID-20 did before, because I just now put a scope on it.

Does anyone know what might be wrong? I've verified I'm using pin D0, and that the serial port is being opened at 9600,8N1. I've even tried moving to a different COM port with the same results.

Anyone have any advice?

var serialPort = new SerialPort(SerialPorts.COM1, 9600, Parity.None, 8, StopBits.One);
serialPort.DataReceived += OnDataReceived;
serialPort.ErrorReceived += OnErrorReceived;

serialPort.Open();


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 February 2011 - 04:33 AM

akcoder, First of all, make sure that you're running the latest firmware (v4.1.0.6 RC1+ or v4.1.1 alpha 7+). There are a bunch of SerialPort enhancements and bugfixes in the new builds. Do you have a logic analyzer...to see what is coming across the wire? Chris

#3 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 10 February 2011 - 04:56 AM

akcoder,

First of all, make sure that you're running the latest firmware (v4.1.0.6 RC1+ or v4.1.1 alpha 7+). There are a bunch of SerialPort enhancements and bugfixes in the new builds.

Do you have a logic analyzer...to see what is coming across the wire?

Chris


It looks like I'm running "Solution Build Info: 4.1.0.5, Netduino Plus by Secret Labs LLC". I'll upgrade to a 4.1.1 build.

No logic analyzer :( I'm looking to see if I can add that module to my scope (Rigol DS1052E), or get something like the USBee analyzer. What do you run/recommend?

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 February 2011 - 05:01 AM

akcoder, There are lots of nice expensive logic analyzers out there, but I find myself reaching for the Saleae Logic most of the time. Amazing little unit for the money... Chris

#5 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 10 February 2011 - 07:07 AM

I updated to 4.1.1 a6 (I didn't see an a7 out there), and I still get the same thing :( I've verified that the ID-20 RFID reader is hooked up correctly, and that it can read a tag (the ID-20 puts out a 500 msec pulse on pin 10 when it reads a tag). I've put the code into a loop and set it to print out the bytes avail, and it continually says 0. Short of buying a logic analyzer to verify that the data coming into the Netduino is correct, do you have any other suggestions?

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 February 2011 - 08:38 AM

akcoder, You are using the TTL output on the chip, not the RS232 output...correct? Chris

#7 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 10 February 2011 - 06:20 PM

akcoder,

You are using the TTL output on the chip, not the RS232 output...correct?

Chris


Correct, I am using TTL, from the data sheet it says: "TTL Data (inverted)" for the data pin.

Per the ID-20 data sheet, I've connected it pin 1 and 7 to ground, 11 and 2 to 5v, and ping 9 to Netduino pin 0 (COM1 RX).

#8 Fred

Fred

    Advanced Member

  • Members
  • PipPipPip
  • 302 posts
  • LocationUK

Posted 10 February 2011 - 07:24 PM

I've used the ID-20 with the Netduino (Standard) without a problem, so there's no inherent mismatch between the two. No code or circuit to hand I'm afraid, just tested it and disconnected it.

#9 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 10 February 2011 - 09:20 PM

I've used the ID-20 with the Netduino (Standard) without a problem, so there's no inherent mismatch between the two. No code or circuit to hand I'm afraid, just tested it and disconnected it.


Fred, do you have an o-scope handy? Can you verify that pin 9 is held high when no data is present? You can also check this with a logic probe, or an LED (making sure to use a resistor)

#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 February 2011 - 11:28 PM

akcoder, Have you double-checked the baudrate and other serial port settings? I know that you mentioned it worked before, but I didn't see all the serial port in the datasheet... Chris

#11 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 11 February 2011 - 12:33 AM

Have you double-checked the baudrate and other serial port settings? I know that you mentioned it worked before, but I didn't see all the serial port in the datasheet...


Yeah, the serial port isn't listed in the data sheet for some odd reason, but everything I've read says its 9600,8N1 which I've verified.

I read over at arduino.cc a guy saying he had to put a 1k resistor between pins 4 & 5 to make it work. I'm guessing he blew something when he was probing around while it was hot. I'm wondering if I did the same thing... I'll give that a go tonight.

I did find the schematic I'm using to hookup the ID-20.

#12 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 11 February 2011 - 03:11 AM

Have you double-checked the baudrate and other serial port settings? I know that you mentioned it worked before, but I didn't see all the serial port in the datasheet...

Chris,
I hacked up a quick console app and connected the ID-20 to my laptop via a serial->usb adapter, and connecting at 9600,8N1 the data comes across, and is very consistent. So now I'm not sure why my Netduino isn't able to receive the data. I tried the resistor trick I mentioned and it had no effect on the outcome.

Thoughts?

#13 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 February 2011 - 03:33 AM

Chris,
I hacked up a quick console app and connected the ID-20 to my laptop via a serial->usb adapter, and connecting at 9600,8N1 the data comes across, and is very consistent. So now I'm not sure why my Netduino isn't able to receive the data. I tried the resistor trick I mentioned and it had no effect on the outcome.

Thoughts?


Dan, if you connect the ID-20 to your laptop and get data via a USB->RS232 adapter, then it's likely outputing at RS232 voltages.

RS232: -12V to 12V
TTL: 0V to 3.3V (or 0V to 5V)

If you hook up RS232 signals to the digital pins on the Netduino, you can damage those pins. Do you have something that you can plug into D0 and D2 (LED, button, etc.) to make sure that they haven't been damaged?

Chris

#14 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 11 February 2011 - 03:36 AM

Dan, if you connect the ID-20 to your laptop and get data via a USB->RS232 adapter, then it's likely outputing at RS232 voltages.

RS232: -12V to 12V
TTL: 0V to 3.3V (or 0V to 5V)

If you hook up RS232 signals to the digital pins on the Netduino, you can damage those pins. Do you have something that you can plug into D0 and D2 (LED, button, etc.) to make sure that they haven't been damaged?

Chris


Chris, I've checked this actually and the pin is operating fine. I've also checked the output from the ID20 and it is TTL voltages, not RS232 voltages. The usb->serial adapter I'm using happens to tolerate TTL voltages (as I've read many of your USB->serial adapters do).

#15 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 February 2011 - 03:49 AM

Hi Dan, Let's go back to basics then... Can you please attach your actual source/solution as a ZIP file? This may not be electrically related after all... Chris

#16 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 11 February 2011 - 04:25 AM

Chris, I think I may have discovered the issue, I'll get back to you in a few after I confirm it (I believe my proto shield wasn't making full electrical contact w/ the Netduino, but only on pin D0, grr). In the mean time, is there a Netduino code wiki or repository? I wrote some pin checker code I'd like to share in the hopes that it may help someone else in the future...

#17 Charles

Charles

    Advanced Member

  • Members
  • PipPipPip
  • 192 posts

Posted 11 February 2011 - 04:36 AM

By the way, I wrote a nice little class to handle the ID card reader series, and then other members enhanced it. It works nicely - Be sure to check it out. http://forums.netdui...d-reader-driver

#18 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 February 2011 - 05:39 AM

Chris,
I think I may have discovered the issue, I'll get back to you in a few after I confirm it (I believe my proto shield wasn't making full electrical contact w/ the Netduino, but only on pin D0, grr).

In the mean time, is there a Netduino code wiki or repository? I wrote some pin checker code I'd like to share in the hopes that it may help someone else in the future...


Hi Dan,

Ah, I think you may have found the culprit. I didn't realize that there were other parts in your circuit.

We're working on a Wiki; for now, please share your code in the project showcase. Much appreciated!

Chris

#19 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 11 February 2011 - 06:31 AM

By the way, I wrote a nice little class to handle the ID card reader series, and then other members enhanced it. It works nicely - Be sure to check it out.

http://forums.netdui...d-reader-driver


Charles,
I actually saw that after I had written my own RfId class. I did steal some ideas from your stuff. I'll post mine to the project showcase when I get done.

#20 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 11 February 2011 - 06:34 AM

Ah, I think you may have found the culprit. I didn't realize that there were other parts in your circuit.


Chris,
After two days of trying to figure this thing out I finally have it licked! It was indeed what I intimated earlier. Everything works now like a charm!

Thank you for your help!




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.