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

Failed to read/write ADXL362 data using nRF52840

Hello All,

I have connected nRF52840 with ADXL362 over SPI, and try to read/write data on "Power Control register".

The process I follow,

1. Rest ADXL362.

2. Write data 0x02 in "Power Control register" of ADXL362.

2. Read value of  "Power Control register" of ADXL362.

But every time I read data form ADXL362 I got 0x00 value.

Logs are attached.

For testing this I have modify SPI test code located at "nRF5_SDK_15.0.0_a53641a\examples\peripheral\spi"

Code is also attached here, will you please guide me, If I did any wrong in SPI configuration?

I am little bit confuse of "tx_buffer_length" & "rx_buffer_length" value passing in nrf_drv_spi_transfer() function.

Does the values of "tx_buffer_length" & "rx_buffer_length" are correct at line no 101 & 118 in main.c file?

Thanks in advance.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<info> app: #########################################################
<info> app: SPI example started.
<info> SPIM: Function: nrfx_spim_init, error code: NRF_SUCCESS.
<info> app: <---- ADXL325 reset ---->
<info> SPIM: Function: spim_xfer, error code: NRF_SUCCESS.
<debug> SPIM: Event: NRF_SPIM_EVENT_END.
<info> app: Transfer completed.
<info> app: 00 00 00 |...
<info> app: soft reset
<info> app: <--- ADXL325 set power control register --->
<info> SPIM: Function: spim_xfer, error code: NRF_SUCCESS.
<info> app: ** 0 0 0
<info> app: 00 00 |..
<info> app: Setting Measeurement Mode - Reg 2D before = 0
<debug> SPIM: Event: NRF_SPIM_EVENT_END.
<info> app: Transfer completed.
<info> app: 00 00 00 |...
<info> SPIM: Function: spim_xfer, error code: NRF_SUCCESS.
<debug> SPIM: Event: NRF_SPIM_EVENT_END.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
* Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
sdk_config.h