SPI tutorial or notes anyone?


As yet there is no such tutorial on the bluz site. Does anyone have any notes on how to configure this (albeit rough)? My use case is to interface an SPI-based sensor to the world via BLE.

PS. correction: there is this http://docs.bluz.io/reference/spi/ which is most of what I need. Any other observations welcome.

Giving up 3 analog inputs may be a show-stopper though.


SPI is pretty standard so a lib for any particle based SPI device should work relatively easy to make work on the bluz. it is my preferred protocol, and i havent had too many issues, apart from chip manufacturers that don’t follow the protocol!

as for the inputs, all the IO on the Bluz are the same except for the analog inputs… so you could remap the SPI to some other pins… not sure where they are defined though… i thought they would be in the same place as TWI but i cant see it in there. @eric may have to help with that one. you would have to build local to change them though (i think, maybe they could be redefined before calling spi.begin???)


It is actually possibly to change the pins that are used for SPI. We defaulted to the same ones as the Core/Photon just for compatibility, but the peripheral can actually be assigned to any pins.

This isn’t changeable from the Web IDE yet as it can’t be done from the user app, but it can be done easily if you compile locally.


Thx both. Good news that we could use digital I/O for SPI and keep at least 6 analogue inputs. Even better if we could also allocate an input pin for a precision voltage reference for the ADCs.

Sounds like I need to get into local compilation. There’s quite a lot on the subject here Direct Bluetooth connection from App(No Particle Cloud) but it would be really nice to have some kind of tutorial on that. Any plans?

In terms of the chip’s capabilities I see a reference on http://bluz.io to the Nordic nrf51822 but the Bluz I have has the Raytac MDBT40. I have not seen any material differences. Correct?

I guess one option could be to fork the SPI library and give it some configurability, specifically to give SPI.begin() some pin assignments (like Arduino Due’s SPI library).

And if we went the local build route we’d need to understand how a field update should be done. Push binaries to Particle cloud? Incorporate flashing capability into our phone app? Other ways?


I need to update this for bluz, but there is a getting started guide for local firmware here: https://github.com/bluzDK/bluzDK-firmware/blob/develop/docs/gettingstarted.md

Basically, you can clone the repository (or fork it if you would like) and then you need the gcc arm compiler from here: https://launchpad.net/gcc-arm-embedded/+milestone/4.9-2015-q3-update

In the repository, navigate to the /modules/ folder and type:


That will compile the system part and the user part. You. Can then get them to bluz using any of the methods here: http://docs.bluz.io/tutorials/updates/#over-the-air

The SPI pins are defined here: https://github.com/bluzDK/bluzDK-firmware/blob/develop/platform/MCU/NRF51/SPARK_Firmware_Driver/inc/hw_layout.h#L37 just make sure to modify the M1 pins and not the M0 pins above it, those go to the SPI Flash.

We will modify this to be a little easier in the future.

As for the nrf51, the Raytac module is just a wrapper around the nrf51 that provides an antenna and other components, inside is the nrf51.

Let me know if you need anything else

Time.x() función not syncing time

Thx @eric, Looks like I have my work cut out. Let’s hope I can hold off paid work for a while :wink: