GSM1218
Original Implementation
Implementing the GSM1218 modem with the mbed seemed like it would be a simple task, because implementing it directly through a PC is as easy as plugging up a serial cable and then powering on the modem. Upon writing the code for providing the modem with the proper commands and setting up the modem it ran fine when directly connected to the PC. Once we made the modem talk to the mbed and have the mbed send the modem all of the commands, not only did it not work; it couldn't even send the opening 'AT' command. After a few rigorous trails, creating a serial cable, creating a max232 and any other ways to debug our serial cable, we decided the issue had to be hardware handshake. Since normal computers handle these errors internally, we attempted to emulate a computers handshake through holding certain pins on the serial cable high, forcing some low, leaving some floating, no matter what we tried, the mbed would never talk to the modem.
Initialization code
void modemSetup() { pc.printf("AT\r"); wait(2); pc.printf("AT+CSMP=17,167,0,0 \r"); wait(2); pc.printf("AT+CSCA?\r"); wait(2); pc.printf("AT+CSCA=\"+12063130004\"\r"); wait(2); pc.printf("AT+CMGF=1\r"); wait(2); pc.printf("AT+CNMI=1,1,0,0,0\r"); wait(2); pc.printf("AT+CSAS\r"); wait(5); }
Code for sending the SMS
void sendSMS(char *num, char *msg) { pc.printf("AT+CMGS=\"%s\" \r", num); wait(2); pc.printf("%s ", msg); pc.putc(0x1A); }
Max232 Chip and pin locations
Final Implementation
In order to get the modem to actually work, we made the PC into one big Serial cable. The mbed sends the command (initialization code from above) through the USB in one port, and connects to the PC. The PC is connected through the USB2Serial connector and connected through Serial to the Mbed. Finally the modem is connected to a serial cable to the PC.
We use Hyperterm and open the two ports on the PC, and an echo port to view what was happening between the two ports. Last thing necessary you simply have to put an activated Sim card into the modem and send a message to the desired cell phone number.
Final unsuccessful addition
To add to the complexity of the assignment we attempted to have the computer capable of reading the incoming SMS message. This seemed like it could be easily implemented but the way the modem works is that it spits out a message received command, and then you must send another command to get it to spit out your message. Somewhere in the middle of that all, the modem also sends out some garbage, and when we attempted to read the incoming message, all we received was garbage.
0 comments
You need to log in to post a comment