4 years, 5 months ago.

BLE and SPI peripherals (on ble nano)

I am working on a project on the BLE nano. I need to get the UART ble to work so I can send commands to the device via ble. I also have a screen (adafruit_sharp_mem) which works with SPI and also a sensor on I2C.

I got it all working when using a custom gatt service to send 2 bytes of data instead of UART on ble. But when using the UART service everytime I connect to the device, it crashes.

It works well when I do not implement the display (spi).

I read multiple posts on this and I think it has to do with SPI collisions. So I need to wait for the ble not to be busy before sending something over SPI.

Suggestions in the ble nano forum are to use ble_busy(), but I can't find that function in the ble_api anywhere.

What to do?

Is it possible to initialise a second SPI bus for example?

Or is the problem within the UART service? I just need to be able to send a string of say 20 characters to the device.

Question relating to:

Bluetooth Low Energy (a.k.a Bluetooth LE, BTLE, Bluetooth Smart)

1 Answer

4 years, 5 months ago.

It can not default it's pin placement UART and concurrency of SPI / I2C.

Please check well the pin placement of the BLE Nano.

I think that it can by changing the pin placement of the UART or SPI / I2C.

GPIO can be assigned to any number.

[ Japanese ]


BLE Nanoのピン配置をよく確認してください。

UARTもしくはSPI / I2Cのピン配置を変更すれば出来ると思います。


See: http://static1.squarespace.com/static/5039e08be4b00cf0e8cf88cd/t/543f6b58e4b0847bb28660f8/1413442404211/?format=750w

I use D4-D5-D6 for SPI, D7-A5 for I2C So I leave the standard tx rx as is.

The BLE UART service does not really use pins, does it? It is wireless.

But the BLE somehow uses the SPI bus I think, or not? And if so, maybe it is using the same bus while I want to use the SPI for the display, and then it all goes wrong.

Here they say, use the ble_busy() for knowing when to safely use the SPI : https://redbearlab.zendesk.com/entries/83358655-Need-Help-with-BLE-Nano-and-SPI But maybe that is on the arduino platform and not the mbed?

Or am I looking in the wrong direction? I got it working with the 'BLE_GATT_EXAMPLE' but not with the BLE_NANO_FEEDBACK demo which uses UARTservice...

posted by Frits Jan van Kempen 19 Feb 2016