Sample project to connect to AT&T M2X from the STM32 Nucleo + MTSAS Cellular SocketModem shield
Dependencies: M2XStreamClient jsonlite mbed
Fork of MTSAS_Cellular_Connect_M2X_Example_F411 by
Diff: main.cpp
- Revision:
- 0:47bc9ce390cc
- Child:
- 1:4c54ec0a3a20
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jul 24 18:56:55 2014 +0000 @@ -0,0 +1,50 @@ +#include "mbed.h" +#include "mtsas.h" + +int main(){ + //Modify to match your apn if you are using an HSPA radio with a SIM card + const char APN[] = ""; + + /** STMicro Nucelo F401RE + * The supported jumper configurations of the MTSAS do not line up with + * the pin mapping of the Nucleo F401RE. Therefore, the MTSAS serial TX + * pin (JP8 Pin 2) must be manually jumped to Serial1 RX (Shield pin D2) + * and the MTSAS serial RX pin (JP9 Pin 2) pin must be manually jumped to + * Serial1 TX (Shield pin D8). + * Uncomment the following line to use the STMicro Nuceleo F401RE + */ + MTSSerialFlowControl* io = new MTSSerialFlowControl(D8, D2, D3, D6); + + /** Freescale KL46Z + * To configure the pins for the Freescale KL46Z board, use configuration B + * for the SocketModem. The TX pin should be jumped to pin D2 (JP8), and the + * RX pin should be jumped to pin D9 (JP9). + * Uncomment te following line to use the Freescale KL46Z board + */ + //MTSSerialFlowControl* io = new MTSSerialFlowControl(D2, D9, D3, D6); + + /** Freescale KL64F + * To configure the pins for the Freescale KL46Z board, use configuration A + * for the SocketModem. The TX pin should be jumped to pin D1 (JP8), and the + * RX pin should be jumped to pin D0 (JP9). + * Uncomment te following line to use the Freescale KL46F board + */ + //MTSSerialFlowControl* io = new MTSSerialFlowControl(D1, D0, D3, D6); + + //Sets the baudrate for communicating with the radio + io->baud(115200); + + Cellular* radio = CellularFactory::create(io); + radio->setApn(APN); + + //Establish PPP link + radio->connect(); + + printf("Ping was %s\n", radio->ping() ? "successful" : "unsuccessful"); + + //Disconnect ppp link + radio->disconnect(); + + printf("End of example code\n"); + return 0; +} \ No newline at end of file