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

Can we change the SPI.bitOrder and SPI.dataMode while using nRF8001 BLE

Hi

I have a BLE module of nRF8001 chip and everything is working fine with it.In your Arduino compatible libraries for nRF 8001 you have a function hal_aci_tl_init() in which you set SPI for the chip. There you set SPI.setBitOrder(LSBFIRST) , SPI.setDataMode(SPI_MODE0) and clock speed.Now my question is can i change the bitOrder to MSBFIRST and DataMode to SPI_MODE1?

Actually i tried to do this this but BLE is not advertising then. How can i do this ,is there any way to use nRF8001 in MSBFIRST and SPI_MODE1?? I really need to do this because i am connecting a wifi shield also to my Arduino which again uses SPI pins for data transfer and that wifi shied works only on MSBFIRST and SPI_MODE1. How can i make nRF 8001 work on above specifications?

Thanks

Parents
  • nRF8001 will not operate on MSBIT first or at SPI mode 1, hower You should be able to share the SPI lines. in your case, you will need to set the SPI parameters for the WiFi when you want talk the to the WiFi SPI, when you want to talk to nRF8001 set the SPI parameters for nRF8001.

    You will have to use separate chip select lines and separate interrupt lines for the WiFi and the nRF8001. Only the MISO MOSI and SCK can be shared.

    As soon as you get a RDYN line low, set the nRF8001 SPI parameters for LSBIT and SPI MODE0 before you start the SPI. As soon as the nRF8001 SPI is finished you can set it back to the WiFi SPI settings of MSBIT and SPI MODE1

  • Actually i am advertising BLE first then i start wifi shield which takes control over Spi pins and successfully ping the server tehn i disconnect wifi and then again when i try init the ble to make it advertising again it actually do niot advertise. What i think is Wifi shield does not remove its hold from spi pins, if it has removed hold then init function of ble will have set spi according to its use and would have started advertising. How can i solve this?

Reply
  • Actually i am advertising BLE first then i start wifi shield which takes control over Spi pins and successfully ping the server tehn i disconnect wifi and then again when i try init the ble to make it advertising again it actually do niot advertise. What i think is Wifi shield does not remove its hold from spi pins, if it has removed hold then init function of ble will have set spi according to its use and would have started advertising. How can i solve this?

Children
No Data
Related