Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

CC3200 Email Demo Application

From Texas Instruments Wiki
Jump to: navigation, search
Cc31xx cc32xx return home.png
Cc32xx return sample apps.png

The E-mail Setup

The email application on the CC3200 sends emails using SMTP (Simple Mail Transfer Protocol). The email application sends a preconfigured email at the push of a button or a user-configured email through the CLI (Command Line Interface).

CC3101 Email app email setup.png

Figure 1 Sample Setup showcasing the Simple Email Application

CC3200 Connects to the SMTP Server via WIFI Access Point which is connected to Internet. CC3200 sends the email to SMTP Server which then forwards it to the recipient Email Server. Recipient receives Email from the Email Server using IMAP/POP3 and other proprietary protocol.

Receiving Email is not in the scope of this Application.

System Overview

CC3101 Email app system overview.png

Figure 2 CC3200 System Overview

CC3200 Simple Email Application

  • SMTP Server Connection
- TCP Connection(Unsecure/Secure) with Google/Yahoo SMTP Server
  • SMTP Protocol
- Authentication with SMTP Server
- Form SMTP packet with Source Email, Recipient Email, Subject, Message etc
- Send SMTP packet to Server
  • LED Control
- Controls LEDs to display Device Status
  • UART Command Handler
- Receive Command from UART Terminal and Send Response
  • Interrupt Handler
- Handles Push Button Interrupt to Trigger Email
- Handles Push Button Interrupt to Start Smart Configuration Mode

Source Files briefly explained

  • main - Simple Application demonstrating Email Client Functionalities.
  • button_if - Interface file to handle button click events.
  • gpio_if - GPIO interface file which handles all LED events.
  • network_if - Network interface file which handles all network connection events.
  • pinmux - Pinmux file to configure GPIO & UART
  • smartconfig - Smart Configuration to configure AP
  • timer_if - Interface file to handle all Timer events
  • uart_if - Interface file which receives command from UART and output Logging Information on UART Terminal
  • netapps\smtp\client- libemail is Platform Indepedent Library and can be Integrated to any Email Client Software using below APIs
    1. sl_NetAppEmailSet - Configure SMTP Server, Login Information, Recipient Email Id, Email Subject etc
    2. sl_NetAppEmailConnect- Connect to SMTP Server
    3. sl_NetAppEmailSend- Send Email

Email Application Sequence

Email/SMTP library is available under '<cc3200-sdk>\netapps\smtp\client\' folder.

CC3101 Email app sequence.png

Figure 3 Normal operation sequence flow

  1. Client makes TCP Connection with SMTP Server.
  2. SMTP Server responds with Response code and Greeting Message containing FQDN
  3. HELO/EHLO – Client sends Hello Message to the Server. ESMTP accepts EHLO
  4. The SMTP Server replies with Code 250 and Hello Message. ESMTP Server replies with SMTP extensions it supports such as Email maximum Size, authentication etc.
  5. If SMTP Server requires authentication, The Client Sends “auth login” followed by “Username” and “Password” encoded with proper encryption accepted by SMTP Server.
auth login
334 VXNlcm5hbWU6

      6. Client Sends Username Encoded with Proper encryption accepted by SMTP Server

a2F1c2hmmdmdmdmhbGt1a2thckBnhfjdhfdjjsksbWFpbC5jb20

      7. Client Sends Password Encoded with Proper encryption accepted by SMTP Server

334 UGFzc3dvcmQ6
Mlklkdldldl21haWxhYjskjdkskjss2Mzc3M=

      8. SMTP Server replies with Authentication Success/Failure.

535 Incorrect authentication data/ 235 Authentication Successful

      9. SMTP Client sends From Address

MAIL FROM: xyz@abc.com

     10. SMTP Client sends TO Address

RCPT TO: abc@ti.com

     11. SMTP Client sends DATA command

DATA

     12. SMTP Client sends email data.

     13. SMTP Server responds with the acknowledgement


Application User Guide

Prerequisites

      * Hardware

      o CC3200 Launch Pad

      * Software

      o Terminal Application such as Tera Term, Hyperterminal etc
      o CC3200 Email Application
      o TI SmartConfig Application


NoteNote: Use your own email-id & password in source code by modifying few MACROs in demo_config.h file and build the project before running the application.
This document is written with 'cc32xx.apps@gmail.com', taken as demo email address.

