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

System.ArgumentException with Serial Port

System.ArgumentException serial com SerialPort 4.3

Best Answer Chris Walker , 20 February 2014 - 10:09 AM

Hi Graham, COM5 is the serial port # on your PC. Pins D0/D1 are serial port "COM1" on your Netduino. If you change COM5 to COM1 on the Netduino, it should work. [There are only 4 COM ports...so COM5 will correctly give you an error.] Does that help sort things out for you? Chris Go to the full post


  • Please log in to reply
2 replies to this topic

#1 Graham Best

Graham Best

    New Member

  • Members
  • Pip
  • 2 posts

Posted 20 February 2014 - 09:05 AM

I'm trying to open a serial port and I'm getting an exception. I'm using a Netduino 2 with 4.3 firmware and Visual Studio Professional 2012. I'm using a FTDI cable that I picked up from Amazon:

 

http://amzn.to/1fm5aib

 

It shows up as COM port 5. I double checked to make sure that I wired the cable to the Netduino correctly:

FTDI cable (pin 1, GND) -> Netduino GND

FTDI cable (pin 4, TXD) -> Netduino pin 0

FTDI cable (pin 5, RXD) -> Netduino pin 1

 

I'm able to open COM port 5 successfully with HTerm 0.8.1 beta.

 

When I try to load the code on to the Netduino, I get the following error in a dialog box:

 

An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll

 

The code is based on the Serial Communcation via USB Step by Step post that I found on this forum.

http://bit.ly/1cwJq1W

 

I've cut out the code that doesn't contribute to the problem. I'm not sure what I'm doing wrong...

 

Does anyone have any ideas?

Attached Files



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 20 February 2014 - 10:09 AM   Best Answer

Hi Graham, COM5 is the serial port # on your PC. Pins D0/D1 are serial port "COM1" on your Netduino. If you change COM5 to COM1 on the Netduino, it should work. [There are only 4 COM ports...so COM5 will correctly give you an error.] Does that help sort things out for you? Chris

#3 Graham Best

Graham Best

    New Member

  • Members
  • Pip
  • 2 posts

Posted 21 February 2014 - 11:10 PM

Yes, thank you for your help. I realized my mistake shortly after posting the question.







Also tagged with one or more of these keywords: System.ArgumentException, serial, com, SerialPort, 4.3

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.