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

SPI example code for nRF51822 Eval Kit

Hi, I tried uploading the example code from \nrf6310\spi_master_example to nRF51822 evaluation kit board, but no matter what I do, I always get SPI error. Not compile or upload code error, but the actual SPI error.

I've set the ERROR_PIN_SPI0 to LED0 and ERROR_PIN_SPI0 to LED1, and both LED turns on when I run the code, which leads me to believe that the code is successfully compiled and uploaded, but the SPI is not working.

I've already changed the pin numbers on the spi_master_config.h for SS, MISO, MOSI and CLK to match the pins that connect to my SPI device (in my case, it's ADXL362 accelerometer, made by Analog Devices)

Also, I find it strange that there isn't any code for PCA10001 board regarding SPI. This makes me wonder if the code in \nrf6310\spi_master_example is actually usable or not for eval kit.

Parents
  • Hi,

    The spi_master_example in the SDK is a loopback example, meaning that it will send a sequence of data and expect the same data in return. If it does not receive the same data in return, it will return false and set the error LED. There's another SPI master example (spi_master_example_with_spi_slave) that works with the SPI Slave example in the SDK, if that is of interest.

    The SPI-examples will not work out-of-the-box with that sensor. You'll have to map up the register definitions for your specific accelerometer and use the SPI init/send/receive functions to communicate with the external sensor, as we do not have any examples for that specific accelerometer.

    Best regards Håkon

Reply
  • Hi,

    The spi_master_example in the SDK is a loopback example, meaning that it will send a sequence of data and expect the same data in return. If it does not receive the same data in return, it will return false and set the error LED. There's another SPI master example (spi_master_example_with_spi_slave) that works with the SPI Slave example in the SDK, if that is of interest.

    The SPI-examples will not work out-of-the-box with that sensor. You'll have to map up the register definitions for your specific accelerometer and use the SPI init/send/receive functions to communicate with the external sensor, as we do not have any examples for that specific accelerometer.

    Best regards Håkon

Children
No Data
Related