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

Simple SPI code to verify an nrf52811 attached via SPI is functional (ie whoami..)

I have a new board with a STM32L47 running mbed OS. There is an nRF52811 connected via SPI.
I simply want to verify that the nRF52811 is connected properly and can be communicated to by sending some simple command
sequence over SPI and receiving data back that I can verify. I really don't want to pull in an SDK or library at this point.


I've used the RedBearLab SPI_Demo_nRF51822 to try and accomplish this and it does return some data. However it would appear the
demo is supposed to write something to the nRF52811 Flash and then read it back again. I don't get back what I wrote and I
assume that's because the Flash has not been erased. The demo gives no indication as to how to erase, or what in fact the data transmitted
to the device (ie. SPI1.transfer(0x84), SPI1.transfer(0xD1)) actually do. Are these commands, opcodes?

Can someone offer guidance on how to make this demo work, or a better way to simply query the device for some known info?
I know there is a temperature sensor, is there a SPI command sequence I can send to read that?
My code looks something like this:

char spi_tx1_test[] = {0x84,0,0,0,0x41,0x42};
char spi_tx1a_test[] = {0xD1,0,0,0,0x00,0x00};
count = spi_master_block_write(&pObj->ble, spi_tx1_test, 6, spi_rx_test, 6, 0xFF);
osDelay(100);
count = spi_master_block_write(&pObj->ble, spi_tx1a_test, 6, spi_rx_test, 6, 0xFF);
tr_info("\n\nBLE test 1 rx %x %x %x %x\n\n", spi_rx_test[0], spi_rx_test[1], spi_rx_test[2], spi_rx_test[3], spi_rx_test[4], spi_rx_test[5]);

Thank you!

Parents Reply Children
No Data
Related