This example establishes a transparent link between the mbed serial port and the modem (LISA or SARA) on the C027. You can use it to use the standard u-blox tools such as m-center or any terminal program. These tools can then connect to the serial port and talk directly to the modem. Baudrate should be set to 115200 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/m-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@8:b561b2003e76, 2014-06-12 (annotated)
- Committer:
- mazgch
- Date:
- Thu Jun 12 07:28:57 2014 +0000
- Revision:
- 8:b561b2003e76
- Parent:
- 7:5d0d13c54e97
update libraries (use api provided by the platform)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mazgch | 0:53fc79c7af10 | 1 | #include "mbed.h" |
mazgch | 8:b561b2003e76 | 2 | #ifdef TARGET_UBLOX_C027 |
mazgch | 8:b561b2003e76 | 3 | #include "C027_api.h" |
mazgch | 8:b561b2003e76 | 4 | #else |
mazgch | 8:b561b2003e76 | 5 | #error "This example is targeted for the C027 platform" |
mazgch | 8:b561b2003e76 | 6 | #endif |
mazgch | 0:53fc79c7af10 | 7 | |
mazgch | 8:b561b2003e76 | 8 | /* This example is establishing a transparent link between |
mazgch | 8:b561b2003e76 | 9 | the mbed serial port and the serial communication interface |
mazgch | 8:b561b2003e76 | 10 | of the Modem(MDM). |
mazgch | 8:b561b2003e76 | 11 | |
mazgch | 8:b561b2003e76 | 12 | For a more advanced driver for the GPS or Modem(MDM) please |
mazgch | 8:b561b2003e76 | 13 | look at the follwing library and example: |
mazgch | 8:b561b2003e76 | 14 | C027_Support Library |
mazgch | 8:b561b2003e76 | 15 | http://mbed.org/teams/ublox/code/C027_Support/ |
mazgch | 8:b561b2003e76 | 16 | C027_Support Example |
mazgch | 8:b561b2003e76 | 17 | http://mbed.org/teams/ublox/code/C027_SupportTest/ |
mazgch | 8:b561b2003e76 | 18 | */ |
mazgch | 0:53fc79c7af10 | 19 | int main() |
mazgch | 0:53fc79c7af10 | 20 | { |
mazgch | 8:b561b2003e76 | 21 | // setting the power on pin low while powering the device will turn it on |
mazgch | 8:b561b2003e76 | 22 | DigitalOut pin(MDMPWRON, 0); |
mazgch | 8:b561b2003e76 | 23 | wait_ms(10); |
mazgch | 8:b561b2003e76 | 24 | c027_mdm_powerOn(false); |
mazgch | 2:1970ac045983 | 25 | |
mazgch | 0:53fc79c7af10 | 26 | // open the mdm serial port |
mazgch | 8:b561b2003e76 | 27 | Serial mdm(MDMTXD,MDMRXD); |
mazgch | 0:53fc79c7af10 | 28 | mdm.baud(MDMBAUD); |
mazgch | 8:b561b2003e76 | 29 | mdm.set_flow_control(SerialBase::RTSCTS, MDMRTS,MDMCTS); |
mazgch | 0:53fc79c7af10 | 30 | |
mazgch | 0:53fc79c7af10 | 31 | // open the PC serial port and (use the same baudrate) |
mazgch | 0:53fc79c7af10 | 32 | Serial pc(USBTX, USBRX); |
mazgch | 0:53fc79c7af10 | 33 | pc.baud(MDMBAUD); |
mazgch | 0:53fc79c7af10 | 34 | while (1) |
mazgch | 0:53fc79c7af10 | 35 | { |
mazgch | 0:53fc79c7af10 | 36 | // transfer data from pc to modem |
mazgch | 0:53fc79c7af10 | 37 | if (pc.readable() && mdm.writeable()) |
mazgch | 0:53fc79c7af10 | 38 | mdm.putc(pc.getc()); |
mazgch | 0:53fc79c7af10 | 39 | // transfer data from modem to pc |
mazgch | 0:53fc79c7af10 | 40 | if (mdm.readable() && pc.writeable()) |
mazgch | 0:53fc79c7af10 | 41 | pc.putc(mdm.getc()); |
mazgch | 0:53fc79c7af10 | 42 | } |
mazgch | 0:53fc79c7af10 | 43 | } |