CC3000 wifi not coming up after cycling EN low/high

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
mischko
Posts: 18
Joined: Tue Feb 03, 2015 12:32 am

CC3000 wifi not coming up after cycling EN low/high

Post by mischko » Wed Feb 11, 2015 11:35 pm

I pull EN low after doing my network connection and send.
I'm doing this to reduce power consumption of the CC3000.
When I pull it high again, I can't get the CC3000 working again.
If I do not pull EN low, this works great but draws around 130mA.

Code:

print ("Setting up SPI and PINS")
SPI = pyb.SPI(2)
CS = pyb.Pin.board.Y5
EN = pyb.Pin.board.Y4
IRQ = pyb.Pin.board.Y3
while True:
print ("Initializing NIC")
nic = network.CC3K(SPI, CS, EN, IRQ)
print (nic.ifconfig())
print ("Connecting to WIFI")
nic.connect(WIFISSID, WIFIPWD)
while not nic.isconnected():
pyb.delay(50) #milliseconds
print (nic.ifconfig())
s = socket.socket()
print ("Connecting to Web server")
s.connect((SERVERADDR, SERVERPORT))
print ("Sending GET")
s.send('GET /temp?rm=mbr&t=%s&b=90 HTTP/1.0\r\n\r\n' % int(gettemp()))
print ("closing up for a while")
s.close()
print ("NIC disconnecting from WIFI")
nic.disconnect()
print ("Setting EN low")
EN.low()
print ("delaying")
pyb.delay(60000) # 60 seconds.
print ("Setting EN high")
EN.high()
pyb.delay(100) #milliseconds

Here are the run results:

Setting up SPI and PINS
Initializing NIC
('0.0.0.0', '0.0.0.0', '0.0.0.0', '0.0.0.0', '0.0.0.0', '00:00:00:00:00:00', '\\')
Connecting to WIFI
('192.168.0.12', '255.255.255.0', '192.168.0.1', '68.105.28.11', '192.168.0.1', '08:00:28:58:dd:2a', 'B4843F')
Connecting to Web server
Sending GET
closing up for a while
NIC disconnecting from WIFI
Setting EN low
delaying
Setting EN high
Initializing NIC
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tempclient.py", line 18, in <module>
OSError: failed to init CC3000 module

Can someone please explain the proper sequence of events to get the CC3000 back to a usable state after the delay?

User avatar
Frida
Posts: 45
Joined: Sat Jan 30, 2016 2:20 pm
Location: Middelfart, Denmark

Re: CC3000 wifi not coming up after cycling EN low/high

Post by Frida » Mon Feb 22, 2016 9:52 am

I have a strippet down example.
Notice I have put in:

Code: Select all

a=[('0.0.0.0')]
b=tuple(a)

EN.low()
pyb.udelay(250)

while (b == nic.ifconfig()[0:1]):
	print('...waiting...')
	pyb.delay(200)
At last you only need to set EN.low() at the end, because nic = network.CC3K(SPI, CS, EN, IRQ) will set it high.

Code: Select all

import network
import socket

a=[('0.0.0.0')]
b=tuple(a)

print ("Setting up SPI and PINS")
SPI = pyb.SPI(2)
CS = pyb.Pin.board.Y5
EN = pyb.Pin.board.Y4
IRQ = pyb.Pin.board.Y3
while (True):
	print ("Initializing NIC")
	EN.low()
	pyb.udelay(250)
	nic = network.CC3K(SPI, CS, EN, IRQ)
	print (nic.ifconfig())
	print ("Connecting to WIFI")
	nic.connect(WIFISSID, WIFIPWD)
	while (b == nic.ifconfig()[0:1]):
		print('...waiting...')
		pyb.delay(200)
	print(nic.ifconfig())
	s = socket.socket()
	print ("Connecting to Web server")
	
	print ("closing up for a while")
	s.close()
	nic.disconnect()
	print ("Setting EN low")
	EN.low()
	pyb.LED(4).on()
	print ("delaying")
	pyb.delay(10000)
	pyb.LED(4).off()
	print('')
Yes Frida is my watchdog!

Post Reply