Demo application for using the AT&T IoT Starter Kit Powered by AWS.

Dependencies:   SDFileSystem

Fork of ATT_AWS_IoT_demo by Anthony Phillips

IoT Starter Kit Powered by AWS Demo

This program demonstrates the AT&T IoT Starter Kit sending data directly into AWS IoT. It's explained and used in the Getting Started with the IoT Starter Kit Powered by AWS on starterkit.att.com.

What's required

  • AT&T IoT LTE Add-on (also known as the Cellular Shield)
  • NXP K64F - for programming
  • microSD card - used to store your AWS security credentials
  • AWS account
  • Python, locally installed

If you don't already have an IoT Starter Kit, you can purchase a kit here. The IoT Starter Kit Powered by AWS includes the LTE cellular shield, K64F, and a microSD card.

Committer:
ampembeng
Date:
Tue Dec 06 22:31:15 2016 +0000
Revision:
18:6370da1de572
Added code to support SD card access.  The key/cert and MQTT information required for the demo can now be pulled from the SD card file system.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ampembeng 18:6370da1de572 1 /* mbed Microcontroller Library
ampembeng 18:6370da1de572 2 * Copyright (c) 2006-2012 ARM Limited
ampembeng 18:6370da1de572 3 *
ampembeng 18:6370da1de572 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
ampembeng 18:6370da1de572 5 * of this software and associated documentation files (the "Software"), to deal
ampembeng 18:6370da1de572 6 * in the Software without restriction, including without limitation the rights
ampembeng 18:6370da1de572 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
ampembeng 18:6370da1de572 8 * copies of the Software, and to permit persons to whom the Software is
ampembeng 18:6370da1de572 9 * furnished to do so, subject to the following conditions:
ampembeng 18:6370da1de572 10 *
ampembeng 18:6370da1de572 11 * The above copyright notice and this permission notice shall be included in
ampembeng 18:6370da1de572 12 * all copies or substantial portions of the Software.
ampembeng 18:6370da1de572 13 *
ampembeng 18:6370da1de572 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
ampembeng 18:6370da1de572 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
ampembeng 18:6370da1de572 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
ampembeng 18:6370da1de572 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
ampembeng 18:6370da1de572 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ampembeng 18:6370da1de572 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
ampembeng 18:6370da1de572 20 * SOFTWARE.
ampembeng 18:6370da1de572 21 */
ampembeng 18:6370da1de572 22 #ifndef MBED_SDFILESYSTEM_H
ampembeng 18:6370da1de572 23 #define MBED_SDFILESYSTEM_H
ampembeng 18:6370da1de572 24
ampembeng 18:6370da1de572 25 #include "mbed.h"
ampembeng 18:6370da1de572 26 #include "FATFileSystem.h"
ampembeng 18:6370da1de572 27 #include <stdint.h>
ampembeng 18:6370da1de572 28
ampembeng 18:6370da1de572 29 /** Access the filesystem on an SD Card using SPI
ampembeng 18:6370da1de572 30 *
ampembeng 18:6370da1de572 31 * @code
ampembeng 18:6370da1de572 32 * #include "mbed.h"
ampembeng 18:6370da1de572 33 * #include "SDFileSystem.h"
ampembeng 18:6370da1de572 34 *
ampembeng 18:6370da1de572 35 * SDFileSystem sd(p5, p6, p7, p12, "sd"); // MOSI, MISO, SCLK, SSEL
ampembeng 18:6370da1de572 36 *
ampembeng 18:6370da1de572 37 * int main() {
ampembeng 18:6370da1de572 38 * FILE *fp = fopen("/sd/mbed.txt", "w");
ampembeng 18:6370da1de572 39 * fprintf(fp, "Hello World!\n");
ampembeng 18:6370da1de572 40 * fclose(fp);
ampembeng 18:6370da1de572 41 * }
ampembeng 18:6370da1de572 42 * @endcode
ampembeng 18:6370da1de572 43 */
ampembeng 18:6370da1de572 44 class SDFileSystem : public FATFileSystem {
ampembeng 18:6370da1de572 45 public:
ampembeng 18:6370da1de572 46
ampembeng 18:6370da1de572 47 /** Create the File System for accessing an SD Card using SPI
ampembeng 18:6370da1de572 48 *
ampembeng 18:6370da1de572 49 * @param mosi SPI mosi pin connected to SD Card
ampembeng 18:6370da1de572 50 * @param miso SPI miso pin conencted to SD Card
ampembeng 18:6370da1de572 51 * @param sclk SPI sclk pin connected to SD Card
ampembeng 18:6370da1de572 52 * @param cs DigitalOut pin used as SD Card chip select
ampembeng 18:6370da1de572 53 * @param name The name used to access the virtual filesystem
ampembeng 18:6370da1de572 54 */
ampembeng 18:6370da1de572 55 SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name);
ampembeng 18:6370da1de572 56
ampembeng 18:6370da1de572 57 virtual int disk_initialize();
ampembeng 18:6370da1de572 58 virtual int disk_status();
ampembeng 18:6370da1de572 59 virtual int disk_read(uint8_t * buffer, uint64_t block_number);
ampembeng 18:6370da1de572 60 virtual int disk_write(const uint8_t * buffer, uint64_t block_number);
ampembeng 18:6370da1de572 61 virtual int disk_sync();
ampembeng 18:6370da1de572 62 virtual uint64_t disk_sectors();
ampembeng 18:6370da1de572 63
ampembeng 18:6370da1de572 64 protected:
ampembeng 18:6370da1de572 65
ampembeng 18:6370da1de572 66 int _cmd(int cmd, int arg);
ampembeng 18:6370da1de572 67 int _cmdx(int cmd, int arg);
ampembeng 18:6370da1de572 68 int _cmd8();
ampembeng 18:6370da1de572 69 int _cmd58();
ampembeng 18:6370da1de572 70 int initialise_card();
ampembeng 18:6370da1de572 71 int initialise_card_v1();
ampembeng 18:6370da1de572 72 int initialise_card_v2();
ampembeng 18:6370da1de572 73
ampembeng 18:6370da1de572 74 int _read(uint8_t * buffer, uint32_t length);
ampembeng 18:6370da1de572 75 int _write(const uint8_t *buffer, uint32_t length);
ampembeng 18:6370da1de572 76 uint64_t _sd_sectors();
ampembeng 18:6370da1de572 77 uint64_t _sectors;
ampembeng 18:6370da1de572 78
ampembeng 18:6370da1de572 79 SPI _spi;
ampembeng 18:6370da1de572 80 DigitalOut _cs;
ampembeng 18:6370da1de572 81 int cdv;
ampembeng 18:6370da1de572 82 };
ampembeng 18:6370da1de572 83
ampembeng 18:6370da1de572 84 #endif