#define USER                    "cc32xx.apps@gmail.com" //Set Sender/Source Email Address
#define USER_RFC                "cc32xx.apps@gmail.com" //Set Sender/Source Email Address
#define PASS                    "xxxxxxx"              //Set Sender/Source Email Password


This example can be used either on TI-RTOS or FreeRTOS.

For the application to work with TI-RTOS, oslib project and ti_rtos_config project need to be imported into the application workspace. These projects can be found in CC3200-SDK under oslib and ti_rtos folder. Please follow this link for CC3200 TI-RTOS usage CC3200 TI-RTOS
 

Device setup and usage

Getting the Setup Ready

  1. Run the reference application (Flashing the bin/IAR/CCS)
    • Open the Project in IAR/CCS IDE.
    • Email Demo Application on CCS runs on TI RTOS which requires additional tools to be Installed. Refer to CC3200 TI-RTOS for more information.
    • Build and download the application to the board.
  2. For better understanding of the Hardware Setup, please see the image below
CC3200 Email app 03 LP setup.png


Working

a. Send Email from UART Terminal

  • Open UART terminal application such as HyperTerminal/Tera term etc. Select the USB Serial port named with 'CC3200LP' from all the ports listed under device manager.
  • Select Baud Rate to be 115200 and Connect.
  • Once device turns ON successfully, Green LED will turn ON.
  • UART Terminal application should show Below output
Email Terminal

Note – Option 02 is reserved for Source Email Configuration in next SDK release

  • Connection to AP - Follow one of the below method
    1. Connection to Preconfigured AP
      • An Access Point (AP) with SSID as “cc3200demo” is required as it is hard coded in the bin files. Also the AP Security type is Set to “Open”
      • Enter 01 to give Connect command
    2. Connect using Smart Config
      • Connect your Android Device to desired Access Point
      • Enter 06 from UART Terminal
      • Start TI Smart Config application and press Start
  • Red LED will start blinking and will turn ON once connection is successful. Usually it will take 1-10 seconds for the AP connection. If LED keeps blinking, Please check AP SSID name and Security Settings.
  • When Terminal Shows IP Address, Send Command 03 to Set Recipient Email Address and Subject
  • When Terminal Shows OK, Send Command 04 to Set Email Content
  • When Terminal Shows OK, Send 05 to Send Email
  • If Email is Sent Successful Orange LED will blink 5 times and Terminal will show Message “Message Sent”
  • Terminal may show “Server Connection Error”, “Authentication Failed” etc. If “Server Connection Error”, Please Send 05 again.
Email Feature Terminal
  • Open an Email Application and check Email. You Will receive an Email from cc32xx.apps@gmail.com

b. Trigger Email from Push Button

  • Turn on the Device
  • Once device turns ON successfully, Green LED will turn ON.
  • Configuration of AP - Follow one of the below method
    1. Preconfigured AP
      • An Access Point (AP) with SSID as “cc3200demo” is required as it is hard coded in the bin files. Also the AP Security type is Set to “Open”
    2. Smart Config
      • Connect your Android Device to desired Access Point
      • Press Push Button S2
      • Start TI Smart Config application and press Start
      • Wait till Red LED turns ON
  • Press Push Button S3 to send Email.
  • If Smart Configuration is not done, CC32xx device will Connect to default AP "cc3200demo". Red LED will start blinking and will turn ON once connection is successful. Usually it will take 1-10 seconds for the AP connection. If LED keeps blinking, Please check AP SSID name and Security Settings.
  • If Connection is successful, Email will be sent to cc32xx.apps@gmail.com. If user wishes to change this address, it can be changed in Email source code demo_config.h.
  • If Email is Sent Successfully Orange LED will blink 5 times
  • Open an Email Application and check Email. You Will receive an Email from cc32xx.apps@gmail.com as below
Hello from Simplelink! The CC32xx connects new devices to the internet!”
Hello from Simplelink! The CC32xx brings Wi-Fi to battery operated devices!”
Hello from Simplelink! The CC32xx enables creating IOT products FAST!”

Limitations/Known Issues

It only implements a limited set of functionality and has some limitations.

  1. Email is sent to only 1 recipient.
  2. Only plain text Email is Supported

Links