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 was thinking of doing this,but in my case i have to use them parallelly. Lets say, wifi get the response after hitting the server and i have to send that response to MCU which then have to be transmitted to the iPhone through BLE. this i can do by using the chip select that when response comes select the BLE chip for SPI linesand transfer. But suppose when wifi is using the SPI lines and iPhone want to connect through BLE and want to send some data then how will i know in MCU that i have to give the SPI lines to BLE and start advertising it? This is where i am stucking.Do you have any idea how to solve this?WHen wifi is using the spi lines then how to make ble advertising?

    Thanks

Reply
  • Actually i was thinking of doing this,but in my case i have to use them parallelly. Lets say, wifi get the response after hitting the server and i have to send that response to MCU which then have to be transmitted to the iPhone through BLE. this i can do by using the chip select that when response comes select the BLE chip for SPI linesand transfer. But suppose when wifi is using the SPI lines and iPhone want to connect through BLE and want to send some data then how will i know in MCU that i have to give the SPI lines to BLE and start advertising it? This is where i am stucking.Do you have any idea how to solve this?WHen wifi is using the spi lines then how to make ble advertising?

    Thanks

Children
No Data
Related