Step-by-step Usage Instructions

Minimal steps

  1. Make sure you have the SOCK library in your project (actually, you only need this if you have #define WLN_WPA 1 or #define WLN_KEEP_ALIVE 1).
  2. Add wln.tbs and wln.tbh files to your project (they are in current_library_set\wln\trunk).
  3. Add #define WLN_DEBUG_PRINT 1 to the defines section of the global.tbh file of your project. This way you will "see what's going on". Don't forget to remove this later, after you've made sure that the library operates as expected.


Some access points, notably CISCO devices, are so impatient during the WPA1/WPA2 handshake process, that printing debug info makes them timeout. If you notice that the WLN library is stuck in the endless association loop, and you are sure that your password is set correctly, then try disabling debug printing!

  1. Define GA1000 interface line mapping. The following code is suggested (unless you built your own hardware, in which case study the Configuring Interface Lines topic of the wln. object's documentation):

** Tibbo Basic **

 #define WLN_RESET_MODE 1 'there will be no dedicated reset, and all other lines are fixed
 #define WLN_CLK PL_IO_NUM_14
 #define WLN_CS PL_IO_NUM_15
 #define WLN_DI PL_IO_NUM_12
 #define WLN_DO PL_IO_NUM_13
 #define WLN_RST PL_IO_NUM_11
 'EM1000, NB1010,...
 #define WLN_CLK PL_IO_NUM_53
 #define WLN_CS PL_IO_NUM_49
 #define WLN_DI PL_IO_NUM_52
 #define WLN_DO PL_IO_NUM_50
 #define WLN_RST PL_IO_NUM_51

  1. Add include "wln\trunk\wln.tbh" to the includes section of the global.tbh file.
  2. Add wln_proc_timer() to the on_sys_timer() event handler code (this library assumes that this event is generated twice per second).
  3. Add wln_proc_data() to the on_sock_data_arrival() event handler code.
  4. Add wln_proc_task_complete() to the on_wln_task_complete() event handler code. Pass completed_task argument of on_wln_task_complete() directly to wln_proc_task_complete().
  5. Add wln_proc_event() to the on_wln_event() event handler code. Pass wln_event argument of on_wln_event() directly to wln_proc_event().
  6. Create empty callback function bodies (presumably in device.tbs): callback_wln_ok(), callback_wln_failure(), callback_wln_pre_buffrq(), callback_wln_rescan_result().  Hint: copy from declarations in wln.tbh or from our code example.
  7. Add ga1000fw.bin file to your project. This is the firmware file for the GA1000 Wi-Fi add-on module. You can get it at
  8. Call wln_start() from somewhere. The no-brainer decision is to call from the on_sys_init() event handler. Note that wln_start() may fail, so it is wise to check the returned status code.

All of the above is illustrated in a code example.

If you are going to use WPA/WPA2 security

  1. Add #define WLN_WPA 1 to the defines section of the global.tbh file.
  2. Add an empty callback function body (presumably in device.tbs) for callback_wln_mkey_progress_update().
  3. Use wln_wpa_mkey_get() to calculate a pre-shared master key, which is required for WPA/WPA2 security. Assign this function's output result to the key argument of the wln_start() function.


Wln_wpa_mkey_get() takes up to two minutes to complete. Trying WPA code example not only shows how to  deal with WPA/WPA2, but also how to avoid calculating the pre-shared master key repeatedly.