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

Connectivity


  • Please log in to reply
5 replies to this topic

#1 YvesGoeleven

YvesGoeleven

    Member

  • Members
  • PipPip
  • 17 posts

Posted 11 October 2013 - 05:45 PM

Hi,

 

Last week I bought a netduino go starter kit and got up and running with it pretty quickly. But now I would like my ngo to communicate with the outside world, but there seems to be no simple options to do so. (No ethernet, wifi, usb to pc or anything...)

 

What are my options?



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 October 2013 - 06:08 PM

YvesGoeleven, Today, your best option is to use a USB-to-TTL serial cable from your PC to the Shield Base. Then use the System.IO.Ports.SerialPort class on your PC and Netduino Go. We're working on a few more options, but the tech is pretty new and we need to get the second release of the bus protocol wrapped up (1.5) before shipping some of the new hardware. Chris

#3 YvesGoeleven

YvesGoeleven

    Member

  • Members
  • PipPip
  • 17 posts

Posted 11 October 2013 - 06:48 PM

Thanks!

 

As I'm very new to this a few additional questions (so that I don't do anything stupid)

 

I assume this cable is the correct one? 3.3V with SIL connector to put on the analog IN?

http://be.mouser.com...y3R5sMdbLgwj41z

 

Can I still hook up a breadboard to the same shieldbase in this case, or will I need another one for that purpose?



#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 October 2013 - 07:22 PM

YvesGoeleven, Yes, that cable should work great. Don't hook up the VCC...just hook up the RX (to TX), TX (to RX) and GND (to GND). And yes, you can certainly hook up a breadboard to the same shield base. You have 20 pins to use. Serial port only takes up two of them. Chris

#5 YvesGoeleven

YvesGoeleven

    Member

  • Members
  • PipPip
  • 17 posts

Posted 16 October 2013 - 04:38 PM

Chris,

 

I got my cable today (TTL-232R-3V3-WE), but I'm not succeeding in sending data over the wire. Can you help me verify if I'm doing everything correct?

 

According to the datasheet, http://www.ftdichip....232R_CABLES.pdf, GND is black, TX is Orange and RX is yellow. So I've hooked up Orange to D0 and Yellow to D1 of the ShieldBase

 

As for code:

 

In my netduino project I do the following:

 

 var shieldbase = new ShieldBase(GoSockets.Socket7);
 var serialPort = new SerialPort(SerialPorts.COM1, 9600, Parity.None, 8, StopBits.One);
 serialPort.DataReceived += DataReceivedHandler;
         
 var threadWorker = new Thread(DoWork);
 threadWorker.Start();
         
serialPort.Open();
Thread.Sleep(Timeout.Infinite);
 
And on the background thread I'm sending data all the time
 
var buffer = BitConverter.GetBytes(value);
serialPort.Write(buffer, 0, buffer.Length);
serialPort.Flush();
 
It's seems to operate (no exceptions at least when running)
 
 
On the computer I have a console app running, that listens to the USB COM port, which is on COM5 according to device manager
 
var port = new SerialPort("COM5", 9600, Parity.None, 8, StopBits.One);
port.DataReceived += PortOnDataReceived;
port.Open();
 
When data is received, the following happens
 
private static void PortOnDataReceived(object sender, SerialDataReceivedEventArgs serialDataReceivedEventArgs)
{
            var port = (SerialPort) sender;
            var buffer = new byte[4];
            port.Read(buffer, 0, buffer.Length);
 
            int i = BitConverter.ToInt32(buffer, 0);
            Console.WriteLine(i);
}
 
The console app also starts fine...
 
But nothing happens when netduino performs a write, any ideas on what I'm doing wrong?
 
PS: I tried switching orange and yellow as well, and tried sending from console to netduino... all with same result, no exceptions but no data exchange either.
 
Kind regards,
Yves
 
 
 


#6 YvesGoeleven

YvesGoeleven

    Member

  • Members
  • PipPip
  • 17 posts

Posted 16 October 2013 - 05:34 PM

Found it!

 

It should have been : serialPort = new SerialPort(shieldbase.SerialPorts.COM1, 9600, Parity.None, 8, StopBits.One);






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.