[Microbit-Python] SPI APIs on BBC micro:bit and ESP8266

M.-A. Lemburg mal at egenix.com
Mon Nov 21 06:44:38 EST 2016


On 21.11.2016 11:01, Radomir Dopieralski wrote:
> On Mon, 21 Nov 2016 10:53:36 +0100
> "M.-A. Lemburg" <mal at egenix.com> wrote:
> 
>> Since both devices were running in SPI master mode, we simply
>> crossed the MISO and MOSI cables, connecting MISO on the
>> ESP to MOSI on the MB and vice-versa. We also pulled down
>> the chip select pin on the ESP to GND using a 4.7k resistor.
>> The MB doesn't expose this pin.
> 
> This won't work. If you do that, each of the boards will completely
> ignore the other board's clock, and just spew data at its own pace.
> It may (unreliably) work when using two identical boards, as they are
> likely to have similar clocks, however, even that will go out of sync
> eventually. With completely different boards, such as the Micro:bit and
> the ESP8266, and with the clock speeds set with limited precision (the
> prescaler for the clock has only so much resolution), you are very
> unlikely to get any synchronisation at all.

Ah, now that explains what we were seeing :-)

Thanks for the explanation.

> You could try using NodeMCU on the ESP8266, it has an I2C slave
> implemented.

Hmm, that would mean programming LUA... I'd rather stay with
MicroPython, if possible :-)

Looking at the mbed sources for SPI, the blocking appears to
be a result of their API implementation:

https://developer.mbed.org/users/mbed_official/code/mbed-src/file/a11c0372f0ba/hal/spi_api.h

(even though it is only documented for the slave APIs)

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Nov 21 2016)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...           http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...           http://zope.egenix.com/
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/
                      http://www.malemburg.com/



More information about the Microbit mailing list