Page 1 of 1

Bluetooth pairing issue with Legacy mode

Posted: Fri Oct 11, 2024 8:37 am
by Wolpertinger
Hi,

I'm programming in VS Code with the ESP-IDF. I edited the sdconfig so I can use legacy mode pairing and this all works fine. But for some reason, after cycling the power of my esp my phone asks me to pair again.
So my guess is that the esp does not store the paired devices. Is there a way around this?

Re: Bluetooth pairing issue with Legacy mode

Posted: Fri Oct 25, 2024 7:40 am
by Wolpertinger
Does nobody have any idea?
Here is my initialisation logic:

Code: Select all

esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
    ret = esp_bt_controller_init(&bt_cfg);
    
    ret = esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT);
    
    ret = esp_bluedroid_init();
   
    ret = esp_bluedroid_enable();

    ret = esp_spp_register_callback(bt_spp_event_handler);
    
    esp_spp_cfg_t sppConfig = {
        .mode = ESP_SPP_MODE_CB,
        .enable_l2cap_ertm = false,
        .tx_buffer_size = 1024
    };
    ret = esp_spp_enhanced_init(&sppConfig);

    ret = esp_spp_start_srv(ESP_SPP_SEC_NONE, ESP_SPP_ROLE_SLAVE, 0, "SPP_SERVER");
   
    ret = esp_bt_dev_set_device_name(mySettings.device_name);
    
    // Setzen der festen PIN für Bluetooth Classic
    ret = esp_bt_gap_set_pin(ESP_BT_PIN_TYPE_FIXED, 4, (uint8_t*)mySettings.BTpin);
    
    ret = esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_GENERAL_DISCOVERABLE);