diff --git a/drivers/bluetooth/hci/hci_ambiq.c b/drivers/bluetooth/hci/hci_ambiq.c index 9428594980d..daaf943dca5 100644 --- a/drivers/bluetooth/hci/hci_ambiq.c +++ b/drivers/bluetooth/hci/hci_ambiq.c @@ -85,6 +85,18 @@ static inline int bt_spi_transceive(void *tx, uint32_t tx_len, void *rx, uint32_ spi_tx_buf.len = (size_t)tx_len; spi_rx_buf.buf = rx; spi_rx_buf.len = (size_t)rx_len; + + /* Before sending packet to controller the host needs to poll the status of + * controller to know it's ready, or before reading packets from controller + * the host needs to get the payload size of coming packets by sending specific + * command and putting the status or size to the rx buffer, the CS should be + * held at this moment to continue to send or receive packets. + */ + if (tx_len && rx_len) { + spi_cfg.operation |= SPI_HOLD_ON_CS; + } else { + spi_cfg.operation &= ~SPI_HOLD_ON_CS; + } return spi_transceive(spi_dev, &spi_cfg, &spi_tx, &spi_rx); }