B4R Question Astream setup

derez

Expert
Licensed User
Longtime User
I have two Rikaline GPS receivers, one with USB plug and the other with RS232.
I connected the USB one to Raspberry Pi and immediately got the NMEA data correctly using AsyncStreamText.
The RS232 is connected to Arduino Uno by SoftwareSerial and Astream and it shows data that looks like this:
AppStart
149 �����f���39�f��Y�)�
155 �����9��榦&f�.N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2��n⾶��N>>>::"F.N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN6">:>6NNV>���n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9��榦���.N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2"��n⾶��N>>>::F.N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN6">:>6NNV>>��n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9��榦���.N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2&��n⾶��N>>>::F.N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN6">:>6NNV>:��n⾦��NN�NN�N>F>>N�N>F>N�V"���
B4X:
Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    ASerial.Initialize(4800, 11,10)
    Astream.Initialize(ASerial.Stream, "Astream_NewData", Null)
End Sub

Sub Astream_NewData(Buffer() As Byte)
    Private st As String = bc.StringFromBytes(Buffer)
    Log( Buffer(0),"     " ,st)
End Sub
The first number is buffer(0) and the rest of each line is bc.StringFromBytes(buffer).
In the Data of NMEA each line starts and ends with "$" (byte 36 or 0x0024), but this is not like this here.
The Datasheet says :"Dual channel RS-232 or TTL compatible level, with user selectable baud rate (4800-Default, 9600, 19200, 38400).", in the USB it works with 4800 so I tried it here also, but changing to the other rates doesn't correct it.

Any idea what to do in order to see it correctly ? Maybe it is not "UTF8" ? or the bit order LSB/MSB?
 
Last edited:

derez

Expert
Licensed User
Longtime User
I see a block of data that repeat itself (by first byte, two blocks in the quote), which tells me it is not random:
>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2���n⾶��N>6:.>F""N�N>>>>F>>>>N
70 F>N*>F>V>*��n�ⲦN2N:N:6N>2N>N>>>N2*N2:N"6N>>>NN>6N&:N>>>NN:*N&>N>>>NV".��n�ⲦN2N6N:6N66N*&N>>>N
78 N:"N*>N>>>NN6"N26N>>>NN:N:N>>>NV"���n�ⲦN2N2N:6N>N:"N>>>NN>:N:"N>>>NN6:N:*N>>>NN:2N:*N>>>NV"6��
110 n⾶��N>6:.:F""N�N>>>>F>>>>N�N>>>>>F>>>>N�N>F>>NN2>>:>6NNV>���n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9�̦�ff�""N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2���n⾶��N>6:.6F""N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN2>>:>6NNV>���n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9�̦�&f�""N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2���n⾶��N>6:.2F""N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN2>>:>6NNV>���n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9�̦��f�""N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2��n⾶��N>6:..F""N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN2>>:>6NNV>��n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9�̦�f�""N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2��n⾶��N>6:.*F""N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN2>>:>6NNV>��n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9�̦�ff�""N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2���n���N�N:NNNNNNNNNNNNN*>F>N*>
70 F>N*>F>V>*��n�ⲦN2N:N:6N>2N>N>>>N2*N2:N"6N>>>NN>6N&:N>>>NN:*N&>N>>>NV".��n�ⲦN2N6N:6N66N*&N>>>N
78 N:"N*>N>>>NN6"N26N>>>NN:N:N>>>NV"���n�ⲦN2N2N:6N>N:"N>>>NN>:N:"N>>>NN6:N:*N>>>NN:2N:*N>>>NV"6��
110 n⾶��N>6:.&F""N�N>>>>F>>>>N�N>>>>>F>>>>N�N>F>>NN2>>:>6NNV>���n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9�̦�&f�""N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2���n⾶��N>6:."F""N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN2>>:>6NNV>���n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9�̦����""N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2*��n⾶��N>6:.F""N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN::>::"NNV>2��n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9�̦���""N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2.��n⾶��N>6:.F""N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN::>::"NNV>6��n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9�̦��f�""N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2���n⾶��N>6:*>F""N�N>>>>F>>>>N
198 �N>>>>>F>>>>N�N>F>>NN::>::"NNV>���n⾦��NN�NN�N>F>>N�N>F>N�V"���
155 �����9�̦��f�""N>>>>F>>>>N�N>>>>>F>>>>N�N>N>>N*>F>N>F>N�NNNN>>>>V2���n���N�N:NNNNNNNNNNNNN*>F>N*>

When the GPS got a fix it changes to this data block:
62 >:N.N:‑.N2*N::N.&N6"*NN>N2>N6&.NN2:N:‑N>.:NV"���n�ⲦN2N2N:6N6&N:2N>>NN>"N:>N6>2NN:"N:>N6"‑NN:&N

62 >‑N::NV"���n⾶��N>26.‑F‑22N�N26>‑F.6&&N�N>2..F.‑2N�N>F>>N>>>F>>N::>::"NNV>���n⾦��N>>>F>>N�NN�

78 N>F>>N�N>F>N�V&>��

155 �����9�Lf���22N26>‑F.6*.N�N>2..F.&‑N�N:N>.N6F‑N:FN�NNNN>>>>V>2��n⾶��N>26.F‑22N�N26>‑F.6*.N�

78 N>2..F.&‑N�N>F>>N>>>F>>N::>::"NNV>���n⾦��N>>>F>>N�NN�N>F>>N�N>F>N�V&>��

155 �����9�Lf��f�22N26>‑F.6.N�N>2..F."N�N:N>.N6F‑N:F*N�NNNN>>>>V>���n⾶��N>26*>F‑22N�N26>‑F.6.N�

