LairdCP / BL652-Applications

Laird Connectivity BL652 smartBASIC applications
ISC License
22 stars 20 forks source link

slave buffer is always empty #6

Open bilal11255 opened 6 years ago

bilal11255 commented 6 years ago

Hello Sir i am trying to read SPI slave data using example code (SpiSlaveRxBufferRead.sb) but when i read the buffer it is always empty and i get the message "No SPI slave data read". I have successfully get the other example (SpiSlaveTxBufferWrite.sb) working where SPI slave transmits the data and master SPI receives it. I am using an stm32f103 as SPI master. I am doing following steps, please let me know where i am making mistake.

  1. CS of bl652 (SPI slave) is driven high from stm32f103 (SPI master)
  2. Open SPI Slave Peripheral in bl652
  3. CS of bl652 (SPI slave) is driven low from stm32f103 (SPI master)
  4. data is sent from stm32f103 (SPI master) , i have seen the data on logic analyzer too to certify it is going to bl652 (SPI slave).
  5. CS of bl652 (SPI slave) is driven high from stm32f103 (SPI master)
  6. read SPI slave using SpiSlaveRxBufferRead. it always return an empty string i shall be thankful for your help. regards
youssif-am-saeed commented 6 years ago

Hi

Your sequence looks correct to me and this is similar to what we have done in our tests. I would say that it seems that you are either not sending data properly from the remote device, or that the SPI Slave is not configured properly for your hardware setup. Before starting any SPI slave operations, please ensure that SpiSlaveConfig() function is called to configure the appropriate CS, MISO, MOSI, and SCK pins (have a look at the Extensions guide, page 23).

I have also pushed an example to show how EVSPISLAVETXRX is used, but for that example to work you'll need a remote device and the correct configuration. If you have a spare BL652 devkit, then I recommend first trying to get an example to work where a BL652 SPI master is talking to a BL652 SPI Slave. This is what I did with the pushed example and I got it to work without any issue.

Finally, please direct your future questions to our support team via the support center. This GitHub repository is for hosting smartBASIC applications only and questions/inquiries are handled separately through our support team.

Youssif