SPI with PullUp?

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

SPI with PullUp?

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

I'm experiencing this problem with my CC3000:

http://e2e.ti.com/support/wireless_conn ... 20/1031838

It says in the discussions that the IRQ and DataOutput should be pulled up during idle to prevent this.

I see in the docs that I can initialize a GPIO with PullUp enabled. I don't see how to do that with SPI.

It would be VERY nice if the c3000 library had a sleep() and wakeup() function that took care of all this correctly (see my other post http://forum.micropython.org/viewtopic.php?f=6&t=543)

Scott

spaceman_spiff
Posts: 2
Joined: Wed Feb 11, 2015 9:57 pm

Re: SPI with PullUp?

Post by spaceman_spiff » Thu Feb 12, 2015 2:07 am

Scott, have you tried

Code: Select all

pin.init(Pin.AF_PP, pull=Pin.PULL_UP, af=Pin.AF5_SPI1)
? I got the

Code: Select all

Pin.AF5_SPI1
value from running

Code: Select all

pin.p.af_list()
on the appropriate pin (X8 for SPI1 MOSI). I'm not sure if the pull-up and SPI output modes are compatible, but it's worth a try.

M

blmorris
Posts: 348
Joined: Fri May 02, 2014 3:43 pm
Location: Massachusetts, USA

Re: SPI with PullUp?

Post by blmorris » Fri Feb 13, 2015 2:44 am

To add to spaceman_spiff's reply-
The IRQ line isn't specifically part of SPI, so the CC3K driver probably configures it as an external interrupt pin. In theory an external interrupt input pin can be initialized with pull-ups or pull-downs enabled. Since the CC3K driver is in C rather than Python you may need to hack the C source to make sure it gets initialized with the pull-up enabled. The Data Output pin, OTOH, is the SPI MISO (master in slave out) and is initialized as an AF (alternate function) pin so you may not have any control over whether pull-ups are enabled.
You can still fix this in hardware by adding pull-up resistors yourself - just connect a large (~10K to ~100K) value resistor from each pin to 3.3V and you have your pull-ups.
At any rate, it seems like a quirk in the CC3000 hardware to require this.
-Bryan

Post Reply