This example establishes a transparent link between the mbed serial port and the gps I2C on the C027. You can use it to use the standard u-blox tools such as u-center. These tools can then connect to the serial port and talk directly to the GPS receiver. Baudrate should be set to 9600 baud and is fixed. m-center can be downloaded from u-blox website following this link: http://www.u-blox.com/en/evaluation-tools-a-software/u-center/u-center.html

Dependencies:   mbed

Fork of C027_GPSTransparentSerial by u-blox

Install mbed Windows Drivers

Make sure you installed the drivers on your windows PC to get the virtual serial port. A installation guideline and the drivers can be found in the following wiki page. /handbook/Windows-serial-configuration

Committer:
mazgch
Date:
Fri Oct 25 22:14:04 2013 +0000
Revision:
3:a985a125f9fa
Parent:
2:832530e30120
Child:
4:0e065a08144b
identation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mazgch 0:7f124c0a351a 1 #include "mbed.h"
mazgch 1:0d32baf4a645 2 #include "C027.h"
mazgch 0:7f124c0a351a 3
mazgch 3:a985a125f9fa 4 int main()
mazgch 0:7f124c0a351a 5 {
mazgch 1:0d32baf4a645 6 C027 c027;
mazgch 1:0d32baf4a645 7 c027.gpsPower(true);
mazgch 3:a985a125f9fa 8
mazgch 2:832530e30120 9 // open the gps i2c port
mazgch 2:832530e30120 10 I2C gps(GPSSDA, GPSSCL);
mazgch 3:a985a125f9fa 11
mazgch 0:7f124c0a351a 12 // open the PC serial port and (use the same baudrate)
mazgch 0:7f124c0a351a 13 Serial pc(USBTX, USBRX);
mazgch 0:7f124c0a351a 14 pc.baud(GPSBAUD);
mazgch 3:a985a125f9fa 15
mazgch 2:832530e30120 16 char buf[2];
mazgch 2:832530e30120 17 buf[0] = 0xFF/*REGSTREAM*/;
mazgch 3:a985a125f9fa 18 while (gps.write(GPSADR,buf,1,false))
mazgch 2:832530e30120 19 {
mazgch 3:a985a125f9fa 20 wait_ms(200);
mazgch 3:a985a125f9fa 21 printf("$GPTXT,no GPS found\r\n");
mazgch 3:a985a125f9fa 22 }
mazgch 3:a985a125f9fa 23 while (1)
mazgch 0:7f124c0a351a 24 {
mazgch 0:7f124c0a351a 25 // transfer data from pc to gps
mazgch 3:a985a125f9fa 26 if (pc.readable())
mazgch 2:832530e30120 27 {
mazgch 2:832530e30120 28 buf[1] = pc.getc();
mazgch 2:832530e30120 29 gps.write(GPSADR,buf,2,false);
mazgch 2:832530e30120 30 }
mazgch 2:832530e30120 31 if (pc.writeable() && !gps.read(GPSADR,&buf[1],sizeof(buf[1]),false))
mazgch 3:a985a125f9fa 32 pc.putc(buf[1]);
mazgch 0:7f124c0a351a 33 }
mazgch 0:7f124c0a351a 34 }