Skip to content

Commit

Permalink
changes for new wifi slice
Browse files Browse the repository at this point in the history
  • Loading branch information
vinithmundhra committed Feb 15, 2013
1 parent 3cd7d8c commit 1a6401e
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 134 deletions.
4 changes: 0 additions & 4 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
GPIO Examples Change Log
========================

1.0.4
-----
* Added GPIO WebServer example application with Wi-Fi

1.0.3
-----
Expand Down
23 changes: 9 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GPIO Examples Repository
.................................

:Latest release: 1.0.2rc0
:Maintainer: XMOS
:Description: Example applications for XA-SK-GPIO Slice Card showing use of GPIO card features such as LEDs, buttons and external ADC with temperature sensor
:Latest release: 1.0.3alpha1
:Maintainer: sethuchandan
:Description: Example Application for XA-SK-GPIO Slice Card showing use of I2C, external ADC with temperature sensor, LEDs and buttons


:Latest release:
Expand All @@ -12,17 +12,12 @@ GPIO Examples Repository
Required software (dependencies)
================================

Each application might require some or all of the following components. Refer to application specific documentation for the exact requirements.

* sc_i2c ([email protected]:xcore/sc_i2c.git)
* sc_uart ([email protected]:xcore/sc_uart.git)
* sc_pwm ([email protected]:xcore/sc_pwm.git)
* sc_webiste ([email protected]:xcore/sc_webiste.git)
* sc_ethernet ([email protected]:xcore/sc_ethernet.git)
* sc_xtcp ([email protected]:xcore/sc_xtcp.git)
* sc_otp ([email protected]:xcore/sc_otp.git)
* sc_util ([email protected]:xcore/sc_util.git)
* sc_wifi ([email protected]:xcore/sc_wifi.git)
* sc_spi ([email protected]:xcore/sc_spi.git)


