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@5:1141d3cfd1ef, 2013-12-19 (annotated)
- Committer:
- mazgch
- Date:
- Thu Dec 19 17:31:35 2013 +0000
- Revision:
- 5:1141d3cfd1ef
- Parent:
- 4:fafdcaf842ee
- Child:
- 6:1e5c9b6b2e90
use hw flow control on MDM serial port
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mazgch | 0:53fc79c7af10 | 1 | #include "mbed.h" |
mazgch | 2:1970ac045983 | 2 | #include "C027.h" |
mazgch | 0:53fc79c7af10 | 3 | |
mazgch | 0:53fc79c7af10 | 4 | int main() |
mazgch | 0:53fc79c7af10 | 5 | { |
mazgch | 2:1970ac045983 | 6 | C027 c027; |
mazgch | 2:1970ac045983 | 7 | c027.mdmPower(true); |
mazgch | 2:1970ac045983 | 8 | |
mazgch | 0:53fc79c7af10 | 9 | // open the mdm serial port |
mazgch | 0:53fc79c7af10 | 10 | Serial mdm(MDMTXD, MDMRXD); |
mazgch | 0:53fc79c7af10 | 11 | mdm.baud(MDMBAUD); |
mazgch | 5:1141d3cfd1ef | 12 | // use hardware flow control to make the connection more reliable |
mazgch | 5:1141d3cfd1ef | 13 | mdm.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS); |
mazgch | 0:53fc79c7af10 | 14 | |
mazgch | 0:53fc79c7af10 | 15 | // open the PC serial port and (use the same baudrate) |
mazgch | 0:53fc79c7af10 | 16 | Serial pc(USBTX, USBRX); |
mazgch | 0:53fc79c7af10 | 17 | pc.baud(MDMBAUD); |
mazgch | 0:53fc79c7af10 | 18 | |
mazgch | 0:53fc79c7af10 | 19 | while (1) |
mazgch | 0:53fc79c7af10 | 20 | { |
mazgch | 0:53fc79c7af10 | 21 | // transfer data from pc to modem |
mazgch | 0:53fc79c7af10 | 22 | if (pc.readable() && mdm.writeable()) |
mazgch | 0:53fc79c7af10 | 23 | mdm.putc(pc.getc()); |
mazgch | 0:53fc79c7af10 | 24 | // transfer data from modem to pc |
mazgch | 0:53fc79c7af10 | 25 | if (mdm.readable() && pc.writeable()) |
mazgch | 0:53fc79c7af10 | 26 | pc.putc(mdm.getc()); |
mazgch | 0:53fc79c7af10 | 27 | } |
mazgch | 0:53fc79c7af10 | 28 | } |