mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-30 16:20:24 +00:00
da14581: add posix port for DA14585 and list in chipsets and ports
This commit is contained in:
parent
853a352a3e
commit
ecde56a6a0
@ -57,7 +57,8 @@ No build server | [wiced-h5](https://github.com/bluekitchen/btstack/tree/develop
|
||||
Status | Port | Platform
|
||||
-------------------| ------|---------
|
||||
[<img src="http://buildbot.bluekitchen-gmbh.com/btstack/badges/port-posix-h4-develop.svg">](https://buildbot.bluekitchen-gmbh.com/btstack/#/builders/port-posix-h4-develop) | [posix-h4](https://github.com/bluekitchen/btstack/tree/develop/port/posix-h4) | Unix-based system connected to Bluetooth module via H4 over serial port
|
||||
No build server | [posix-h4-da14581](https://github.com/bluekitchen/btstack/tree/develop/port/posix-h4-da14581) | Unix-based system connected to Dialog Semiconductor DA14581 via H4 over serial port
|
||||
No build server | [posix-h4-da14581](https://github.com/bluekitchen/btstack/tree/develop/port/posix-h4-da14581) | Unix-based system connected to Dialog Semiconductor DA14581 via H4 over serial port
|
||||
No build server | [posix-h4-da14585](https://github.com/bluekitchen/btstack/tree/develop/port/posix-h4-da14585) | Unix-based system connected to Dialog Semiconductor DA14585 via H4 over serial port
|
||||
No build server | [posix-h5](https://github.com/bluekitchen/btstack/tree/develop/port/posix-h5) | Unix-based system connected to Bluetooth module via H5 over serial port
|
||||
No build server | [posix-h5-bcm](https://github.com/bluekitchen/btstack/tree/develop/port/posix-h5) | Unix-based system connected to Broadcom/Cypress Bluetooth module via H5 over serial port
|
||||
[<img src="http://buildbot.bluekitchen-gmbh.com/btstack/badges/port-libusb-develop.svg">](https://buildbot.bluekitchen-gmbh.com/btstack/#/builders/port-libusb-develop) | [libusb](https://github.com/bluekitchen/btstack/tree/develop/port/libusb) | Unix-based system with dedicated USB Bluetooth dongle
|
||||
@ -79,7 +80,7 @@ Broadcom USB Dongles | Dual mode | USB | Yes |
|
||||
CSR UART | Dual mode | H4, H5, BCSP | No (didn't work) | csr |
|
||||
CSR USB Dongles | Dual mode | USB | Yes | csr |
|
||||
Cypress CYW20704 | Dual mode | H4, H5, USB | Probably | bcm |
|
||||
Dialog Semiconductor DA14581 | LE | H4, SPI | n.a. | da14581 | Official HCI firmware used
|
||||
Dialog Semiconductor DA14581, DA14585 | LE | H4, SPI | n.a. | da14581 | Official HCI firmware used
|
||||
Espressif ESP32 | Dual mode | VHCI | Not yet | | SoC with Bluetooth and Wifi
|
||||
EM 9301, 9304 | LE | SPI | n.a. | em9301 | Custom HCI SPI implementation
|
||||
Nordic nRF | LE | H4 | n.a. | | Requires custom HCI firmware
|
||||
|
@ -60,6 +60,7 @@ CSR UART | Dual mode | H4, H5, BCSP | Rarely | No (didn't wo
|
||||
CSR USB Dongles | Dual mode | USB | Mostly | Yes | No | No | csr |
|
||||
Cypress CYW20704 | Dual mode | H4, H5, USB | Don't know | Probably (2) | Yes | Yes | bcm |
|
||||
Dialog DA14581 | LE | H4, SPI | No | n.a. | No | No | da14581 | Official HCI firmware included in BTstack
|
||||
Dialog DA14585 | LE | H4, SPI | No | n.a. | Yes | Yes | da14581 | Official HCI firmware included in BTstack
|
||||
Espressif ESP32 | Dual mode | VHCI | Yes | Not yet | Yes | Yes | | SoC with Bluetooth and Wifi
|
||||
EM 9301 | LE | SPI, H4 | No | n.a. | No | No | em9301 | Custom HCI SPI implementation
|
||||
EM 9304 | LE | SPI, H4 | Yes | n.a. | Yes | Yes | em9301 | Custom HCI SPI implementation
|
||||
@ -140,6 +141,8 @@ Dialog Semiconductor offers the DA14581, an LE-only SoC that can be programmed w
|
||||
|
||||
It does not implement the Data Length Extension or supports multiple concurrent roles.
|
||||
|
||||
The newer DA14585 uses the same firmware upload mechanism as the 581 model. In addition, it supports both Data Length Extension as well as multiple concurrent roles.
|
||||
|
||||
**BD Addr** fixed to 80:EA:CA:00:00:01. No command in HCI firmware to set it differently. Random addresses could be used instead.
|
||||
|
||||
**Baud rate**: The baud rate is fixed at 115200 with the provided firmware. A higher baud rate could be achieved by re-compiling the HCI firmware using Dialog's HCI SDK.
|
||||
|
1
port/posix-h4-da14581/.gitignore
vendored
1
port/posix-h4-da14581/.gitignore
vendored
@ -48,3 +48,4 @@ pbap_client_demo
|
||||
sm_pairing_central
|
||||
sm_pairing_peripheral
|
||||
|
||||
att_delayed_read_response.h
|
||||
|
51
port/posix-h4-da14585/.gitignore
vendored
Normal file
51
port/posix-h4-da14585/.gitignore
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
ancs_client_demo
|
||||
ancs_client_demo.h
|
||||
ble_central_test
|
||||
ble_peripheral
|
||||
ble_peripheral_sm_minimal
|
||||
ble_peripheral_test
|
||||
bluetooth_init_cc2560_2.44.c
|
||||
bluetooth_init_cc2560a_2.14.c
|
||||
bluetooth_init_cc2560B_1.2_BT_Spec_4.0.c
|
||||
bluetooth_init_cc2564_2.14.c
|
||||
bluetooth_init_cc2564B_1.2_BT_Spec_4.0.c
|
||||
bnep_test
|
||||
classic_test
|
||||
gap_dedicated_bonding
|
||||
gap_inquiry
|
||||
gap_inquiry_and_bond
|
||||
gap_le_advertisements
|
||||
gatt_battery_query
|
||||
gatt_browser
|
||||
hfp_ag_demo
|
||||
hfp_hf_demo
|
||||
hsp_ag_demo
|
||||
hsp_ag_test
|
||||
hsp_hs_demo
|
||||
hsp_hs_test
|
||||
l2cap_test
|
||||
le_counter
|
||||
le_counter.h
|
||||
le_streamer
|
||||
le_streamer.h
|
||||
led_counter
|
||||
profile.h
|
||||
sco_input.wav
|
||||
sdp_bnep_query
|
||||
sdp_general_query
|
||||
sdp_rfcomm_query
|
||||
sm_pairing_peripheral.h
|
||||
spp_and_le_counter
|
||||
spp_and_le_counter.h
|
||||
spp_counter
|
||||
spp_streamer
|
||||
TIInit_12.10.28.c
|
||||
TIInit_12.8.32.c
|
||||
gatt_battery_query.h
|
||||
gatt_browser.h
|
||||
le_streamer_client
|
||||
pbap_client_demo
|
||||
sm_pairing_central
|
||||
sm_pairing_peripheral
|
||||
|
||||
att_delayed_read_response.h
|
46
port/posix-h4-da14585/Makefile
Normal file
46
port/posix-h4-da14585/Makefile
Normal file
@ -0,0 +1,46 @@
|
||||
# Makefile for libusb based examples
|
||||
BTSTACK_ROOT = ../..
|
||||
|
||||
CORE += \
|
||||
btstack_chipset_da14581.c \
|
||||
btstack_link_key_db_fs.c \
|
||||
btstack_run_loop_posix.c \
|
||||
btstack_uart_block_posix.c \
|
||||
hci_transport_h4.c \
|
||||
le_device_db_fs.c \
|
||||
main.c \
|
||||
wav_util.c \
|
||||
btstack_stdin_posix.c \
|
||||
hci_585.c \
|
||||
# hci_581_active_uart.c \
|
||||
|
||||
# examples
|
||||
include ${BTSTACK_ROOT}/example/Makefile.inc
|
||||
|
||||
CFLAGS += -g -Wall -Werror \
|
||||
-I$(BTSTACK_ROOT)/platform/posix \
|
||||
-I$(BTSTACK_ROOT)/chipset/da14581 \
|
||||
-I$(BTSTACK_ROOT)/platform/embedded \
|
||||
-I${BTSTACK_ROOT}/3rd-party/tinydir
|
||||
|
||||
VPATH += ${BTSTACK_ROOT}/platform/posix
|
||||
VPATH += ${BTSTACK_ROOT}/chipset/da14581
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
LDFLAGS += -lws2_32
|
||||
endif
|
||||
|
||||
# Command Line examples require porting to win32, so only build on other unix-ish hosts
|
||||
ifneq ($(OS),Windows_NT)
|
||||
EXAMPLES += ${EXAMPLES_CLI}
|
||||
endif
|
||||
|
||||
# use pkg-config for portaudio
|
||||
# CFLAGS += $(shell pkg-config portaudio-2.0 --cflags) -DHAVE_PORTAUDIO
|
||||
# LDFLAGS += $(shell pkg-config portaudio-2.0 --libs)
|
||||
# hard coded flags for portaudio in /usr/local/lib
|
||||
# CFLAGS += -I/usr/local/include -DHAVE_PORTAUDIO
|
||||
# LDFLAGS += -L/sw/lib -lportaudio -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,Carbon
|
||||
|
||||
all: ${EXAMPLES}
|
||||
|
11
port/posix-h4-da14585/README.md
Normal file
11
port/posix-h4-da14585/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# POSIX H4 Port for Dialog Semiconductor DA14581
|
||||
|
||||
This port allows to use the DA14581 connected via UART with BTstack running on a POSIX host system.
|
||||
|
||||
It first downloads the hci_581_active_uart.hex firmware from the DA14581_HCI_3.110.2.12 SDK packet, before BTstack starts up.
|
||||
|
||||
Please note that it does not detect if the firmware has already been downloaded, so you need to reset the DA14581 before starting an example.
|
||||
|
||||
For production use, the HCI firmware could be flashed into the OTP and the firmware download could be skipped.
|
||||
|
||||
Tested with the official DA14581 Dev Kit on OS X.
|
35
port/posix-h4-da14585/btstack_config.h
Normal file
35
port/posix-h4-da14585/btstack_config.h
Normal file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// btstack_config.h for generic POSIX H4 port
|
||||
//
|
||||
|
||||
#ifndef __BTSTACK_CONFIG
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// Port related features
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_BTSTACK_STDIN
|
||||
#define HAVE_POSIX_TIME
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_CLASSIC
|
||||
#define ENABLE_HFP_WIDE_BAND_SPEECH
|
||||
#define ENABLE_LE_CENTRAL
|
||||
#define ENABLE_LE_PERIPHERAL
|
||||
#define ENABLE_LE_SECURE_CONNECTIONS
|
||||
#define ENABLE_MICRO_ECC_FOR_LE_SECURE_CONNECTIONS
|
||||
#define ENABLE_LE_DATA_CHANNELS
|
||||
#define ENABLE_LE_DATA_LENGTH_EXTENSION
|
||||
#define ENABLE_LOG_ERROR
|
||||
#define ENABLE_LOG_INFO
|
||||
#define ENABLE_SCO_OVER_HCI
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
// #define ENABLE_EHCILL
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof benep heade, avoid memcpy
|
||||
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
|
||||
|
||||
#endif
|
||||
|
178
port/posix-h4-da14585/main.c
Normal file
178
port/posix-h4-da14585/main.c
Normal file
@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Copyright (C) 2014 BlueKitchen GmbH
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holders nor the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* 4. Any redistribution, use, or modification is done solely for
|
||||
* personal benefit and not for any commercial purpose or for
|
||||
* monetary gain.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
|
||||
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Please inquire about commercial licensing options at
|
||||
* contact@bluekitchen-gmbh.com
|
||||
*
|
||||
*/
|
||||
|
||||
#define __BTSTACK_FILE__ "main.c"
|
||||
|
||||
// *****************************************************************************
|
||||
//
|
||||
// minimal setup for HCI code
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "btstack_config.h"
|
||||
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_link_key_db_fs.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "btstack_run_loop_posix.h"
|
||||
#include "hci.h"
|
||||
#include "hci_dump.h"
|
||||
#include "btstack_stdin.h"
|
||||
|
||||
#include "btstack_chipset_da14581.h"
|
||||
#include "hci_581_active_uart.h"
|
||||
|
||||
static int main_argc;
|
||||
static const char ** main_argv;
|
||||
static const btstack_uart_block_t * uart_driver;
|
||||
static btstack_uart_config_t uart_config;
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
|
||||
static hci_transport_config_uart_t transport_config = {
|
||||
HCI_TRANSPORT_CONFIG_UART,
|
||||
115200,
|
||||
0, // main baudrate
|
||||
1, // flow control
|
||||
NULL,
|
||||
};
|
||||
|
||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
switch (hci_event_packet_get_type(packet)){
|
||||
case BTSTACK_EVENT_STATE:
|
||||
if (btstack_event_state_get_state(packet) != HCI_STATE_WORKING) break;
|
||||
printf("BTstack up and running.\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void sigint_handler(int param){
|
||||
UNUSED(param);
|
||||
|
||||
printf("CTRL-C - SIGINT received, shutting down..\n");
|
||||
log_info("sigint_handler: shutting down");
|
||||
|
||||
// reset anyway
|
||||
btstack_stdin_reset();
|
||||
|
||||
// power down
|
||||
hci_power_control(HCI_POWER_OFF);
|
||||
hci_close();
|
||||
log_info("Good bye, see you.\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static int led_state = 0;
|
||||
void hal_led_toggle(void){
|
||||
led_state = 1 - led_state;
|
||||
printf("LED State %u\n", led_state);
|
||||
}
|
||||
|
||||
static void phase2(int status){
|
||||
|
||||
if (status){
|
||||
printf("Download firmware failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Phase 2: Main app\n");
|
||||
|
||||
// init HCI
|
||||
const hci_transport_t * transport = hci_transport_h4_instance(uart_driver);
|
||||
const btstack_link_key_db_t * link_key_db = btstack_link_key_db_fs_instance();
|
||||
hci_init(transport, (void*) &transport_config);
|
||||
hci_set_link_key_db(link_key_db);
|
||||
|
||||
// inform about BTstack state
|
||||
hci_event_callback_registration.callback = &packet_handler;
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
||||
// handle CTRL-c
|
||||
signal(SIGINT, sigint_handler);
|
||||
|
||||
// setup app
|
||||
btstack_main(main_argc, main_argv);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char * argv[]){
|
||||
|
||||
/// GET STARTED with BTstack ///
|
||||
btstack_memory_init();
|
||||
btstack_run_loop_init(btstack_run_loop_posix_get_instance());
|
||||
|
||||
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
|
||||
const char * pklg_path = "/tmp/hci_dump.pklg";
|
||||
hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
|
||||
printf("Packet Log: %s\n", pklg_path);
|
||||
|
||||
// pick serial port and configure uart block driver
|
||||
transport_config.device_name = "/dev/tty.usbmodem1461";
|
||||
uart_driver = btstack_uart_block_posix_instance();
|
||||
|
||||
// extract UART config from transport config, but overide initial uart speed
|
||||
uart_config.baudrate = 57600;
|
||||
uart_config.flowcontrol = transport_config.flowcontrol;
|
||||
uart_config.device_name = transport_config.device_name;
|
||||
uart_driver->init(&uart_config);
|
||||
|
||||
main_argc = argc;
|
||||
main_argv = argv;
|
||||
|
||||
// phase #1 download firmware
|
||||
printf("Phase 1: Download firmware\n");
|
||||
|
||||
// phase #2 start main app
|
||||
btstack_chipset_da14581_download_firmware(uart_driver, da14581_fw_data, da14581_fw_size, &phase2);
|
||||
|
||||
// go
|
||||
btstack_run_loop_execute();
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user