* sc_website (https://github.com/xcore/sc_website.git)
* sc_ethernet (https://github.com/xcore/sc_ethernet.git)
* sc_otp (https://github.com/xcore/sc_otp.git)
* sc_xtcp (git://github.com/xcore/sc_xtcp.git)
* sc_util (git://github.com/xcore/sc_util.git)

83 changes: 0 additions & 83 deletions app_sk_gpio_eth_combo_demo/SLICEKIT-L2.xn

This file was deleted.

24 changes: 13 additions & 11 deletions app_sk_gpio_eth_combo_demo/doc_quickstart/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Running the Demo
++++++++++++++++

#. Click on the ``Run`` icon (the white arrow in the green circle). A dialog will appear asking which device to connect to. Select ``XMOS XTAG2``.
#. xTIMEcomposer console displays the ip address obtained by the DHCP client (or local link if DHCP server is not accesible)
#. xTIMEcomposer console displays the ip address obtained by the DHCP client (or local link if DHCP server is not accesible). Please note if the DHCP server is not available on the host PC, it may take a while to obtain the ip address.
#. Open a web browser on the host PC and type the ip address displayed on the xTIMEcomposer console into the browser's address bar
#. On hitting the return key, a web page should get loaded and displayed in the browser as shown in the figure below.

Expand All @@ -66,17 +66,19 @@ Use the web page options to perform various actions such as
Next Steps
++++++++++

Building web pages for your applications
........................................

This application parses ethernet data to interpret web page commands. Refer to the Programming Guide section within the ``SliceKit GPIO Example Applications`` documentation linked from the front page documentation for this demo for more information on how to utilize the ``Embedded Webserver Function Library`` component in building your own custom web server applications.

Look at the Code
................

#. Examine the application code. In xTIMEcomposer navigate to the ``src`` directory under app_sk_gpio_eth_combo_demo and double click on the main.xc file within it. The file will open in the central editor window.
#. The channel ``c_gpio`` is used between web page handler and application handler to send web page requests to the application and to collect GPIO status from the application.
#. In the app_handler.xc file, API set_gpio_state is used by the web page in order to apply web page LED settings and similarly API get_gpio_state is used by web page to collect the current GPIO status containing LEDs, button presses and ADC temperature values.
#. GPIO button scan logic monitors for value changes on the configured 4-bit button port (XS1_PORT_4C) in the application handler routine as defined in the app_handler.xc file. Whenever this port value changes, GPIO button states are updated accordingly.
#. You can also observe that the ADC value is read whenever there is a web page request. This value is interpolated to get a proper temerature value and is updated in the GPIO state structure before sending it to the web page.
#. As a part of this exercise, modify the IP address in main.xc file to a local link address as in the commented part of ip config, build and run the application. Open a web browser to check whether you are able to open a web page using the new ip address and able to issue LED commands from the web page.
The application handler runs on one core. It uses I/O pins to read or write data to the LEDs, buttons and the I2C ADC to read the temperature. The web page handler executes in another core, receiving the TCP requests and processing them. It calls the functions described in the webpage (webpage includes embedded function calls into the application code), processing the requests and sending commands over the c_gpio channel to the gpio core (application handler).

Building web pages for your applications
........................................

This application parses ethernet data to interpret web page commands. Refer to Programming Guide section within the ``SliceKit GPIo Example Applications`` documentation linked from the front page documentation for this demo for more information on how to utilize the ``Embedded Webserver Function Library`` component in building your own custom web server applications.
#. Examine the application code. In xTIMEcomposer navigate to the ``src`` directory under app_sk_gpio_eth_combo_demo and double click on the main.xc file within it. The file will open in the central editor window.
#. The channel ``c_gpio`` is used between tcp handler and application handler to send web page requests to the application and to collect GPIO status from the application.
#. In the app_handler.xc file, the API function ``set_gpio_state`` is used by the web page in order to apply web page LED settings and similarly the API function ``get_gpio_state`` is used by the web page to collect the current GPIO status containing LEDs, button presses and ADC temperature values.
#. There is some GPIO button scan logic which monitors for value changes on the configured 4-bit button port (XS1_PORT_4C) in the application handler routine as defined in the ``app_handler.xc`` file. Whenever this port value changes, the GPIO button states are updated accordingly.
#. Also verify that that the ADC value is read whenever there is a web page request. This value is interpolated to get a proper temerature value and is updated in the GPIO state structure before sending it to the web page.
#. As a part of this exercise, modify the IP address settings in main.xc file to a static ip address as in the commented part of ip config, build and run the application. Open a web browser to check whether you are able to open a web page using the new ip address and able to issue LED commands from the web page.
15 changes: 7 additions & 8 deletions app_sk_gpio_eth_combo_demo/src/main.xc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "app_handler.h"
#include "ethernet_board_support.h"

//#define DHCP

//::Ports Start
ethernet_xtcp_ports_t xtcp_ports =
Expand All @@ -28,17 +27,17 @@ on tile[1]: port p_button=XS1_PORT_4C;

// IP Config - change this to suit your network. Leave with all
// 0 values to use DHCP
#ifdef DHCP
#ifdef STATIC_IP
xtcp_ipconfig_t ipconfig = {
{ 0, 0, 0, 0 }, // ip address (eg 192,168,0,2)
{ 0, 0, 0, 0 }, // netmask (eg 255,255,255,0)
{ 0, 0, 0, 0 } // gateway (eg 192,168,0,1)
{ 192, 168, 1, 178 },
{ 255, 255, 0, 0 },
{ 0, 0, 0, 0 }
};
#else
xtcp_ipconfig_t ipconfig = {
{ 169, 254, 196, 178 },
{ 255, 255, 0, 0 },
{ 0, 0, 0, 0 }
{ 0, 0, 0, 0 }, // ip address (eg 192,168,0,2)
{ 0, 0, 0, 0 }, // netmask (eg 255,255,255,0)
{ 0, 0, 0, 0 } // gateway (eg 192,168,0,1)
};
#endif

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app_sk_gpio_wifi_tiwisl_combo_demo/doc_quickstart/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GPIO Wi-Fi Demo Quick Start Guide
sw_gpio_examples GPIO and Wi-Fi demo : Quick Start Guide
-----------------------------------------------------------

This example demonstrates the use of two Slice Cards, XA-SK-GPIO and Wi-Fi slice together with the xSOFTip components for Wi-Fi, SPI, I2C and WebServer to provide access to the GPIO slice features via a simple embedded webserver.
This example demonstrates the use of two Slice Cards, XA-SK-GPIO and XA-SK-WIFI slice together with the xSOFTip components for Wi-Fi, SPI, I2C and WebServer to provide access to the GPIO slice features via a simple embedded webserver.

A webpage served from the sliceKIT and accessed in a browser on a host PC has the following demo functions:
* Turn GPIO Slice Card LEDS on and off
Expand All @@ -20,7 +20,7 @@ The XP-SKC-L2 Slicekit Core board has four slots with edge connectors: ``SQUARE`

To setup up the system refer to the figure and instructions below

#. Connect the Wi-Fi Slice Card to the XP-SKC-L2 Slicekit Core board using the connector marked with the ``TRIANGLE``.
#. Connect the XA-SK-WIFI Slice Card to the XP-SKC-L2 Slicekit Core board using the connector marked with the ``TRIANGLE``.
#. Connect the XA-SK-GPIO Slice Card to the XP-SKC-L2 Slicekit Core board using the connector marked with the ``SQUARE``.
#. Connect the XTAG Adapter to Slicekit Core board, and connect XTAG-2 to the adapter.
#. Connect the XTAG-2 to the host PC.
Expand Down
15 changes: 7 additions & 8 deletions app_sk_gpio_wifi_tiwisl_combo_demo/src/main.xc
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@
#define DHCP

//::Ports Start
on tile[0]: spi_master_interface tiwisl_spi =
on stdcore[0]: spi_master_interface tiwisl_spi =
{
XS1_CLKBLK_1,
XS1_CLKBLK_2,
XS1_PORT_1L, // MOSI
XS1_PORT_1M, // CLK
XS1_PORT_1O, // MISO
XS1_PORT_1K, // MOSI
XS1_PORT_1J, // CLK
XS1_PORT_1I, // MISO
};

on tile[0]: wifi_tiwisl_ctrl_ports_t tiwisl_ctrl =
on stdcore[0]: wifi_tiwisl_ctrl_ports_t tiwisl_ctrl =
{
XS1_PORT_1P, // nCS
XS1_PORT_1N, // nIRQ
XS1_PORT_1K // Wifi power enable
XS1_PORT_4E, // nCS - Bit0, Power enable - Bit1
XS1_PORT_1L, // nIRQ
};

on tile[1]: r_i2c p_i2c =
Expand Down
2 changes: 1 addition & 1 deletion doc/hardware_requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ This application extends the GPIO com port demo to utilize Ethernet and XTCP com
app_sk_gpio_wifi_tiwisl_combo_demo
++++++++++++++++++++++++++++++++++

* Wi-Fi Slice Card is additionally required for this demo
* XA-SK-WIFI Slice Card is additionally required for this demo

This application extends the GPIO com port demo to utilize Wi-Fi component in order to host a web page to

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion doc/programming.rst
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ Usage and Implementation
++++++++++++++++++++++++

The port declaration for Wi-Fi (SPI), LEDs, Buttons and I2C are declared as below:
* Wi-Fi control uses 3 one-bit ports for nCS(Chip Select), nIRQ(interrupt) and Power enable
* Wi-Fi control uses
* 1 four-bit port for nCS(Chip Select) and Power enable
* 1 one-bit port for nIRQ(interrupt)
* SPI uses 3 one-bit ports for MOSI, CLK and MISO
* I2C uses 1 bit port for SCL(I2C Clock) and SDA (I2C data)
* LEDs and Buttons use 4 bit ports
Expand Down
48 changes: 46 additions & 2 deletions xpd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@
<keyword>buttons</keyword>
<keyword>UART</keyword>
</component>
<component description = "An example application to demonstrate usage of multiple Slice Cards. This application showcase GPIO features which can be accessed and controlled using a web page" type = "demoCode" scope = "Example" path = "app_sk_gpio_eth_combo_demo" local = "false" id = "app_sk_gpio_eth_combo_demo" name = "app_sk_gpio_eth_combo_demo">
<board>XP-SKC-L2</board>
<board>XA-SK-GPIO</board>
<board>XA-SK-E100</board>
<componentDependency>module_webserver</componentDependency>
<componentDependency>module_i2c_master</componentDependency>
<componentDependency>module_otp_board_info</componentDependency>
<componentDependency>module_locks</componentDependency>
<componentDependency>module_xtcp</componentDependency>
<componentDependency>module_ethernet_board_support</componentDependency>
<componentDependency>module_mutual_thread_comm</componentDependency>
<componentDependency>module_ethernet_smi</componentDependency>
<componentDependency>module_ethernet</componentDependency>
<keyword>Ethernet</keyword>
<keyword>I2C</keyword>
<keyword>LED</keyword>
<keyword>buttons</keyword>
</component>
<component description = "An example applications that demonstrate various features of the XA-SK-GPIO Slice Card including the ADC, LEDs and buttons, the I2C master xSOFTip component, as well as various basic features of the xCORE processor." type = "demoCode" scope = "Example" path = "app_sk_gpio_simple_demo" local = "false" id = "app_sk_gpio_simple_demo" name = "Slicekit Simple GPIO Demo">
<board>XA-SK-GPIO</board>
<componentDependency>module_i2c_master</componentDependency>
Expand All @@ -24,18 +42,42 @@
<uri>[email protected]:xcore/sc_i2c.git</uri>
</dependency>
<dependency repo = "sc_uart">
<githash>0257bcd17967e651bc780d2f80373660e32fbfef</githash>
<githash>d89b2a56d6487af908772ff8af894d3b68e13b41</githash>
<uri>[email protected]:xcore/sc_uart.git</uri>
<version>2.2.0rc1</version>
</dependency>
<dependency repo = "sc_pwm">
<githash>53f275204764669c9d8ae10378453aa279a5bc47</githash>
<uri>[email protected]:xcore/sc_pwm.git</uri>
<version>1.0.0rc0</version>
</dependency>
<dependency repo = "sc_website">
<githash>74409813ca629823d534aa40e53111e973b7d218</githash>
<uri>https://github.com/xcore/sc_website.git</uri>
</dependency>
<dependency repo = "sc_ethernet">
<githash>f01fa2f8121e8d69d71185a04a05fddf9373c523</githash>
<uri>https://github.com/xcore/sc_ethernet.git</uri>
</dependency>
<dependency repo = "sc_otp">
<githash>062aa923a78bc603b254b2a99b78593ab3a816ec</githash>
<uri>https://github.com/xcore/sc_otp.git</uri>
<version>1.0.0rc0</version>
</dependency>
<dependency repo = "sc_xtcp">
<githash>072fc71ce5b5c699ea55621c77db1834bddd3b4b</githash>
<uri>git://github.com/xcore/sc_xtcp.git</uri>
</dependency>
<dependency repo = "sc_util">
<githash>3f82b846395c07e8dd32ad9951afc209b6ed7efc</githash>
<uri>git://github.com/xcore/sc_util.git</uri>
</dependency>
<description>Example Application for XA-SK-GPIO Slice Card showing use of I2C, external ADC with temperature sensor, LEDs and buttons</description>
<docdir>doc</docdir>
<docdir>app_sk_gpio_simple_demo/doc_quickstart</docdir>
<docdir>app_sk_gpio_com_demo/doc_quickstart</docdir>
<docdir>app_sk_gpio_eth_combo_demo/doc_quickstart</docdir>
<exclude_dir>app_sk_gpio_wifi_tiwisl_combo_demo</exclude_dir>
<location>git://github.com/xcore/sw_gpio_examples.git</location>
<name>sw_gpio_examples</name>
<maintainer>sethuchandan</maintainer>
Expand All @@ -54,7 +96,9 @@
<release parenthash = "d77347428b1db9cd95d1903e03f8e4e0afb97054" version = "1.0.1alpha5" githash = "eb7131fa34dd9359eaeaea1ed25b385b2eb96eba"></release>
<release parenthash = "eb7131fa34dd9359eaeaea1ed25b385b2eb96eba" version = "1.0.1rc0" githash = "01bea5b5f8f1d0eceb0c448d25a718d0b7b00db9"></release>
<release parenthash = "7ddbafe0cab44b137684dc087be56f8cbb29340a" version = "1.0.2alpha0" githash = "83b6d4b4139af27f4ea28282e73d456f549a0d9a"></release>
<release parenthash = "dcbdb01637adb10aef2a3a8afb1a61706fd53ca7" version = "1.0.2rc0"></release>
<release parenthash = "dcbdb01637adb10aef2a3a8afb1a61706fd53ca7" version = "1.0.2rc0" githash = "b5889de3a516d8554b3e337f73d0e95b21d9a97b"></release>
<release parenthash = "3b7e4eb45a6f5b1f0212b47c1cee9937fac3134e" version = "1.0.3alpha0" githash = "504812a4f92bfb31b29b27fab3e35b3c963335ad"></release>
<release parenthash = "65c5e39da349ec675a6c546d88c9c40c220cc32d" version = "1.0.3alpha1"></release>
<subpartnumber>XM-001887-SM</subpartnumber>
<vendor>XMOS</vendor>
<xcore_repo>sw_gpio_examples.git</xcore_repo>
Expand Down

0 comments on commit 1a6401e

Please sign in to comment.