updated code for nRF Connect SDK v2.8.0
This commit is contained in:
@@ -15,7 +15,7 @@ It has been tested on the nRF5340 Audio DK, but it should work with any nRF5340
|
||||
### HCI over USB CDC
|
||||
|
||||
```sh
|
||||
west build -b nrf5340dk_nrf5340_cpuapp -- -DEXTRA_DTC_OVERLAY_FILE=usb.overlay -DOVERLAY_CONFIG=overlay-usb.conf
|
||||
west build -b nrf5340dk/nrf5340/cpuapp -- -DEXTRA_DTC_OVERLAY_FILE=usb.overlay -DOVERLAY_CONFIG=overlay-usb.conf
|
||||
```
|
||||
_HCI over UART and timesync not tested._
|
||||
|
||||
@@ -25,7 +25,7 @@ _HCI over UART and timesync not tested._
|
||||
### HCI over USB CDC
|
||||
|
||||
```sh
|
||||
west build -b nrf5340_audio_dk_nrf5340_cpuapp -- -DEXTRA_DTC_OVERLAY_FILE=usb.overlay -DOVERLAY_CONFIG=overlay-usb.conf
|
||||
west build -b nrf5340_audio_dk/nrf5340/cpuapp -- -DEXTRA_DTC_OVERLAY_FILE=usb.overlay -DOVERLAY_CONFIG=overlay-usb.conf
|
||||
```
|
||||
|
||||
### HCI over UART 0 connected to Virtual UART in J-Link Probe
|
||||
@@ -38,12 +38,12 @@ west build -b nrf5340_audio_dk_nrf5340_cpuapp
|
||||
|
||||
Release build:
|
||||
```sh
|
||||
west build -b nrf5340_audio_dk_nrf5340_cpuapp -- -DEXTRA_DTC_OVERLAY_FILE=uart1.overlay
|
||||
west build -b nrf5340_audio_dk/nrf5340/cpuapp -- -DEXTRA_DTC_OVERLAY_FILE=uart1.overlay
|
||||
```
|
||||
|
||||
Debug build:
|
||||
```sh
|
||||
west build -b nrf5340_audio_dk_nrf5340_cpuapp -- -DEXTRA_DTC_OVERLAY_FILE=uart1.overlay -DOVERLAY_CONFIG=debug.conf
|
||||
west build -b nrf5340_audio_dk/nrf5340/cpuapp -- -DEXTRA_DTC_OVERLAY_FILE=uart1.overlay -DOVERLAY_CONFIG=debug.conf
|
||||
```
|
||||
|
||||
To use UART 1 via Arduino headers, the virtual UART of the J-Link probe needs to be disabled, e.g. with the JLink Configuration Tool.
|
||||
|
||||
+11
-11
@@ -24,7 +24,7 @@
|
||||
|
||||
#include <zephyr/usb/usb_device.h>
|
||||
|
||||
#include <zephyr/net/buf.h>
|
||||
#include <zephyr/net_buf.h>
|
||||
#include <zephyr/bluetooth/bluetooth.h>
|
||||
#include <zephyr/bluetooth/l2cap.h>
|
||||
#include <zephyr/bluetooth/hci.h>
|
||||
@@ -184,7 +184,7 @@ static void rx_isr(void)
|
||||
if (remaining == 0) {
|
||||
/* Packet received */
|
||||
LOG_DBG("putting RX packet in queue.");
|
||||
net_buf_put(&tx_queue, buf);
|
||||
k_fifo_put(&tx_queue, buf);
|
||||
state = ST_IDLE;
|
||||
}
|
||||
break;
|
||||
@@ -217,7 +217,7 @@ static void tx_isr(void)
|
||||
int len;
|
||||
|
||||
if (!buf) {
|
||||
buf = net_buf_get(&uart_tx_queue, K_NO_WAIT);
|
||||
buf = k_fifo_get(&uart_tx_queue, K_NO_WAIT);
|
||||
if (!buf) {
|
||||
uart_irq_tx_disable(hci_uart_dev);
|
||||
return;
|
||||
@@ -258,15 +258,15 @@ static void tx_thread(void *p1, void *p2, void *p3)
|
||||
int err;
|
||||
|
||||
/* Wait until a buffer is available */
|
||||
buf = net_buf_get(&tx_queue, K_FOREVER);
|
||||
buf = k_fifo_get(&tx_queue, K_FOREVER);
|
||||
/* Pass buffer to the stack */
|
||||
err = bt_send(buf);
|
||||
if (err!=BT_HCI_ERR_SUCCESS) {
|
||||
if (err!=BT_HCI_ERR_EXT_HANDLED) {
|
||||
LOG_ERR("Unable to send (err %d)", err);
|
||||
if (err!=BT_HCI_ERR_SUCCESS) {
|
||||
if (err!=BT_HCI_ERR_EXT_HANDLED) {
|
||||
LOG_ERR("Unable to send (err %d)", err);
|
||||
}
|
||||
net_buf_unref(buf);
|
||||
}
|
||||
net_buf_unref(buf);
|
||||
}
|
||||
|
||||
/* Give other threads a chance to run if tx_queue keeps getting
|
||||
* new data all the time.
|
||||
@@ -280,7 +280,7 @@ static int h4_send(struct net_buf *buf)
|
||||
LOG_DBG("buf %p type %u len %u", buf, bt_buf_get_type(buf),
|
||||
buf->len);
|
||||
|
||||
net_buf_put(&uart_tx_queue, buf);
|
||||
k_fifo_put(&uart_tx_queue, buf);
|
||||
uart_irq_tx_enable(hci_uart_dev);
|
||||
|
||||
return 0;
|
||||
@@ -531,7 +531,7 @@ int main(void)
|
||||
while (1) {
|
||||
struct net_buf *buf;
|
||||
|
||||
buf = net_buf_get(&rx_queue, K_FOREVER);
|
||||
buf = k_fifo_get(&rx_queue, K_FOREVER);
|
||||
err = h4_send(buf);
|
||||
if (err) {
|
||||
LOG_ERR("Failed to send");
|
||||
|
||||
Reference in New Issue
Block a user