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

  • The nature of SPI is an SPI master can talk to only one Slave device at a time. However the nRF8001 does not have any real time requirements and you can access the SPI when you do have the time after the WiFi has finished the SPI access, this should be workable. If you do require simultaneous BLE and WiFi access on the SPI you can use 3 additional GPIOs on your mcu to implement a software based SPI master and then use the nRF8001 and WiFi on 2 different SPI masters on different pins.

Reply
  • The nature of SPI is an SPI master can talk to only one Slave device at a time. However the nRF8001 does not have any real time requirements and you can access the SPI when you do have the time after the WiFi has finished the SPI access, this should be workable. If you do require simultaneous BLE and WiFi access on the SPI you can use 3 additional GPIOs on your mcu to implement a software based SPI master and then use the nRF8001 and WiFi on 2 different SPI masters on different pins.

Children
No Data
Related