How to switch AP connection in an application
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
SUMMARY:
We have some snip ,test codes in SDK release, this blog is showing how to use snip.dct_read_write, snip.apsta, snip.GPIO to finish one application. And the function is to join different AP by pressing user button. It will help you to understand how to join AP , how to read/write DCT area, be familiar with rule of GPIO operation. Test is based on Wiced 6.2.1.2 release on CYW954907AEVAL1F EVB.
MAIN WORK:
- STA join one AP, and ping , this is the APSTA from snip .
- Because CYW54907 has big internal flash and ram, so apsta includes COMMAN_CONSOLE function,
you can type <status> to check the interface like below:
3. If you want to use command console ,really need big memory (2MB and above), and you need to enable it in makefile:
GLOBAL_DEFINES += INCLUDE_COMMAND_CONSOLE
If you want to use the DCT mac address, you need to enable it in makefile:
GLOBAL_DEFINES +=MAC_ADDRESS_SET_BY_HOST
Some other useful commands are showed here.
4. ADD user_1, user_2 GPIO test code into APSTA.
to find platform_gpio_buttons define in platform.c and platform.h
Below are some structure relationships in the code.
You will see real user_1, user_2 connections in the pdf circuit.
About user_1 and user_2 button initialization, these two pins are already set to INPUT_PULL_UP by default in the boot stage of the board,so you don’t need to initialize them again as a GPIO.
5. Add DCT read code into APSTA.
- Show notes about DCT usage
- With the DCT in external FLASH, the second argument is ignored. For clarity, always use WICED_TRUE ---- This is for 54907 because DCT is in external flash.
- wiced_dct_read_lock() and wiced_dct_read_unlock() need to be used with a couple. But you do not need to call wiced_dct_read_lock() in order to write date to DCT.
- DCT structure will be used by bootloader also , the sub-structure platform_dct_header_t, which is always at the start of the DCT area of the FLASH.
- From SDK-3.7.0, it is possible to upgrade the DCT layout when doing SDK upgrading .
- There are two DCT areas defined in the FLASH, designated as DCT1 and DCT2. we use this in a flip-flop arrangement. When need to update DCT area, we copy the “current” DCT to the opposite area , then indicate that “new” area is the “current” area. The “old ” area is viable DCT area.
Below is the wifi config section printed:
6. Adding code to switch AP
- IOCTL command description.
- If you want to input “wl down” when DUT is in STA mode, call this function.
- If you want to input “wl disassoc”, call this function
- If you want to input an IOCTL command with value or not, please use below interface:
And it is better to add some wwd_wlan_status judge before jumping into calling.
7. add all functions into apsta code:
The steps are:
- to check the Button pressed status.
- to disassociate the AP.
- Network down.
- to write DCT to update the AP ssid which will be joined.
- to print the DCT updated.
- Network up, join the AP.
Reference:
Snip.apsta
Snip.GPIO
Snip.dct_read_write
WICED Device Configuration Table (DCT) Users Guide
cyw954907aeval1f.pdf
- Subscribe to RSS Feed
- Mark Article as New
- Mark Article as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Hey zhez:
Thanks for the great post - lot of good information here! I wanted to ask you about the speed of the change on devices like the 43907 and 54907 (without 802.11r). I took what was here and did some timing and I got that the average time to switch to a new AP (including network down, rewriting dct, then bringing the network interface back up) was about 20 seconds all told on average. Would you have any ideas on what the bottlenecks are in this situation? The one major one I can think of is DHCP so maybe using a static IP would be best but are there any ways you think time could be shaved off those 20 seconds?
I appreciate the consideration of the question, and thanks again for the blog post.
- Subscribe to RSS Feed
- Mark Article as New
- Mark Article as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Hello:
thanks, I think we can have a time print to figure out which is the max time consuming part . Just as you said DHCP will save a lot of time, and we can do more diggings on network_up period.