0
votes

I have a project requiring a bluetooth chip (nrf8001) and an SPI flash memory module.

Prior to calling lib_aci_init, I can read and write the flash memory. After init, I cannot. Is there any reason the ACI lib would be disabling SPI for other devices?

1
What is aci_lib_init and where did you get it? A Google search for that term finds only this question.David Grayson
I know, its frustrating. It came with the Adafruit example code, you can get it here: github.com/adafruit/Adafruit_nRF8001/blob/master/utility/…. It handles the communication with the bluetooth device, I tell it which slave select, ready and reset pins to use, and it manages the device.Zack Newsham
In that code file, I see lib_aci_init, which is probably what you meant to type in this question.David Grayson
you are correct, I will fixZack Newsham
@DavidGrayson I've got a feeling it's these lines causing the issue: SPI.setBitOrder(LSBFIRST); SPI.setClockDivider(SPI_CLOCK_DIV8); SPI.setDataMode(SPI_MODE0);Zack Newsham

1 Answers

0
votes

The problem is that the SD card and the nrf8001 are both SPI devices, and the two libraries you are using both use the AVR's hardware SPI module to talk to them.

The function lib_aci_init calls hal_aci_tl_init which sets up the SPI for talking to the nrf8001 and those settings most likely conflict with the settings for the SD card. Even if they didn't conflict, you would have to use slave-select pins or something like that to avoid a conflict in the hardware.