How to Read ADXL362 values via SPI and Transmit them using Beacon Transmitter

Hello,

I have several PCB covering nRF52840 and ADXL362 accelerometer.
I'm trying to write a C code that reads ADXL362 values via SPI, and transmit them using Beacon Transmitter.
After programming nRF52840 chips with using ble_app_beacon example project in Segger Embedded Studio environment,
I have checked them using nRF Connect Android App and seen them with their addresses and names "nRF Beacon" as expected.

Here is my setup:
- nRF5 SDK v17.0.2
- Segger Embedded Studio
- Beacon Transmitter Sample Application (examples\ble_peripheral\ble_app_beacon)

Here is my main purpose:
- to write a C code that reads ADXL362 values using SPI, and transmit them using Beacon Transmitter.
- to write a Python 3 code reading those transmit values and doing other things.

I looked at related questions but I didn't find what I needed exactly.
I would be very happy if you could help.

Best regards.

  • I suggest you serch devzone for other posts about the adxl362, there are quite a few.

    The general method to interface with a sensor is to get the sensor manufacturer's driver and port it to whatever platform you're using(nRF52). The sensor drivers are usually written in a platform-agnostic way where all you need to do is to implement the serial driver API's in the sensor driver's R/W functions. 

    See SPIM driver API docs. 

    You should study the SPI example in the SDK first. 

  • Hello again, thank you for your reply.

    I think I could not really understand how to embed SPI (examples\peripheral\spi) into Beacon (examples\ble_peripheral\ble_app_beacon). Could you also inform and help me with that issue?

    Note that,

    - I searched other posts about ADXL362 already but I will search and study again deeply as you suggested.

    - I also studied SPI Master Example (examples\peripheral\spi) but I will also study SPIM driver API docs as you suggested.

    - I will also share my related code for helping people engaging same issues, if it would be successfully implemented.

    Best regards.

  • mucn said:
    I think I could not really understand how to embed SPI (examples\peripheral\spi) into Beacon (examples\ble_peripheral\ble_app_beacon). Could you also inform and help me with that issue?

    I suggest you make a copy of the SPIM example and modify that to talk to the ADX362, then merge this modified project into the beacon example.

  • Thank you for your suggestion, I will try that and notify updates for this post's followers if any :)

Related