C027 Mdm Test

Dependencies:   C027_Support mbed

Fork of C027_SupportTest by Lime

Committer:
Ulhingl
Date:
Thu Nov 17 14:50:36 2016 +0000
Revision:
1:ec2c054e0822
Parent:
0:15a06b50e14e
Simple MDM Connection Test for C027 Board

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bennettmatt1977 0:15a06b50e14e 1 #include "mbed.h"
bennettmatt1977 0:15a06b50e14e 2
bennettmatt1977 0:15a06b50e14e 3 //------------------------------------------------------------------------------------
bennettmatt1977 0:15a06b50e14e 4 /* This example was tested on C027-U20 and C027-G35 with the on board modem.
bennettmatt1977 0:15a06b50e14e 5
bennettmatt1977 0:15a06b50e14e 6 Additionally it was tested with a shield where the SARA-G350/U260/U270 RX/TX/PWRON
bennettmatt1977 0:15a06b50e14e 7 is connected to D0/D1/D4 and the GPS SCL/SDA is connected D15/D15. In this
bennettmatt1977 0:15a06b50e14e 8 configuration the following platforms were tested (it is likely that others
bennettmatt1977 0:15a06b50e14e 9 will work as well)
bennettmatt1977 0:15a06b50e14e 10 - U-BLOX: C027-G35, C027-U20, C027-C20 (for shield set define C027_FORCE_SHIELD)
bennettmatt1977 0:15a06b50e14e 11 - NXP: LPC1549v2, LPC4088qsb
bennettmatt1977 0:15a06b50e14e 12 - Freescale: FRDM-KL05Z, FRDM-KL25Z, FRDM-KL46Z, FRDM-K64F
bennettmatt1977 0:15a06b50e14e 13 - STM: NUCLEO-F401RE, NUCLEO-F030R8
bennettmatt1977 0:15a06b50e14e 14 mount resistors SB13/14 1k, SB62/63 0R
bennettmatt1977 0:15a06b50e14e 15 */
bennettmatt1977 0:15a06b50e14e 16 #include "MDM.h"
bennettmatt1977 0:15a06b50e14e 17 //------------------------------------------------------------------------------------
bennettmatt1977 0:15a06b50e14e 18 // You need to configure these cellular modem / SIM parameters.
bennettmatt1977 0:15a06b50e14e 19 // These parameters are ignored for LISA-C200 variants and can be left NULL.
bennettmatt1977 0:15a06b50e14e 20 //------------------------------------------------------------------------------------
bennettmatt1977 0:15a06b50e14e 21 //! Set your secret SIM pin here (e.g. "1234"). Check your SIM manual.
bennettmatt1977 0:15a06b50e14e 22 #define SIMPIN NULL
bennettmatt1977 0:15a06b50e14e 23 /*! The APN of your network operator SIM, sometimes it is "internet" check your
bennettmatt1977 0:15a06b50e14e 24 contract with the network operator. You can also try to look-up your settings in
bennettmatt1977 0:15a06b50e14e 25 google: https://www.google.de/search?q=APN+list */
bennettmatt1977 0:15a06b50e14e 26 #define APN NULL
bennettmatt1977 0:15a06b50e14e 27 //! Set the user name for your APN, or NULL if not needed
bennettmatt1977 0:15a06b50e14e 28 #define USERNAME NULL
bennettmatt1977 0:15a06b50e14e 29 //! Set the password for your APN, or NULL if not needed
bennettmatt1977 0:15a06b50e14e 30 #define PASSWORD NULL
bennettmatt1977 0:15a06b50e14e 31 //------------------------------------------------------------------------------------
bennettmatt1977 0:15a06b50e14e 32
bennettmatt1977 0:15a06b50e14e 33 int main(void)
bennettmatt1977 0:15a06b50e14e 34 {
bennettmatt1977 0:15a06b50e14e 35
bennettmatt1977 0:15a06b50e14e 36 // Create the modem object
Ulhingl 1:ec2c054e0822 37 MDMSerial mdm(MDMTXD, MDMRXD);
Ulhingl 1:ec2c054e0822 38 // mdm.setDebug(4); // enable this for debugging issues
Ulhingl 1:ec2c054e0822 39
Ulhingl 1:ec2c054e0822 40 mdm.init();
Ulhingl 1:ec2c054e0822 41 wait(1);
Ulhingl 1:ec2c054e0822 42
Ulhingl 1:ec2c054e0822 43 mdm.connect();
Ulhingl 1:ec2c054e0822 44 // initialize the modem //
Ulhingl 1:ec2c054e0822 45 // MDMParser::DevStatus devStatus = {};
Ulhingl 1:ec2c054e0822 46 // MDMParser::NetStatus netStatus = {};
Ulhingl 1:ec2c054e0822 47 // bool mdmOk = mdm.init(SIMPIN, &devStatus);
Ulhingl 1:ec2c054e0822 48 // mdm.dumpDevStatus(&devStatus);
Ulhingl 1:ec2c054e0822 49 //if (mdmOk) {
Ulhingl 1:ec2c054e0822 50 // // wait until we are connected
Ulhingl 1:ec2c054e0822 51 // mdmOk = mdm.registerNet(&netStatus);
Ulhingl 1:ec2c054e0822 52 // mdm.dumpNetStatus(&netStatus);
Ulhingl 1:ec2c054e0822 53 // }
Ulhingl 1:ec2c054e0822 54 // if (mdmOk)
Ulhingl 1:ec2c054e0822 55 // {
Ulhingl 1:ec2c054e0822 56 // // http://www.geckobeach.com/cellular/secrets/gsmcodes.php
Ulhingl 1:ec2c054e0822 57 // // http://de.wikipedia.org/wiki/USSD-Codes
Ulhingl 1:ec2c054e0822 58 //
Ulhingl 1:ec2c054e0822 59 // // join the internet connection
Ulhingl 1:ec2c054e0822 60 // MDMParser::IP ip = mdm.join(APN,USERNAME,PASSWORD);
Ulhingl 1:ec2c054e0822 61 //
Ulhingl 1:ec2c054e0822 62 // }
bennettmatt1977 0:15a06b50e14e 63
Ulhingl 1:ec2c054e0822 64 mdm.disconnect();
bennettmatt1977 0:15a06b50e14e 65 //DigitalOut led(LED1);
bennettmatt1977 0:15a06b50e14e 66 mdm.powerOff();
bennettmatt1977 0:15a06b50e14e 67 return 0;
bennettmatt1977 0:15a06b50e14e 68 }