78 N>2..F."N�N>F>>N>>>F>>N::>::"NNV>���n⾦��N>>>F>>N�NN�N>F>>N�N>F>N�V&>��

155 �����9�Lf��f�22N26>‑F.6&*N�N>2..F."N�N:N>.N6F‑N:F2N�NNNN>>>>V>6��n⾶��N>26*:F‑22N�N26>‑F.6&*N�

78 N>2..F."N�N>F>>N>>>F>>N::>::"NNV>*��n⾦��N>>>F>>N�NN�N>F>>N�N>F>N�V&>��

155 �����9�Lf�ff�22N26>‑F.6*&N�N>2..F.&*N�N:N>.N6F‑N2F:N�NNNN>>>>V>���n⾶��N>26*6F‑22N�N26>‑F.6*&N�

78 N>2..F.&*N�N>F>>N>>>F>>N::>::"NNV>���n⾦��N>>>F>>N�NN�N>F>>N�N>F>N�V&>��

155 �����9�Lf�&f�22N26>‑F.6..N�N>2..F.‑&N�N:N>.N6F‑N6F2N�NNNN>>>>V>>��n���N�N2N>:N62N>2N66NNNNNNNNN

58 :>F.N6F‑N:>F>V2���n�ⲦN2N:N:6N>2N&‑N>22N2>N66N&.N>"&N2*N62N&.N2>&N2&N:2N&2N2::NV".��n�ⲦN2N6N:6N
For comparison - this is what I get from the USB GPS through RPi:
$GPGGA,000136.993,0000.0000,N,00000.0000,E,0,00,50.0,0.0,M,0.0,M,0.0,0000*71
$GPGSA,A,1,,,,,,,,,,,,,50.0,50.0,50.0*05
$GPGSV,1,1,01,24,00,000,00*4E
$GPRMC,000136.993,V,0000.0000,N,00000.0000,E,0.00,,101102,,*0E
$GPVTG,,T,,M,,N,,K*4E
$GPGGA,000137.993,0000.0000,N,00000.0000,E,0,00,50.0,0.0,M,0.0,M,0.0,0000*70
$GPRMC,000137.993,V,0000.0000,N,00000.0000,E,0.00,,101102,,*0F
$GPVTG,,T,,M,,N,,K*4E
$GPGGA,000138.993,0000.0000,N,00000.0000,E,0,00,50.0,0.0,M,0.0,M,0.0,0000*7F
$GPRMC,000138.993,V,0000.0000,N,00000.0000,E,0.00,,101102,,*00
$GPVTG,,T,,M,,N,,K*4E
$GPGGA,000139.993,0000.0000,N,00000.0000,E,0,00,50.0,0.0,M,0.0,M,0.0,0000*7E
$GPRMC,000139.993,V,0000.0000,N,00000.0000,E,0.00,,101102,,*01
$GPVTG,,T,,M,,N,,K*4E
$GPGGA,000140.993,0000.0000,N,00000.0000,E,0,00,50.0,0.0,M,0.0,M,0.0,0000*70
$GPRMC,000140.993,V,0000.0000,N,00000.0000,E,0.00,,101102,,*0F
$GPVTG,,T,,M,,N,,K*4E

EDIT: using B4R_serial_connector I checked several other character sets but no solution there.
 
Last edited:
Upvote 0

derez

Expert
Licensed User
Longtime User
"הדואג לעצמו לעצמו הוא דואג..."
Found it !
I connected the serial pins og the lines that went to the PDA, which were RS232 lines.
Now I changed the connection to the GPS plug which had both RS232 and TTL pins, and used the TTL.
The difference is with voltage levels but most important - inverted logic of 1 and 0.
Now I have the NMEA strings:
36 $GPGGA,123641.885,3208.4217,N,03449.4974,E,1,04,4.6,57.1,M,,,,0000*31
$GPGSA,A,3,07,09,23,16,,,,,,,
44 ,,6.7,4.6,4.8*35
$GPGSV,3,1,10,07,74,323,33,09,62,035,36,30,48,250,,23,34,084,38*7B
$GPGSV,3,2,10,
48 06,20,246,,02,14,285,,28,13,186,,16,12,038,35*7B
$GPGSV,3,3,10,03,11,149,,05,08,319,*71
$GPRMC,123
54 641.885,A,3208.4217,N,03449.4974,E,0.49,217.69,110117,,*09
$GPVTG,217.69,T,,M,0.49,N,0.9,K*6F
36 $GPGGA,123642.885,3208.4214,N,03449.4969,E,1,04,4.6,56.2,M,,,,0000*3F
$GPRMC,123642.885,A,3208.4214
44 ,N,03449.4969,E,0.58,230.05,110117,,*0A
$GPVTG,230.05,T,,M,0.58,N,1.1,K*69
36 $GPGGA,123643.885,3208.4211,N,03449.4965,E,1,04,4.6,55.4,M,,,,0000*32
$GPRMC,123643.885,A,3208.4211
44 ,N,03449.4965,E,0.53,228.19,110117,,*0D
$GPVTG,228.19,T,,M,0.53,N,1.0,K*67
36 $GPGGA,123644.885,3208.4208,N,03449.4962,E,1,04,4.6,54.6,M,,,,0000*39
$GPRMC,123644.885,A,3208.4208
44 ,N,03449.4962,E,0.48,228.28,110117,,*0D
$GPVTG,228.28,T,,M,0.48,N,0.9,K*67
36 $GPGGA,123645.885,3208.4206,N,03449.4958,E,1,04,4.6,53.8,M,,,,0000*36
$GPRMC,123645.885,A,3208.420644 ,N,03449.4958,E,0.48,226.34,110117,,*08
 
Upvote 0
Top