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

David Whale david at thinkingbinaries.com
Mon Nov 21 05:02:44 EST 2016


How did you connect the two micro:bits and transfer data between them?
Could you send a wiring diagram we can look at?

As Damien says, the SPI on the micro:bit is master only, so it will be
generating the clock. If you have two micro:bits, then you have two devices
generating a clock. I can't really see how you managed to get this to work
at all?

Thanks

David


On 21 November 2016 at 09:33, M.-A. Lemburg <mal at egenix.com> wrote:

> On 20.11.2016 18:21, Radomir Dopieralski wrote:
> > 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).
>
> We made sure that both ESP and MB were using SPI mode 0
> in software. Of course, it's possible that the hardware
> was still using different modes and this could explain
> the unreliable transmissions.
>
> This would then hint at a software bug somewhere.
>
> We did not look into this at depth using an analyzer.
>
> The fact that connecting two MBs using SPI did not result
> in such unreliable transmission would also hint at an
> incompatibility at the SPI mode level.
>
>
> > 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,
> >
>
> --
> 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/
>
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/microbit/attachments/20161121/f38a62cf/attachment.html>


More information about the Microbit mailing list