Venus GPS: problems with sending commands to configure

28 Jan 2012

Hi,

I'm trying to configure my Venus GPS chip but I'm running into problems as I don't even get a rejected message in return after I send a query. I looked into the topic of creating character arrays with hex values and I'm pretty sure that my implementation should work but there must be a mistake somewhere.

Full document: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/GPS/AN0003_v1.4.19.pdf

Message format:

/media/uploads/s1000rr/messageformat.jpg

Ack and Nack format codes:

/media/uploads/s1000rr/acknack.jpg

Sample message (s/w version query):

/media/uploads/s1000rr/examplequery.jpg

My code:

#include "mbed.h"

Serial pc(USBTX, USBRX); // tx, rx
Serial device(p9, p10);  // tx, rx

int main() {

    char myhexarray1[]={0xA0, 0xA1, 0x00, 0x02, 0x02, 0x00, 0x02, 0x0D, 0x0A};
 
    pc.printf("\n\n\nStarting\n\n\n\r");
 
    device.printf(myhexarray1);
    while(1) {
            
        if(pc.readable()) {
            device.putc(pc.getc());
        }
        if(device.readable()) {
            pc.putc(device.getc());
        }
    }
}

Com output:

/media/uploads/s1000rr/teraoutput.jpg

When I double checked my message format, I ran across a forum that listed various ways of creating character arrays with hex values:

char myhexarray1[]={"\x1\x2\x3\x4"};    
char myhexarray2[]={0x1,0x2,0x3,0x4} ;           
char myhexarray3[]={'\x1','\x2','\x3','\x4'};

Any ideas? Am I constructing the message wrong, should i have a '\n' at the end? Am I sending it wrong to the chip?

Cheers, Sebastian

28 Jan 2012

I think you have to change from NMEA mode to binary before you can send it binary commands, but ive only used a sirfstarIII chipset,

   //command to switch to binary mode 57600 baud
   char command[] = "PSRF100,0,57600,8,1,0\0";
   uint8_t c_checksum = checksumNMEA(command);
   Protocol::printf("$%s*%02X\r\n", command, c_checksum);

The binary packet looks right, apart from the start n stop bytes its identical to the sirfstar3 binary packet,

13 Feb 2012

It does work but requires a delay between each byte. here is what worked for me. Yes, you have to send each byte individually.

Sorry I have never figured out how to post code snippets with correct format.

//////GPS SETUP for Baud Rate and 10Hz Data Rate/// hexidecimal Set GPS baud Rate gps.putc(0xA0); wait(0.05); gps.putc(0xA1); wait(0.05); gps.putc(0x00); wait(0.05); gps.putc(0x04); wait(0.05); gps.putc(0x05); wait(0.05); gps.putc(0x00);COM1 wait(0.05); gps.putc(0x05);SEt Baud wait(0.05); gps.putc(0x00);upgrade SRAM wait(0.05); gps.putc(0x05); wait(0.05); gps.putc(0x0d); wait(0.05); gps.putc(0x0a); wait(0.05);

21 Feb 2012

Hey James,

Use <<code>> paste code <</code>>

Genius thanks for the solution, I ran into a problem at work where I also had to delay each character sent via serial but never tried it on this GPS device. Will try it out sometime soon.

Thanks Sebastian

29 Apr 2013

I just wanted to close the loop on this one.

I had been having trouble configuring the Venus 6 GPS chip. Sometimes the commands would work but mostly they did not.

I coded the command set in decimal, not hex and it works perfectly every time.

int main() {
    //pc.printf("Ready");
    pc.baud(115200);
    gps.baud(9600);
    pc.printf("Ready\r\n");
     wait(1);

//hexidecimal Set GPS baud Rate
     gps.putc(160);
     wait(0.05);
     gps.putc(161);
   wait(0.05);
     gps.putc(00);
    wait(0.05); 
     gps.putc(04);
    wait(0.05);
     gps.putc(05);
     wait(0.05);
     gps.putc(00);//COM1
    wait(0.05);
     gps.putc(05);//SEt Baud 5;115200
    wait(0.05);
     gps.putc(01);//upgrade SRAM AND FLASH
    wait(0.05);
      gps.putc(01);
     wait(0.05);
     gps.putc(13);
     wait(0.05);
     gps.putc(10);
     wait(0.05);
    pc.printf("baud rate complete \r\n");
//
   gps.baud(115200);

 //hexidecimal Set GPS Rate
    wait(2);
     gps.putc(160);
     wait(0.05);
     gps.putc(161);
   wait(0.05);
     gps.putc(00);
    wait(0.05);
     gps.putc(03);
    wait(0.05);
     gps.putc(14);
     wait(0.05);
     gps.putc(10);//set data rate in Hz (1,2,4,5,8,10)
    wait(0.05);
     gps.putc(01);//update SRAM and flash
    wait(0.05);
     gps.putc(05);
    wait(0.05);
     gps.putc(13);
     wait(0.05);
     gps.putc(10);
     wait(0.05);
    pc.printf("GPS rate complete\r\n");
    wait(2);
   //hexidecimal Set GPS Rate