8000 Doesn't receive the result of HCI Command · Issue #664 · espressif/arduino-esp32 · GitHub
[go: up one dir, main page]

Skip to content
Doesn't receive the result of HCI Command #664
Closed
@wakwak-koba

Description

@wakwak-koba

I'm going to operate the legacy bluetooth with arduino-esp32.
On probation I'll send the HCI RESET Command to VHCI, but response doesn't come.

#include "bt.h"
#include "Arduino.h"

static bool btSetup()
{
    if(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE){
        esp_bt_controller_config_t cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
        esp_bt_controller_init(&cfg);
        while(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE);
    }
    if(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_INITED){
        if (esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT)) {
            Serial.println("BT Enable failed");
            return false;
        }
    }
    if(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_ENABLED){
        return true;
    }
    Serial.println("BT Setup failed");
}

static void _on_tx_ready(void)
{
    Serial.println("_on_tx_ready");
}

static int _on_rx_data(uint8_t *data, uint16_t len)
{
    Serial.println("_on_rx_data");
}

static esp_vhci_host_callback_t vhci_host_cb = {
    _on_tx_ready,
    _on_rx_data
  };
  
void setup()
{
    Serial.begin(115200);
    Serial.print("ESP32 SDK: ");
    Serial.println(ESP.getSdkVersion());

    if(btSetup())
    {
        esp_vhci_host_register_callback(&vhci_host_cb);
        while (!esp_vhci_host_check_send_available());
        Serial.println("Started");
        delay(1000);

        uint8_t buf[4];

        // HCI RESET
        buf[0] = 0x01;
        buf[1] = 0x03;
        buf[2] = 0x0c;
        buf[3] = 0x00;
        esp_vhci_host_send_packet(buf, 4);
        Serial.println("esp_vhci_host_send_packet");
    }
}

void loop()
{

}

Doesn't fire _on_rx_data(uint8_t *data, uint16_t len)
I thought it was moving by the older version.
(maybe on april 2017)

Why?
I think it's related to #373.

SDK Version is v3.0-dev-745-gc4e65d6a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0