Powering Down

Top  Previous  Next

In the Enabling Power topic, we have already explained that the Wi-Fi hardware has a power switch controlled by one of the GPIO lines of the EM1000 module. In the standard configuration, this is the GPIO #51. To cut the power to the Wi-Fi, set this line to HIGH. This, however, is not enough to bring down the Wi-Fi interface.

The Wi-Fi hardware is built on low-current CMOS process, and ICs of this type are know for being able to draw parasitic power from the interface lines. That is, in the absence of "real" power, the hardware can "steal" power from the EM1000 interface lines that output HIGH logical level. One such parasitic power source is the CS (chip select) line, which is HIGH when inactive. To make sure that the Wi-Fi does not continue to breathe through the CS line, disable the corresponding GPIO:

 

 

'kill the Wi-Fi

io.num=PL_IO_NUM_51

io.state=HIGH

io.num=PL_IO_NUM_49

io.enabled=NO

 

'wait 4 seconds before re-enabling the Wi-Fi!

 

 

The above example assumes that it is the GPIO line #49 that controls the CS input of the Wi-Fi hardware (this is the case when the Wi-Fi add-on is installed on top of the EM1000). Actually, any I/O line can be mapped to control the CS (naturally, it depends on the physical interconnection between the Wi-Fi module and the EM1000 as well).

When the Wi-Fi add-on goes offline, the wln object will detect this in a matter if milliseconds.