[SOLVED] uart problems with UBLOX GPS - UBX binary

Post Reply
kalven_99
Posts: 3
Joined: Fri Jul 29, 2022 3:26 am
languages_spoken: english
ODROIDs: c4
Has thanked: 0
Been thanked: 2 times
Contact:

[SOLVED] uart problems with UBLOX GPS - UBX binary

Post by kalven_99 »

All, i've been trying to port some code to C4 from rpi 3/4. I'm reading from UART on ttyS2 on the C4. rx/tx wires are crossed several times. Data either seems to be getting chopped or incomplete.

Not sure if i have the UART on C4 set up correctly. Here are the config.ini settings as well as setting up ttyS2 in rc.local to 19200 baud rate.

i'm using neo-6m GPS device, in UBX binary mode. The first 2 bytes seem to come in fine, to where i can define the UBX workpacket type, but, when i get to the checksum of the UBX binary data, it is not valid.

I'm using wiringPi distribution per HardKernel downloads.

Again, this works on rPI 3 & 4 devices.

I'm hoping it is just that i forgot to do some 'something' and that others may have already figured this out.

I know i've left a lot of all the other settings out, just, wondering if anyone else has figured out how to read the UBX data streams out of UBLOX neo-6m GPS devices.

FILE: c code

Code: Select all

serialPortHandle = serialOpen("/dev/ttyS2",19200);
read bytes until first 2 bytes until UBX_HEADER is matched then next 2 bytes until match workpacket type:

const unsigned char UBX_HEADER[]        = { 0xB5, 0x62 };
const unsigned char POSLLH_HEADER[] = { 0x01, 0x02 };
const unsigned char VELNED_HEADER[] = { 0x01, 0x12 };
const unsigned char STATUS_HEADER[] = { 0x01, 0x06 };
once header & workpacket type is found, continue reading for sizeof ( workpacket ), then check checksum ( this is where it fails )


FILE: config.ini

Code: Select all

; Device Tree Overlay
overlay_resize=16384
overlay_profile=uart1
overlays="spi0 i2c0 i2c1 uart0 uart1"

[overlay_custom]
overlays="i2c0 i2c1"

[overlay_hktft32]
overlays="hktft32"

[overlay_hktft35]
overlays="hktft35"

[overlay_all]
overlays="spi0 i2c0 i2c1 uart0 uart1"

[overlay_uart1]
overlays="uart1"

FILE: rc.local

Code: Select all

#!/bin/bash
if [ -f /aafirstboot ]; then /aafirstboot start ; fi
sudo stty -F /dev/ttyS2 19200
exit 0
Last edited by kalven_99 on Sat Jul 30, 2022 3:05 am, edited 1 time in total.

steve.jeong
Posts: 59
Joined: Wed Dec 01, 2021 10:18 am
languages_spoken: english
Has thanked: 6 times
Been thanked: 12 times
Contact:

Re: uart with UBLOX GPS - UBX binary

Post by steve.jeong »

Please share the results of commands.

1.
uname -a

2.
dpkg -l | grep wiringpi

And please let me know the UBLOX GPS model that you used.

kalven_99
Posts: 3
Joined: Fri Jul 29, 2022 3:26 am
languages_spoken: english
ODROIDs: c4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: uart problems with UBLOX GPS - UBX binary

Post by kalven_99 »

uname -a:
Linux odroid 4.9.312-85 #1 SMP PREEMPT Mon Jun 20 03:34:14 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
dpkg -l | grep wiringpi
ii libwiringpi-dev 3.9-0~202103120857~ubuntu20.04.1 arm64 GPIO development library for ODROID
ii libwiringpi2 3.9-0~202103120857~ubuntu20.04.1 arm64 GPIO libraries for ODROID (runtime).
ii odroid-wiringpi 3.9-0~202103120857~ubuntu20.04.1 arm64 gpio utility for ODROID

ublox NEO-6m-0-001

kalven_99
Posts: 3
Joined: Fri Jul 29, 2022 3:26 am
languages_spoken: english
ODROIDs: c4
Has thanked: 0
Been thanked: 2 times
Contact:

Re: uart problems with UBLOX GPS - UBX binary

Post by kalven_99 »

uuhhhhh dope beavis, this is 64 bit. rpi was coded for 32 bit.

just had to adjust the workpacket definition to match 64 bit, and, boom. works.

Thank you steve.jeong for responding.
These users thanked the author kalven_99 for the post (total 2):
odroid (Sun Jul 31, 2022 9:36 pm) • steve.jeong (Mon Aug 01, 2022 1:05 pm)

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 1 guest