Applying a Hardware Reset

Once the RST line has been properly configured, you can reset the GA1000 or WA2000 at any time by executing the simple code shown below. Note that the Wi-Fi module has to be reset in the beginning. The proper hardware reset is not optional!

A tip note icon.When using the WM2000 or WS1102, a hardware reset is not required for proper operation after configuration is complete. As they are natively wireless devices, a hardware reset would mean rebooting the entire device.

If your design has no general-purpose I/O (GPIO) line to spare, the reset signal can be derived from the combination of CS and CLK line signals (see Connecting GA1000 and WA2000, diagram B). When there is a dedicated RST line, this line is manipulated directly.

The RST line is active LOW. The WA2000 requires the reset pulse to be at least 1ms long. The GA1000 doesn't care how short the reset pulse is (within the range that you can achieve on Tibbo devices). The code below takes care of the reset for both Wi-Fi modules and on all platforms.

Notice also the while...wend loop. It is there for the proper module reset after it has already been up and running. When the hardware reset is applied, the GA1000 or WA2000 will go offline and the wln. object will detect this in a matter of milliseconds. Your program should not try to work with the wln. object again until the wln.enabled property goes to 0 — NO in response to the hardware reset. Your code can stay and wait for this (as shown below) or rely on the on_wln_event(PL_WLN_EVENT_DISABLED) event handler. Once the event is triggered, you are free to repeat the whole process of bringing up Wi-Fi interface.

Tibbo BASIC
	'----- reset Wi-Fi module -----
	#If WLN_RESET_MODE 
		'reset is controlled by the combination of CS and CLK		
		io.lineset(wln.csmap,HIGH)
		io.lineset(wln.clkmap,LOW)
		io.lineset(wln.clkmap,HIGH)
	#Else	
		'there is a dedicated reset line		
		io.num=WLN_RST
		io.state=LOW
		'The WA2000 requires a longer reset pulse (1ms), and the GA1000 will not mind it
		'32-bit platforms offers a convenient sys.timercountms method
		'Since the WA2000 only works on 32-bit platforms, let's write the code like this:
		#if PLATFORM_TYPE_32
			sys.timercountms=0
			while sys.timercountms<1
			wend
		#endif
		io.state=HIGH
	#endif
	
	'in case we called wln_init() after it has already been up and running
	While wln.enabled=YES
	Wend