WICED “Apsta” snip: testing and understanding its implementation
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Testing the Wiced "Apsta" snip step by step
This snip demonstrates how a WICED device can be configured to work simultaneously as an access point and station.
- Launch WICED Studio and open the apsta.c file. It is available at 43xxx_Wi-Fi/apps/snip/apsta as shown on Figure Figure 1
When the WICED device would work as STA, it will join the access point configured in the Wi-Fi configuration DCT.
2.Change the Client AP SSID and Client AP passphrase so that they match with your access point as shown on Figure 2. The Wi-Fi DCT configuration file wifi_config_dct.h is available at 43xxx_Wi-Fi/include.
Figure 2
We will run this snip on the platform BCM943438WCD1.
3. Create a new make target and write the target name “snip.apsta- BCM943438WCD1 download run” without the double quotes as shown on Figure 3.
Figure 3
4. To build and run the target, double click on the target name that we just made as shown on Figure 4.
Figure 4
WICED will build the project and display the various steps that it is executing during the build process in the console window. The apsta snip will start running after the console displays the “Target running” message.
Figure 5
5. Open a UART terminal such as Tera term and select the COM port of the BCM943438WCD1 platform and configure the baud rate to 115200. The following output will be displayed on the UART terminal. As shown on Figure 6, the STA pings the gateway periodically using its IP address.
Figure 6
6. We shall test the WICED SoftAP interface. Connect the Wi-Fi of your computer to the SSID of the SoftAP interface configured in wifi_config_dct.h. By default, the SSID is "WICED Soft AP" and the passphrase is "abcd1234" without quotes.
7. Open a web browser and type Wiced Web-Site. The server should redirect you to a page with the extension "/apps/apsta/ap_top.html" as shown on Figure 7.
Figure 7
This completes the testing of the apsta snip. We shall try to understand the application code written in apsta.c.
Understanding the WICED application code
In the application code, the function wiced_init() is used for initializing the RTOS, platform, WLAN radio of the WICED device.
STA Inteface
The STA interface is brought up using wiced_network_up(WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL); The last field is basically used for configuring the IP settings of the WICED device. It is assigned “NULL” because we configured the network to use external DHCP server. This uses the Dynamic Host Configuration Protocol (DHCP) to assign IP address to the STA. The STA attempts to join the AP configured in wifi_config_dct.h under the Client AP settings. If the join is successful, it obtains the IPv4 address for the STA using DHCP protocol.
IPv4 adress
The IPv4 address of the gateway to which the STA had connected to is then obtained using wiced_ip_get_gateway_address( WICED_STA_INTERFACE, &ping_target_ip ); This address will be used by the STA to ping the gateway.
RTOS Times Event
RTOS event is registered using wiced_rtos_register_timed_event( &ping_timed_event, WICED_NETWORKING_WORKER_THREAD, &send_ping, PING_PERIOD, 0 ); with a callback function send_ping( void *arg ). This callback will be triggered every PING_PERIOD ms and the function wiced_ping( WICED_STA_INTERFACE, &ping_target_ip, PING_TIMEOUT, &elapsed_ms ); will be called to ping the gateway with timeout equal to PING_TIMEOUT ms. This callback will be executed in the networking worker thread.
SoftAP interface
Subsequently the SoftAP interface is brought up using wiced_network_up(WICED_AP_INTERFACE, WICED_USE_INTERNAL_DHCP_SERVER, &ap_ip_settings); The ap_ip_settings contains the IP address, gateway address and netmask settings for the SoftAP. The SoftAP settings in DCT are read and the AP is started using these settings. The NetX API nx_ip_create() is used for creating an IP instance during the bring-up. Specifically the IPv4 settings, packet pools, softAP interface driver, memory, network object and priority of the IP thread are defined by the API. An RTOS thread is created to start a DHCP server and then NetX determines whether the IP address has been resolved or not. If it has been successfully resolved, NetX obtains the IPv4 address and it is displayed on UART terminal. The function wiced_dns_redirector_start( &dns_redirector, WICED_AP_INTERFACE ); is used for redirecting the URL Wiced Web-Site to Wiced Web-Site/apps/apsta/ap_top.html in the HTTP page database.
Wiced Server Start
Subsequently the function wiced_http_server_start ( &ap_http_server, 80, max_sockets, ap_web_pages, WICED_AP_INTERFACE, DEFAULT_URL_PROCESSOR_STACK_SIZE ) starts an HTTP webserver. The instance ap_web_pages of struct wiced_http_page_t encapsulates the redirect link "/apps/apsta/ap_top.html" which is basically found in 43xxx_Wi-Fi/resources/apps/apsta/ap_top.html. It also contains the HTTP MIME type; for instance the MIME type for "/apps/apsta/ap_top.html" is "text/html". WICED_RESOURCE_URL_CONTENT in the structure specifies that the http page ap_top.html is provided by WICED resource. It provides a resource handle structure specifying the location (whether it is in memory, filesystem or external storage), the appropriate resource handle depending on location.
- Subscribe to RSS Feed
- Mark Article as New
- Mark Article as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Hi,
I do what you told me, but UART termina shows that BCM943364 can't connect to the WiFi HAIVVE, just as shown below.
The BCM943364 holds no antenna, could this be the reason?
- Subscribe to RSS Feed
- Mark Article as New
- Mark Article as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
In the UART console, I do not see WLAN MAC address and WLAN firmware version. Please check whether the firmware is getting downloaded correctly.
- Subscribe to RSS Feed
- Mark Article as New
- Mark Article as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
I'm trying our concurrent station/AP mode on my custom board, using the 43341 dual band chip.
If I set the Soft AP channel to the same as the channel the station connects to, it works fine.
However, if I set the channel to something else, then both the station and AP have issues (station disconnects or has very slow/erratic connectivity, and the AP appears to come and go in a scanning app.)
The WICED 6.1 tech brief says "AP/STA mode.. Allows for the Wi-Fi device to instantiate multiple interfaces, one that acts as an Access Point (AP) and one that acts as a Wi-Fi station device (STA). These can be on the same channel or different channels utilizing the virtual simultaneous dual band (VSDB) feature."
Why is my device not performing as claimed? Is VSDB not supported on the 43341?
Thanks.