This example establishes a transparent link between the mbed seial port and the gps 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. u-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
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
main.cpp@3:e8792e374579, 2014-06-12 (annotated)
- Committer:
- mazgch
- Date:
- Thu Jun 12 07:29:20 2014 +0000
- Revision:
- 3:e8792e374579
- Parent:
- 2:490b4b087576
update libraries (use api provided by the platform)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mazgch | 0:7f124c0a351a | 1 | #include "mbed.h" |
mazgch | 3:e8792e374579 | 2 | #ifdef TARGET_UBLOX_C027 |
mazgch | 3:e8792e374579 | 3 | #include "C027_api.h" |
mazgch | 3:e8792e374579 | 4 | #else |
mazgch | 3:e8792e374579 | 5 | #error "This example is targeted for the C027 platform" |
mazgch | 3:e8792e374579 | 6 | #endif |
mazgch | 0:7f124c0a351a | 7 | |
mazgch | 3:e8792e374579 | 8 | /* This example is establishing a transparent link between |
mazgch | 3:e8792e374579 | 9 | the mbed serial port and the serial communication interface |
mazgch | 3:e8792e374579 | 10 | of the GPS. |
mazgch | 3:e8792e374579 | 11 | |
mazgch | 3:e8792e374579 | 12 | For a more advanced driver for the GPS or Modem(MDM) please |
mazgch | 3:e8792e374579 | 13 | look at the follwing library and example: |
mazgch | 3:e8792e374579 | 14 | C027_Support Library |
mazgch | 3:e8792e374579 | 15 | http://mbed.org/teams/ublox/code/C027_Support/ |
mazgch | 3:e8792e374579 | 16 | C027_Support Example |
mazgch | 3:e8792e374579 | 17 | http://mbed.org/teams/ublox/code/C027_SupportTest/ |
mazgch | 3:e8792e374579 | 18 | */ |
mazgch | 0:7f124c0a351a | 19 | int main() |
mazgch | 0:7f124c0a351a | 20 | { |
mazgch | 3:e8792e374579 | 21 | c027_gps_powerOn(); |
mazgch | 2:490b4b087576 | 22 | int baud = GPSBAUD; |
mazgch | 2:490b4b087576 | 23 | |
mazgch | 0:7f124c0a351a | 24 | // open the gps serial port |
mazgch | 0:7f124c0a351a | 25 | Serial gps(GPSTXD, GPSRXD); |
mazgch | 2:490b4b087576 | 26 | gps.baud(baud); |
mazgch | 0:7f124c0a351a | 27 | |
mazgch | 0:7f124c0a351a | 28 | // open the PC serial port and (use the same baudrate) |
mazgch | 0:7f124c0a351a | 29 | Serial pc(USBTX, USBRX); |
mazgch | 2:490b4b087576 | 30 | pc.baud(baud); |
mazgch | 0:7f124c0a351a | 31 | |
mazgch | 0:7f124c0a351a | 32 | while (1) |
mazgch | 0:7f124c0a351a | 33 | { |
mazgch | 0:7f124c0a351a | 34 | // transfer data from pc to gps |
mazgch | 0:7f124c0a351a | 35 | if (pc.readable() && gps.writeable()) |
mazgch | 0:7f124c0a351a | 36 | gps.putc(pc.getc()); |
mazgch | 0:7f124c0a351a | 37 | // transfer data from gps to pc |
mazgch | 0:7f124c0a351a | 38 | if (gps.readable() && pc.writeable()) |
mazgch | 0:7f124c0a351a | 39 | pc.putc(gps.getc()); |
mazgch | 0:7f124c0a351a | 40 | } |
mazgch | 0:7f124c0a351a | 41 | } |