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

Radomir Dopieralski microbit at sheep.art.pl
Sun Nov 20 12:21:29 EST 2016


You sometimes get unreliable transmission if your use a different
spi mode than the device expects (it then reads the value from the
bus at the wrong moment, and can read it when it is changing).

On Sun, 20 Nov 2016 17:06:52 +0000
Nevil Hunt <nevil.hunt at hotmail.co.uk> wrote:

>  Marc-Andre,
> 
> 
> As regards...
> 
> 
> * the connection is rather unreliable: we had lots of data loss or
>   data corruption, with bytes not being transmitted or with lost bits
>   - we tried several different baud rates without success
> 
> 
> I'd certainly be interested if you can find out why.
> 
> I hooked a micro:bit up to a SPI RAM about a month ago and was able
> to write then read back from it, however it was a bit unreliable as
> sometimes the 'Reads' returned corrupted data.
> 
> From my recollection it looked like it was the 'Write' that was
> getting corrupted as repeated 'Reads' always returned the same
> corrupted data.
> 
> I used the 'Bus Pirate' to try and debug it but I wasn't able to
> determine whether it was a h/w or s/w problem...then I ran out of
> time and haven't returned to it!
> 
> I have however been in touch with Paul from Microsoft who has a
> micro:bit talking to an SD Card with s/w written in 'C' so it looks
> like the micro:bit SPI interface can be made to work!
> 
> 
> Cheers,
> 
> 
> Nevil
> 
> 
> ________________________________
> From: Microbit <microbit-bounces+nevil.hunt=hotmail.co.uk at python.org>
> on behalf of M.-A. Lemburg <mal at egenix.com> Sent: 20 November 2016
> 15:04 To: For Pythonic MicroBit related discussions
> Subject: [Microbit-Python] SPI APIs on BBC micro:bit and ESP8266
> 
> Hello,
> 
> over the weekend, we tried to get a connection from a BBC Microbit
> to an ESP8266, both running the latest MicroPython for the resp.
> platform, established via SPI.
> 
> We found several problems with this:
> 
> * the SPI APIs on the ESP8266 are all non-blocking and return
>   whatever is currently in the buffer (using 0x00 for missing data
>   and 0xff in case no connection is available)
> 
> * the SPI APIs on the Microbit are all blocking, only returning
>   if all data is sent / received
> 
> * the connection is rather unreliable: we had lots of data loss or
>   data corruption, with bytes not being transmitted or with lost bits
>   - we tried several different baud rates without success
> 
> On the plus side, we did get SPI to work fine between two Microbits,
> but that's not really what we were after, since we wanted to get
> one of the Microbits in our mesh network connected to a WLAN and
> work as gateway.
> 
> The blocking nature of the MB APIs make it difficult to write
> interfaces which aim at being fault tolerant and work as
> gateways. Having non-blocking versions would be better for this
> sort of application.
> 
> Are there better ways to connect MBs and ESP8266 ?
> 
> We also tried I2C, but gave up, since the pins on the MB for
> accessing I2C were too tiny to connect to without a breakout
> board.
> 
> BTW: We were impressed by the new radio module. Getting MBs
> to connect using these low level radios is really easy.
> 
> Cheers,

-- 
Radomir Dopieralski


More information about the Microbit mailing list