Hi all i am playing with the USB to serial lib, has anyone else found errors cropping up, for instance some of the data getting mixed up and put in the wrong place within the input stream.
I have been sending:
every second at 4800 baud continuously for a few minutes
i put a try/catch statement in my code to see what was being sent, most of the time it seems fine but i received the following catch errors:
Is this a problem with the library , i have output from one serial port to another on the PC and there are no errors over the same period.
I use NMEAinBuff to store what has arrived just in case a full sentence has not been received, below is the Astreams_Newdata sub:
i am using version 2.3 of the USBSerial Library.
Any thoughts are appreciated.
Regards
Stu
I have been sending:
$PAMIV,01,100,100,100,100*6E
$PAMIV,02,50,0,10,0*69
every second at 4800 baud continuously for a few minutes
i put a try/catch statement in my code to see what was being sent, most of the time it seems fine but i received the following catch errors:
------------------------------------------------------------------------
Error Occurred: 05/12/2013 @ 13:53:03
NMEA: $1,100,100,100,100*6E
Buffer: PAMIV,0$1,100,100,100,100*6E
------------------------------------------------------------------------
Error Occurred: 05/12/2013 @ 13:54:20
NMEA: $PAMIV,01,100,100*6E
Buffer: $PAMIV,01,100,100*6E
$
------------------------------------------------------------------------
Error Occurred: 05/12/2013 @ 13:54:20
NMEA: $0,100,10PAMIV,02,50,0,10,0*69
Buffer: $0,100,10PAMIV,02,50,0,10,0*69
------------------------------------------------------------------------
Error Occurred: 05/12/2013 @ 13:56:16
NMEA: $PAMIV,01,100,100,100,100*MIV,02,56E
Buffer: $PAMIV,01,100,100,100,100*MIV,02,56E
$PA
------------------------------------------------------------------------
Error Occurred: 05/12/2013 @ 13:56:17
NMEA: $PAMIV,01,100,100,100,100MIV,02,*6E
Buffer: $PAMIV,01,100,100,100,100MIV,02,*6E
$PA
------------------------------------------------------------------------
Error Occurred: 05/12/2013 @ 13:56:20
NMEA: $PAMIV,01,100,100,100,100*MIV,02,6E
Buffer: $PAMIV,01,100,100,100,100*MIV,02,6E
$PA
Is this a problem with the library , i have output from one serial port to another on the PC and there are no errors over the same period.
I use NMEAinBuff to store what has arrived just in case a full sentence has not been received, below is the Astreams_Newdata sub:
B4X:
Sub Astreams_NewData (Buffer() As Byte)
Dim lp As Boolean = True
Dim s1, s2 As Int
NMEAinBuff.Append(BytesToString(Buffer, 0, Buffer.Length, "UTF8"))
s2 = NMEAinBuff.ToString.IndexOf(CRLF)
s1 = NMEAinBuff.ToString.IndexOf("$")
If s1<>-1 AND s2<>-1 AND s2>s1 Then
Do While lp
Dim tempString,TS As String, retInt As Int
tempString = NMEAinBuff.ToString
retInt = tempString.IndexOf(CRLF)
If retInt<>-1 AND retInt>8 Then
checkNMEA(tempString.SubString2(0,retInt-1))
USBIN.Text = TS
NMEAinBuff.remove(0,retInt+1)
lp = True
Else
lp=False
End If
Loop
Else 'if there is a $ and a CRLF but the start is after the CRLF then remove leading chars
If s1<>-1 AND s2<>-1 AND s1>s2 Then
NMEAinBuff.remove(0,s1)
End If
End If
End Sub
i am using version 2.3 of the USBSerial Library.
Any thoughts are appreciated.
Regards
Stu