Serial Port Problem
#1
Posted 01 January 2011 - 11:21 PM
#2
Posted 02 January 2011 - 12:48 AM
#3
Posted 02 January 2011 - 02:13 AM
#4
Posted 03 January 2011 - 07:05 AM
#5
Posted 04 January 2011 - 02:49 AM
#6
Posted 04 January 2011 - 03:10 AM
I flashed 4.1.1.0 a5 and am happy to report that, for me at least, everything now works regardless of the relative positions of adding the handler for the DataReceived event and opening the port, and it works both when connected through the USB port or when powered from an external source.
Awesome. Thank you for testing the bugfix!
Chris
#7
Posted 04 January 2011 - 11:58 PM
#8
Posted 02 June 2011 - 03:13 PM
Anyway, this has been fixed in the v4.1.1 alpha 5 firmware.
I know this is probably a stupid question, but is this fix included in the 4.1.1 beta firmware as well. (I just don't want to be wrong in assuming that everything from alpha made it into the beta)
Joe,
I also wanted to make sure the problem that was occuring is the same one I am experiencing: As long as I didn't put the code loaded on the netduino into debug mode through VS (whether that's because I reset it with the reset button, unplugged and re-plugged in the USB cord, or booted with only the power port). The only way that COM2 worked was through starting the code by deploying in VS and having it boot it up.
#9
Posted 02 June 2011 - 05:02 PM
#10
Posted 02 June 2011 - 06:20 PM
#11
Posted 08 September 2013 - 09:38 PM
I'm attempting to use both serial ports at the same time and have run into a problem. I've narrowed the problem to a single line of code but don't know what to do about it. In a test program I'm using COM1 to listen for a string from a PC and turn the LED on or off. This works fine while I'm still connected to the Netduino through the USB but when I disconnect the USB and power up through power connector it fails. I've attached a small test program that illustrates the problem (along with a little VB app to test it). I'm using an original Netduino (not the plus or mini) and I'm using firmware version 4.1.0.5.
Oh God Thanks,
Love this thread.... so much helpful... thanks... it's really show me how to communicate to my GSMshield Icomsat v1.1... i need to convert your code to Vb Language (it's the only Programming Language I understand). I planed to use netduino as weather station and send its data trought GSMsheild. Formerly I'm using arduino uno board, but since netduino has more option to develop, so I decide to learn netduino.
thanks to all of you guys. here is your code on vb lnguage
Imports SystemImports System.TextImports System.ThreadingImports System.IO.PortsImports Microsoft.VisualBasic.ConstantsImports Microsoft.SPOTImports Microsoft.SPOT.HardwareImports SecretLabs.NETMF.HardwareImports SecretLabs.NETMF.Hardware.NetduinoPlusNamespace Uart Public Class Com_UART Private Shared GSM_UART As SerialPort Private Shared OnboardLed As OutputPort Private Shared DataIn As String Public Shared Sub Main() ' write your code here OnboardLed = New OutputPort(Pins.ONBOARD_LED, False) GSM_UART = New SerialPort("COM1", 9600, Parity.None, 8, StopBits.One) AddHandler GSM_UART.DataReceived, New SerialDataReceivedEventHandler(AddressOf RecieveData) If GSM_UART.IsOpen = False Then GSM_UART.Open() Debug.Print("Port Opening" & " : at baudRate= " & GSM_UART.BaudRate) Else Debug.Print("Port is ready...") End If Thread.Sleep(1000) Dim bytesTosend As Byte() = Encoding.UTF8.GetBytes("AT+CMGF=1" & vbCr) Debug.Print("Send port : AT+CMGF=1") GSM_UART.Write(bytesTosend, 0, bytesTosend.Length) Debug.Print("Port is writing...") Thread.Sleep(Timeout.Infinite) End Sub Private Shared Sub RecieveData(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs) Dim Length As Integer = GSM_UART.BytesToRead Dim bufferData As Byte() = New Byte(Length - 1) {} GSM_UART.Read(bufferData, 0, Length) DataIn += New String(Encoding.UTF8.GetChars(bufferData)) If DataIn.IndexOf(vbLf) >= 0 Then Debug.Print("Command: " & DataIn) DataIn = DataIn.Trim() ' Get rid of the line feed If DataIn <> "" Then OnboardLed.Write(state:=True) Debug.Print(DataIn) End If If DataIn = "" Then OnboardLed.Write(state:=False) Debug.Print("Command should be Cleared :" & DataIn) End If ' Clear the string for the next transmission End If End Sub End ClassEnd Namespace
I wish to share my final code later....
best regards
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users