Sets Dragonfly into an AT command path via a USB to Serial path. The debug path is selected by default. This also has the commands to send a simple text and set the APN.

Dependencies:   mbed-dev

Fork of YYY_Dragonfly_USBTerminal by Paul Jaeger

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 int main()
00004 {
00005     // external serial port
00006   /* Serial ext(USBTX,USBRX ); */   //AT commands via USB port on Dragonfly  
00007   /* Serial ext(dbgTX,dbgRX); */     //AT commands via debug port (same as below but bad reference text
00008    Serial ext(PB_6, PB_7);           //AT commands via debug port that we use for jtag programming also.
00009   /* Serial ext(PA_2, PA_3);  */     //AT commands not sure where they go yet.  
00010 
00011     // internal serial port to radio
00012     Serial radio(RADIO_TX, RADIO_RX);  
00013 
00014     ext.baud(115200);   // can be changed to a higher rate, Windows is ok with 115200
00015     radio.baud(115200);  // set by multitech engineers
00016 
00017     while (true) {          // push in data to In radio
00018         if (ext.readable())
00019             radio.putc(ext.getc());
00020         if (radio.readable())          //push jout data from radio to out radio
00021             ext.putc(radio.getc());
00022     }
00023 }
00024 
00025 
00026 /* 
00027     Below are the AT commands that will 
00028     
00029     Foot notes for class
00030     NOTE: BACKSPACE will cause the instructions to FAIL.  Just hit enter and re-type 
00031     
00032 at                      [if working, command responds with “OK”]
00033 at+cpin?            [Check SIM is detected] READY
00034 at+cgdcont=1,”IP”,”xxxxxxxxxxxxxxxxxx”   [Enter the carrier SIM APN into modem]
00035 at+cgdcont?       [verify APN is correct]
00036 at+csq               [Check signal strength >10, but 8 will still work] 
00037 at+creg?            [Check for successful network registration] +CREG:0,1 or +CREG:0,5
00038 at+cnmi=2,2,0,1,0   [Configure to route received SMS text direct to serial interface]
00039 at+cmgf=1         [text mode for SMS]
00040 at+cmgs=”1##########”<cr>  [enter phone number # to send SMS text message] >type sms message at greater than prompt<Control-Z> to send 
00041    Verify SMS is received. On phone that received SMS, respond by sending SMS back to modem number.
00042 
00043 
00044 AT+creg? Responses
00045 -------------------------+CREG: 0,2 not registered to a network but looking   (device hasn’t established a link to the carrier yet)
00046 +CREG: 0,1 registered on the home network
00047 +CREG: 0,5 registered but roaming  
00048 +CREG: 0,3 unknown (bad)
00049 +CREG: 0,4 unknown (bad)
00050 +CREG: 0,0 unregistered and not looking  (sim isn’t: installed, inplace correctly , functional, active) 
00051 
00052 AT+csq:  >10 is better but it will function at lower levels.
00053 Reference Signal Levels
00054  0 = -113 dBm, 1 = -111 dBm, 2 = -109 dBm, 3 = -107 dBm, 4 = -105 dBm
00055  5 = -103 dBm, 6 = -101 dBm, 7 = -99 dBm,   8 = -97 dBm,  9 = -95 dBm
00056 10 = -93 dBm, 11 = -91 dBm, 12 = -89 dBm, 13 = -87 dBm, 14 = -85 dBm
00057 15 = -83 dBm, 16 = -81 dBm, 17 = -79 dBm, 18 = -77 dBm, 19 = -75 dBm
00058 20 = -73 dBm, 21 = -71 dBm, 22 = -69 dBm, 23 = -67 dBm, 24 = -65 dBm
00059 25 = -63 dBm, 26 = -61 dBm, 27 = -59 dBm, 28 = -57 dBm, 29 = -55 dBm
00060 30 = -53 dBm, 31 = -51 dBm
00061 */