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.
Fork of YYY_Dragonfly_USBTerminal by
main.cpp@2:69fe2640298a, 2015-10-29 (annotated)
- Committer:
- BlueShadow
- Date:
- Thu Oct 29 09:03:22 2015 +0000
- Revision:
- 2:69fe2640298a
- Parent:
- 1:af87be58749e
added notes for AT commands via USB cable. Added at command sequence to program for some debugging and diagnostic info for what's going on.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mfiore | 0:46dc3fdbc97e | 1 | #include "mbed.h" |
mfiore | 0:46dc3fdbc97e | 2 | |
BlueShadow | 1:af87be58749e | 3 | int main() |
BlueShadow | 1:af87be58749e | 4 | { |
mfiore | 0:46dc3fdbc97e | 5 | // external serial port |
BlueShadow | 2:69fe2640298a | 6 | /* Serial ext(USBTX,USBRX ); */ //AT commands via USB port on Dragonfly |
BlueShadow | 2:69fe2640298a | 7 | /* Serial ext(dbgTX,dbgRX); */ //AT commands via debug port (same as below but bad reference text |
BlueShadow | 2:69fe2640298a | 8 | Serial ext(PB_6, PB_7); //AT commands via debug port that we use for jtag programming also. |
BlueShadow | 2:69fe2640298a | 9 | /* Serial ext(PA_2, PA_3); */ //AT commands not sure where they go yet. |
BlueShadow | 1:af87be58749e | 10 | |
mfiore | 0:46dc3fdbc97e | 11 | // internal serial port to radio |
BlueShadow | 2:69fe2640298a | 12 | Serial radio(RADIO_TX, RADIO_RX); |
BlueShadow | 1:af87be58749e | 13 | |
BlueShadow | 2:69fe2640298a | 14 | ext.baud(115200); // can be changed to a higher rate, Windows is ok with 115200 |
BlueShadow | 2:69fe2640298a | 15 | radio.baud(115200); // set by multitech engineers |
BlueShadow | 1:af87be58749e | 16 | |
BlueShadow | 2:69fe2640298a | 17 | while (true) { // push in data to In radio |
mfiore | 0:46dc3fdbc97e | 18 | if (ext.readable()) |
mfiore | 0:46dc3fdbc97e | 19 | radio.putc(ext.getc()); |
BlueShadow | 2:69fe2640298a | 20 | if (radio.readable()) //push jout data from radio to out radio |
mfiore | 0:46dc3fdbc97e | 21 | ext.putc(radio.getc()); |
mfiore | 0:46dc3fdbc97e | 22 | } |
BlueShadow | 2:69fe2640298a | 23 | } |
BlueShadow | 2:69fe2640298a | 24 | |
BlueShadow | 2:69fe2640298a | 25 | |
BlueShadow | 2:69fe2640298a | 26 | /* |
BlueShadow | 2:69fe2640298a | 27 | Below are the AT commands that will |
BlueShadow | 2:69fe2640298a | 28 | |
BlueShadow | 2:69fe2640298a | 29 | Foot notes for class |
BlueShadow | 2:69fe2640298a | 30 | NOTE: BACKSPACE will cause the instructions to FAIL. Just hit enter and re-type |
BlueShadow | 2:69fe2640298a | 31 | |
BlueShadow | 2:69fe2640298a | 32 | at [if working, command responds with “OK”] |
BlueShadow | 2:69fe2640298a | 33 | at+cpin? [Check SIM is detected] READY |
BlueShadow | 2:69fe2640298a | 34 | at+cgdcont=1,”IP”,”xxxxxxxxxxxxxxxxxx” [Enter the carrier SIM APN into modem] |
BlueShadow | 2:69fe2640298a | 35 | at+cgdcont? [verify APN is correct] |
BlueShadow | 2:69fe2640298a | 36 | at+csq [Check signal strength >10, but 8 will still work] |
BlueShadow | 2:69fe2640298a | 37 | at+creg? [Check for successful network registration] +CREG:0,1 or +CREG:0,5 |
BlueShadow | 2:69fe2640298a | 38 | at+cnmi=2,2,0,1,0 [Configure to route received SMS text direct to serial interface] |
BlueShadow | 2:69fe2640298a | 39 | at+cmgf=1 [text mode for SMS] |
BlueShadow | 2:69fe2640298a | 40 | at+cmgs=”1##########”<cr> [enter phone number # to send SMS text message] >type sms message at greater than prompt<Control-Z> to send |
BlueShadow | 2:69fe2640298a | 41 | Verify SMS is received. On phone that received SMS, respond by sending SMS back to modem number. |
BlueShadow | 2:69fe2640298a | 42 | |
BlueShadow | 2:69fe2640298a | 43 | |
BlueShadow | 2:69fe2640298a | 44 | AT+creg? Responses |
BlueShadow | 2:69fe2640298a | 45 | -------------------------+CREG: 0,2 not registered to a network but looking (device hasn’t established a link to the carrier yet) |
BlueShadow | 2:69fe2640298a | 46 | +CREG: 0,1 registered on the home network |
BlueShadow | 2:69fe2640298a | 47 | +CREG: 0,5 registered but roaming |
BlueShadow | 2:69fe2640298a | 48 | +CREG: 0,3 unknown (bad) |
BlueShadow | 2:69fe2640298a | 49 | +CREG: 0,4 unknown (bad) |
BlueShadow | 2:69fe2640298a | 50 | +CREG: 0,0 unregistered and not looking (sim isn’t: installed, inplace correctly , functional, active) |
BlueShadow | 2:69fe2640298a | 51 | |
BlueShadow | 2:69fe2640298a | 52 | AT+csq: >10 is better but it will function at lower levels. |
BlueShadow | 2:69fe2640298a | 53 | Reference Signal Levels |
BlueShadow | 2:69fe2640298a | 54 | 0 = -113 dBm, 1 = -111 dBm, 2 = -109 dBm, 3 = -107 dBm, 4 = -105 dBm |
BlueShadow | 2:69fe2640298a | 55 | 5 = -103 dBm, 6 = -101 dBm, 7 = -99 dBm, 8 = -97 dBm, 9 = -95 dBm |
BlueShadow | 2:69fe2640298a | 56 | 10 = -93 dBm, 11 = -91 dBm, 12 = -89 dBm, 13 = -87 dBm, 14 = -85 dBm |
BlueShadow | 2:69fe2640298a | 57 | 15 = -83 dBm, 16 = -81 dBm, 17 = -79 dBm, 18 = -77 dBm, 19 = -75 dBm |
BlueShadow | 2:69fe2640298a | 58 | 20 = -73 dBm, 21 = -71 dBm, 22 = -69 dBm, 23 = -67 dBm, 24 = -65 dBm |
BlueShadow | 2:69fe2640298a | 59 | 25 = -63 dBm, 26 = -61 dBm, 27 = -59 dBm, 28 = -57 dBm, 29 = -55 dBm |
BlueShadow | 2:69fe2640298a | 60 | 30 = -53 dBm, 31 = -51 dBm |
BlueShadow | 2:69fe2640298a | 61 | */ |