This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Merging Custom Service BLE project with SPI project

Hi, I made a simple diagram of what my device should do:

The nRF52840 should receive data via SPI from another controller, mathematically process this data, and output result to an external DAC via SPI.

Data processing includes some parameters, which are fix in calculations, but need to be chainged occassionally via bluetooth from a mobile phone application.

I am new to Nordic bluetooth controllers, and Segger studio as well. But I managed so far to achieve:

* the SPI chain data processing with fixed parameters in one project (by combining spis and spim peripheral example projects) and

* the BLE peripheral with custom service (receiving parameters from a mobile phone app, by adding custom service to BLE Peripheral template examle) in another project.

The problem is: I have no idea how to merge these two projects.

I tried analyzing ble uart example, but it is a console-like app, streaming data. I need SPIs with math to work constantly, while in the same time SoftDevice advertizes. When a connection with mobile phone is established, it should stop data processing, take new params, and start data processing again after disconnection.

I would appretiate any help, example or reading suggestion.

Parents
  • Hi,

    There is very little overlap between a SPI example and a BLE example, so merging them should be quite straightforward. However, you should remember to start with the BLE example as the basis, as that use the SoftDevice and is typically most complex.

    The nRF52840 only have on CPU, so there are some limitations on what it can do simultaneously. Both the SPI and RADIO peripherals have DMA, but CPU is needed to set up communication etc, and in your case I assume a lot of CPU time is needed to do the math you mentioned. However, the SoftDevice will need the CPU regularly, and it will block the application from using the CPU during that times.  You should refer to Bluetooth Low Energy processor usage patterns for details.

Reply
  • Hi,

    There is very little overlap between a SPI example and a BLE example, so merging them should be quite straightforward. However, you should remember to start with the BLE example as the basis, as that use the SoftDevice and is typically most complex.

    The nRF52840 only have on CPU, so there are some limitations on what it can do simultaneously. Both the SPI and RADIO peripherals have DMA, but CPU is needed to set up communication etc, and in your case I assume a lot of CPU time is needed to do the math you mentioned. However, the SoftDevice will need the CPU regularly, and it will block the application from using the CPU during that times.  You should refer to Bluetooth Low Energy processor usage patterns for details.

Children
No Data
Related