I have been banging away at my first .net MF app (extender module, serial GPS and a 4x20 LCD). Everything works great. About to test out the newly-minted uSD bits. However, I cant deploy the app to the device properly. It seems to download and run while the USB cable is connected. But when I reset it, or run it on batteries, it doesn’t start up (LCD blank).
But the more likely cause is your serial handling. Please confirm that you subscribe to the datarecieved event before you open the serial port. That is a known bad order, that becomes evident when debugging over USB is not connected. Reverse the order, and see if that helps.
@ Brett - I switched it (subscribe AFTER open) and it behaves the same. I’m going to trim down the app to a smaller footprint (it decodes GPS, calculates distances, etc.).
Dim gps As GT.Interfaces.Serial
Public Sub ProgramStarted()
Try
Dim objSocket As Gadgeteer.Socket
objSocket = Gadgeteer.Socket.GetSocket(1, True, extender, "")
gps = New Gadgeteer.Interfaces.Serial(objSocket, 19200, SerialParity.None, SerialStopBits.One, 8, HardwareFlowControl.NotRequired, extender)
gps.LineReceivedEventDelimiter = Microsoft.VisualBasic.Constants.vbCrLf
gps.AutoReadLineEnabled = True
gps.Open()
AddHandler gps.LineReceived, AddressOf GPS_handler 'moved here based on forum feedback
PulseDebugLED()
Catch ex As Exception
'Debug.Print(ex.Message)
PulseDebugLED()
End Try
End Sub
Private Sub GPS_handler(ByVal sender As Gadgeteer.Interfaces.Serial, ByVal line As String)
PulseDebugLED()
If line.Substring(0, 1) <> "$" Then Exit Sub
Try
led7r.TurnLightOn(1, True)
display_HD44780.Clear()
display_HD44780.SetCursor(0, 0)
display_HD44780.PrintString(line.Substring(0, 20))
Catch ex As Exception
display_HD44780.PrintString("ERROR")
End Try
End Sub
Quick fix would be to ensure the order inside Gadgeteer’s Serial implementation, that wraps SerialPort. The proper fix (which was supposed to be in 4.2) is to make it work no matter what the order is inside NETMF SerialPort implementation.
@ Gus - i continued to remove code to see when/if it would deploy. The issue is in the Serial handler (when there is no serial port, the deployment works fine). Looking at MFDeploy, I am getting a buffer overflow message from the CLR when my app has the serial stuff and it is “deployed”. Would it be a reasonable guess that something is not getting cleared when the LineReceive event fires? That’s my noob unSWAG !
I know we’re in beta, and glitches are expected…but this product rocks, as do the clearly dedicated GHI team and the TinyCLR community!! Thanks.