We use STM32L162xx MCU to communicate with S2_LP and SP_BTLE drivers via SPI.
With S2-LP, it returns the MC_STATE as READY during inital setup for power , sync word etc.
But when I Strobe the RX command it returns MC_STATE as LOCK_ST(0x14).
DMA is enabled for SPI tranfer and we user HAL_SPI_TransmitReceive_DMA(...) to clock out the bytes.
Similarly for SP_BTLE, As part of initialisation we perform hard reset followed by reading version from SP-BTLE chip:
s part of the BLE initialization, following a hard reset the firmware attempts to read the Version from SP-BTLE
- enable chip select (configured as active low)
- Write Send command(0x10) via SPI and receive a 2 byte response from chip (0x02 and 0x7f)
- Disable chip select (with Time delay)
- Enable chip select (with minimum delay)
- Send actual command to read version ogf = OGF_INFO_PARAM(0x0004), 0cf = OCF_READ_LOCAL_VERSION(0x0001)
- Disable chip select.
- Wait for interrupt event.
- enable chip select.
- Write Receive command(0x0b)via spi .
- Returns the number of bytes to be read back
- Disable and Enable Chip select with time delay(if I perform this routine , not receiving the correct data)
- Write command 0xFF to read the next set of bytes
- first response contains 6 bytes, with response type as HCI_EVENT_PKT and event set to EVT_VENDOR
- Disable chip select GoTo Step 8
- Second response contains 4 bytes , with response type as HCI_EVENT_PKT and event set to EVT_HARDWARE_ERROR(In this case when I compared with old code base the actual number of bytes to read should be 15 and the event should be set as EVT_CMD_COMPLETE
Based on the above observations , I suspect something isn't correct with SPI config . Could you provide any suggestions.