Hi i'm tryng to change the update rate of my gps tracker(neo 6m ublok) i know the byte that i need to send are 0xB5,0x62,0x06,0x08,0x06,0x00,0xC8,0x00,0x01,0x00,0x01,0x00,0xDE,0x6A
i've tried
echo -e "\xB5\x62\x06\x08\x06\x00\xC8\x00\x01\x00\x01\x00\xDE\x6A" > /dev/ttyAMA0
and with the service stopped i also tryed with a program in c
#include <stdio.h>
#include <fcntl.h> /* File Control Definitions */
#include <termios.h> /* POSIX Terminal Control Definitions */
#include <unistd.h> /* UNIX Standard Definitions */
#include <errno.h> /* ERROR Number Definitions */
void main(void)
{
int fd;/*File Descriptor*/
printf("\n +----------------------------------+");
printf("\n | Serial Port Write |");
printf("\n +----------------------------------+");
/*------------------------------- Opening the Serial Port -------------------------------*/
/* Change /dev/ttyUSB0 to the one corresponding to your system */
fd = open("/dev/ttyAMA0",O_RDWR | O_NOCTTY | O_NDELAY); /* ttyUSB0 is the FT232 based USB2SERIAL Converter */
/* O_RDWR Read/Write access to serial port */
/* O_NOCTTY - No terminal will control the process */
/* O_NDELAY -Non Blocking Mode,Does not care about- */
/* -the status of DCD line,Open() returns immediatly */
if(fd == -1) /* Error Checking */
printf("\n Error! in Opening ttyUSB0 ");
else
printf("\n ttyUSB0 Opened Successfully ");
/*---------- Setting the Attributes of the serial port using termios structure --------- */
struct termios SerialPortSettings; /* Create the structure */
tcgetattr(fd, &SerialPortSettings); /* Get the current attributes of the Serial port */
cfsetispeed(&SerialPortSettings,B9600); /* Set Read Speed as 9600 */
cfsetospeed(&SerialPortSettings,B9600); /* Set Write Speed as 9600 */
SerialPortSettings.c_cflag &= ~PARENB; /* Disables the Parity Enable bit(PARENB),So No Parity */
SerialPortSettings.c_cflag &= ~CSTOPB; /* CSTOPB = 2 Stop bits,here it is cleared so 1 Stop bit */
SerialPortSettings.c_cflag &= ~CSIZE; /* Clears the mask for setting the data size */
SerialPortSettings.c_cflag |= CS8; /* Set the data bits = 8 */
SerialPortSettings.c_cflag &= ~CRTSCTS; /* No Hardware flow Control */
SerialPortSettings.c_cflag |= CREAD | CLOCAL; /* Enable receiver,Ignore Modem Control lines */
SerialPortSettings.c_iflag &= ~(IXON | IXOFF | IXANY); /* Disable XON/XOFF flow control both i/p and o/p */
SerialPortSettings.c_iflag &= ~(ICANON | ECHO | ECHOE | ISIG); /* Non Cannonical mode */
SerialPortSettings.c_oflag &= ~OPOST;/*No Output Processing*/
if((tcsetattr(fd,TCSANOW,&SerialPortSettings)) != 0) /* Set the attributes to the termios structure*/
printf("\n ERROR ! in Setting attributes");
else
printf("\n BaudRate = 9600 \n StopBits = 1 \n Parity = none");
/*------------------------------- Write data to serial port -----------------------------*/
char write_buffer[] = "A"; /* Buffer containing characters to write into port */
unsigned char packet[] = { 0xB5, 0x62,
0x06, //
0x08, //
0x06, // length
0x00, //
0x64, // measRate, hex 64 = dec 100 ms
0x00, //
0x01, // navRate, always =1
0x00, //
0x01, // timeRef, stick to GPS time (=1)
0x00, //
0x7A, // CK_A
0x12, // CK_B
};
int bytes_written = 0; /* Value for storing the number of bytes written to the port */
//for(int i=0;i<14;i=i+1){
// printf(packet[i]);
//}
bytes_written = write(fd,packet,sizeof(packet));/* use write() to send data to port /
/ "fd" - file descriptor pointing to the opened serial port /
/ "write_buffer" - address of the buffer containing data /
/ "sizeof(write_buffer)" - No of bytes to write */
char buf [100];
int n = read (fd, buf, sizeof buf);
printf(buf);
printf("\n %s written to ttyUSB0",write_buffer);
printf("\n %d Bytes written to ttyUSB0", bytes_written);
printf("\n +----------------------------------+\n\n");
close(fd);/* Close the Serial port */
}
and with python
import serial
#from serial import Serial
import time
import string
import pynmea2
port="/dev/ttyAMA0"
ser=serial.Serial(port, baudrate=9600 , parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,)
#serdata= bytearray([0xB5,0x62,0x06,0x08,0x06,0x00,0xC8,0x00,0x01,0x00,0x01,0x00,0xDE,0x6A,0xB5,0x62,0x06,0x01,0x08,0x00,0xF0,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x2B]) #0x06"0x00"0xC8"0x00"0x01"0x00"0x01"0x00"0xDE"0x6A"
#serdata= bytearray([0xB5,0x62,0x06,0x08,0x06,0x00,0xC8,0x00,0x01,0x00,0x01,0x00,0xDE,0x6A])
#print(serdata)
ser.write(b"$PUBX,40,GLL,0,0,0,05D\r\n")
#ser.write(bytes([181,98,6,8,6,0,100,0,1,0,1,0,122,18])) # 5hz
#ser.write(b'$PUBX,40,GLL,1,0,0,0,0,05D')
#ser.write(serdata)
#ser.flush()
#ser.write(bytearray([181, 98, 6, 1, 8, 0, 240, 1, 0, 0, 0, 0, 0, 1, 1, 43])) #GxGLL off
#serdatadi=bytearray([0xB5,0x62,0x06,0x01,0x08,0x00,0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x39])
#serdatadi2=bytearray([0xB5,0x62,0x06,0x01,0x08,0x00,0xF0,0x04,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x40])
#print(serdatadi2)
#ser.write(b"0xB5,0x62,0x06,0x01,0x08,0x00,0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x39")
#ser.write(serdatadi2)
#ser.write(serdatadi3)
#ser.write(b"0xB5,0x62,0x06,0x01,0x08,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x24")
#ser.write(b'\xb5b\x06\x08\x06\x00\x1e\x00\x01\x00\x00\x003l')
while True:
#port="/dev/ttyAMA0"
#ser=serial.Serial(port, baudrate=9600, timeout=0.5)
dataout = pynmea2.NMEAStreamReader()
newdata=ser.readline()
print(newdata)
#print(newdata[0:6] == "$GPRMC")
if (newdata[0:6] == b"$GPRMC"):
print("vivo")
newmsg=pynmea2.parse(newdata.decode("utf-8"))
print(newmsg)
lat=newmsg.latitude
lng=newmsg.longitude
gps = "Latitude=" + str(lat) + "and Longitude=" + str(lng)
print(gps)
but nothig change the navigation update rate of the device
all of the byte code came from the manual of the device
https://www.u-blox.com/sites/default/files/products/documents/u-blox6_ReceiverDescrProtSpec_%28GPS.G6-SW-10018%29_Public.pdf
and this
and this
https://forum.arduino.cc/index.php?topic=470763.0
EDIT:
i've tryed both of the response but none of them worked
what i have to do if i want to connect with usb instread of uart
EDIT2: i have tryed both usb to the raspberry and the pc with the u center but none of this changed the rate of the gps!! edit 3: no luck i've tryed eaven an update of the firmware but nothing it's like it dose not like changing configuration
Setup pipes
Firmware update tool launched
-p STDIO -b 9600:9600:9600 -F "C:\Program Files (x86)\u-blox\u-center_v20.01\flash.xml" -s 1 -t 1 -v 1 "D:\dowload\EXT_G60_LEA-6H.fd1146bafac24b1347701312d42bb698.bin"
----------CMD line arguments-----------
Image file: D:\dowload\EXT_G60_LEA-6H.fd1146bafac24b1347701312d42bb698.bin
Flash: <compiled-in>
Fis: C:\Program Files (x86)\u-blox\u-center_v20.01\flash.xml
Port: STDIO
Baudrates: 9600/9600/9600
Safeboot: 1
Reset: 1
AutoBaud: 0
Verbose: 1
Erase all: 1
Erase only: 0
Training sequence: 1
Chip erase: 0
Merging FIS: 0
Update RAM: 0
Use USB alt: 0
0.0 u-blox Firmware Update Tool version 19.03
0.0 Updating Firmware 'D:\dowload\EXT_G60_LEA-6H.fd1146bafac24b1347701312d42bb698.bin' of receiver over 'STDIO'
0.0 - Opening and buffering image file
0.0 - Verifying image
0.0 Image (file size 395996) for u-blox6 accepted
0.0 Image Ver '7.03 (45970) Mar 17 2011 16:26:24'
0.0 - CRC= 0x10F85FE1 0xF912EA5A
0.0 - Trying to open port STDIO
0.0 - Setting baudrate to 9600
0.2 - Sending training sequence
1.2 - Retry poll
2.2 - Retry poll
3.2 - Retry poll
3.2 ERROR: Version poll failed.
3.2 Firmware Update FAILED
Firmware Update Utility has unexpectedly terminated
Exit code (2)
these are the connector and the multimeter sat between the first and the last 3.2-3.3
echo "test" > /dev/serial0
andcat -v < /dev/serial0
i can see test so the serial is working, i've tryed trougth the u-center with network serial for controlling the gps but still the gps won't change i've retryed with bash ans the hex directly given from the u-center but still the update rate won't change, is wrong how i wrote the code in python for writing the hex? – awaska Jun 18 '20 at 15:18/dev/ttyAMA0
withecho
is not a byte. – Ingo Jun 18 '20 at 17:40echo -e -n "\xB5\x62\x06\x01\x08\x00\xF0\x01\x01\x00\x00\x01\x01\x00\x03\x35" > /dev/serial0 echo -e -n "\xB5\x62" > /dev/serial0
i read nothing from the serialcat -v < /dev/serial0
but if i sendecho "test" > /dev/serial0
strange stuff append, the word test is repited multiple time with incrising space – awaska Jun 18 '20 at 19:48test
test
test
test
test
test```
– awaska Jun 18 '20 at 19:52