Skip to content
Permalink
Browse files

drivers: bluetooth: hci: spi: Handle when the buffer is empty

Check if the buffer size is not empty before spi transceive and buffer's
data processing. This fixes the need to slow down MCUs to 16MHz when
using BlueNRG-MS chips.
Tested samples : Beacon, Central, Peripheral

Signed-off-by: Yaël Boutreux <yael.boutreux@st.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
  • Loading branch information...
yboutreux authored and nashif committed Jul 3, 2019
1 parent d44f631 commit 3704e8b8b4cb9787049e13a9dac969bef4aff0c3
Showing with 6 additions and 5 deletions.
  1. +6 −5 drivers/bluetooth/hci/spi.c
@@ -326,9 +326,8 @@ static void bt_spi_rx_thread(void)
header_slave[STATUS_HEADER_TOREAD] == 0xFF) &&
!ret)) && exit_irq_high_loop());

if (!ret) {
size = header_slave[STATUS_HEADER_TOREAD];

size = header_slave[STATUS_HEADER_TOREAD];
if (!ret || size != 0) {
do {
ret = bt_spi_transceive(&txmsg, size,
&rxmsg, size);
@@ -339,8 +338,10 @@ static void bt_spi_rx_thread(void)
gpio_pin_enable_callback(irq_dev, GPIO_IRQ_PIN);
k_sem_give(&sem_busy);

if (ret) {
BT_ERR("Error %d", ret);
if (ret || size == 0) {
if (ret) {
BT_ERR("Error %d", ret);
}
continue;
}

0 comments on commit 3704e8b

Please sign in to comment.
You can’t perform that action at this time.