AN-00109 ViSi Connecting the CC3000 to an AP

 

Description Nowadays, wireless connection is one of the most common mode of inter-connectivity. This application note shows how to interface a 4D Diablo16 display to a CC3000 WiFi module via SPI connection. This application note further shows how to initialize the CC3000 WiFi module and how to connect to a user-defined access point.
Supported Processor DIABLO16
Supported Environment ViSi
Difficulty

Difficult

 

File Downloads
Files

Description

This application note shows how to connect to an access point using the CC3000 WiFi module. This documentation is limited to initializing the CC3000 and connecting to a user defined access point.

 

Before getting started, the following are required:

  • The target module can also be a Diablo16 display

uLCD-35DT

uLCD-70DT

Visit www.4dsystems.com.au/products to see the latest display module products that use the Diablo16 processor.

 

Application Overview

Nowadays, wireless connections is one the most common mode of interconnectivity. One the most utilized mode of wireless connection is the internet connection. This application note show how to create the hardware connection from the display module to the cc3000 WiFi module via SPI connection.

 

Setup Procedure

For instructions on how to launch Workshop 4, how to open a ViSi project, and how to change the target display, kindly refer to the section “Setup Procedure” of the application note

 

ViSi Getting Started - First Project for Picaso and Diablo16

 

Create a New Project

For instructions on how to create a new ViSi project, please refer to the section “Create a New Project” of the application note

 

ViSi Getting Started - First Project for Picaso and Diablo16

 

Design of the Project

Layout of the Project

In this project couple of objects were used to provide a simple user interface form for the CC3000. The user interface accepts string inputs which are manually entered by the user through the keyboard object. The characters can be typed in the space provided in the project form.

ACCESS POINT SSID AND PASSKEY INPUT LOCATIONS

 

Spaces for the ACCESS POINT SSID AND PASSKEY.

 

CONNECTION  ACCESS POINT STATUS ICONS


These icons show the status of connecting to the network.

 

                        NOT CONNECTED                           CONNECTED

EXECUTE CONNECTION TO ACCESS POINT ICON

If the access point SSID and PASSKEY have all been entered as represented by the check mark beside the spaces. The next icon to consider is the connect command execute icon.

** NOTE: A child program is run in flash bank 2. The program included in the zip file with this project.

 

The ViSi-based CC3000 Program

In this part of the application note statements that were written in 4DGL will be shown.  These statements are used to produce the functionality desired for this project application. Each of the sub-routines has a group of statements that are intended for a designated purpose only.

The sub-routines

The statements presented here are called upon in the main function later in this document. It is best to present the purpose of each sub-routine for us to be able to easily understand the main program statements.

Icons() sub-routine

To initially display the ViSi project objects is the purpose of this sub-routine. It also contains the statements that clear the attributes for the objects there enabling the object to be valid for touch feature of the display.

Connection(state) sub-routine

This sub-routine is made to initially display the animated button for the connection status indicator and also it is used to change the index of the animated button according to the status of the connection to an access point.

 

 

form(number) sub-routine

This routine was written to simply the method of showing the objects in the main program it is simply a compilation of all the other individual components that forms the page displayed.

 

String_handle() sub-routine

This sub-routine is dedicated to processing the output of the keyboard object. It has several statement that perform an equality comparison to identify the character that was pressed. Whenever a character is pressed this is added to the location of the global array pointer. The character is continually added to the string but the SSID and the PASSKEY can only be up to 32 characters.

 

In addition to this editing of the string can only be done while the user is currently typing the SSID or the password. Once the ENTER KEY is pressed the string is passed to their respective array containers. The data set to the SSID and passkey will be overwritten once the user presses the location of the spaces provided to display the inputs.

 

The content of the routine does not include detection of existing password or any history. The access point information is erased once the system restarts.

 

Wifi_connect() subroutine

This sub-routine contains the command to transport data to flashbank_2. Notice that there is memory allocation in the statements. The memory set allows data to be saved to the location while a program is run in the other flash bank locations.

 

Wlan() subroutine

This sub routine is dedicated to transferring information in the form of individual data in an array. For this application 8 bytes that correspond to a particular value is written to flash bank 2.

 

The data transferred to flash bank 2 is translated by a child program which should be downloaded to the aforementioned flash bank. The content of the child program is a compilation of libraries to support the CC3000 WiFi Module.  The child program is included in the project  files.

The main()  program

The statement included initializes the microSD and then accessing the GCI and DAT files from there on. The images contained in the GCI/DAT files are then read and displayed using the sub-routine calls. Finally a repetitive loop checks and monitors the touch related events.

The WiFi support program on FLASHBANK_2

As mentioned from the previous part of this application note, a program is downloaded into the second flash bank location.  The child program is named “SECONDARY”. THIS SHOULD BE DOWNLOADED TO THE DISPLAY TOGETHER WITH THE PROJECT DISCUSSED IN PRECEEDING SECTIONS.

 

The files contains host controller commands that are needed to instruct the CC3000. The commands are used in a blocking mode, meaning a certain set of time is allocated to await the response of the CC3000. The child program takes the values passed the main bank or flash bank 0 and these values are used in the commands in function main() of flash bank 2.

From the previous function wlan(…), parameters are passed to the 2nd Flashbank. These parameters are the subjected to a series of if-else condition to identify which command is equivalent to parameters passed. The passed command is then executed while running in Flashbank 2. A special value is passed in the wlan function, this is the parameter ‘store’. The ‘store’ parameter identifies the start of the array where the result will be saved using the event_handle(store) function.

 

Included in the child program on Flashbank 2 is a long list of commands all dedicated to supporting the CC3000. This part of the project will be described on a separate application note to avoid confusion.

 

Connect the Adafruit CC3000 Shield to the uLCD-35DT

The image below shows a colour guided wiring connections for the CC3000 shield and uLCD-35DT.

Run the Program

For instructions on how to save a ViSi project, how to connect the target display to the PC, how to select the program destination, and how to compile and download a program, please refer to the section “Run the Program” of the application note

 

ViSi Getting Started - First Project for Picaso and Diablo16

Share: