Difference between SPI and UART for HCI BLE

Hello everyone,

We are working on a new project and we will be using BLE over a HCI interface, and we are wondering what is the best HW interface for HCI. We do not have a fixed HW setup for now, and we are testing BLE HCI on a 9160DK which as far as I know supports lpuart HCI.

We would like to know if there is a clear difference between UART/LPUART and SPI speed, stability and low power wise ?

If you have any documentation on this matter I'll gladly dive into it

Thanks

  • Hello BCartier,

    Thank you for this interesting question. I will try to dig up some relevant material. Details regarding how much data and how often might be relevant as well as how the resources of your devices are in use by your application. A PPK2 could also be handy in order to test your specific use case.

    I am checking with the team for relevant material and experiences.

  • It looks like many of the points below are in favor of SPI.

    Pro SPI:

    • SPI is faster as it is a synchronous protocol.
    • SPI supports up to 8MHz.
    • UART is usually using 115200 but also works up to 1M.
    • UART is slower due to start and stop bits.
    • The run current for SPI and UART are not too different.
    • If, for example, SPI runs 10x faster than UART, current consumption will be roughly 10x less.
    • As UART is asynchronous one would need to run the HF clock from an external crystal to get good enough accuracy.
    • SPI has its own clock and should be stable as long as the signal lines can follow the speed. This requires testing.

    Pro UART:

    • SPI master must run the clock when receiving from slave. As long as this is implemented in the driver it should not be any problem
    • SPI requires four pins(if you are not already using SPI), UART can be implemented with two. However, if one would like to use UART in a low power application one would use two extra pins for flow control, in order to know when to turn off RX. So they require four pins each.
  • Hello helsing,

    Thanks for the detailed answer ! This seems to indicate we should try a SPI solution.

    As for our use cases, we will be using BLE over HCI with large amount of data:

    - Updating the 9160 through the HCI interface with mcumgr and SMP

    - BLE scans with multiple dozens of devices

    - Log extraction

    - Advertising (this should not be very demanding)

    In the current NCS version, HCI should work "out of the box" with UART/LPUART and SPI, right ?

  • Hi, and sorry for the delay.

    BCartier said:
    In the current NCS version, HCI should work "out of the box" with UART/LPUART and SPI, right ?

    Yes. Here is another case on the topic of using HCI between nRF5x and nRF9160 which points to the nRF9160: LTE Sensor Gateway sample. The lte_ble_gateway shows the steps for how to set up nRF9160 and hci_lpuart(assuming you are using an nRF5x device). You could test the gateway sample first and later it should not be too much work to move to SPI. The hci_spi sample demonstrates HCI SPI(on the Bluetooth side).

Related