Task watchdog got triggered - btcontroller

johnguo
Posts: 2
Joined: Thu Jan 04, 2018 9:15 am

Task watchdog got triggered - btcontroller

Postby johnguo » Tue Aug 21, 2018 11:25 am

我们采用ESP32模块开发智能牙刷。但是发现固件经常出现看门狗的错误,请问要如何解决?

错误信息如下:

N (234) app-imu: Gyro offsets: +16 -1 -52
N (239) app-imu: Accel offsets: +403 +159 +3969
I (633) MPU6050: DMP firmware loaded
W (633) MPU6050: setDMPFeatures()-> TAP not yet fully supported
I (649) MPU6050: DMP Output rate set to 20 Hz
I (656) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:1
I (657) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:3
I (666) BTDM_INIT: BT controller compile version [9525061]

I (672) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
M (10091) Free RAM: 166856 B
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: btController
CPU 1: IDLE

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Task watchdog got triggered - btcontroller

Postby ESP_Sprite » Wed Aug 22, 2018 1:30 am

This means that for some reason, the btController seems to be hogging the CPU. What is your program doing while this happens?

johnguo
Posts: 2
Joined: Thu Jan 04, 2018 9:15 am

Re: Task watchdog got triggered - btcontroller

Postby johnguo » Wed Aug 22, 2018 5:46 am

这个问题发生,主要体现在充电(将ESP32的工作模式调整至80MHZ的MODEM SLEEP状态,四颗LED灯以呼吸灯的方式闪烁)或者从休眠中唤醒的时候。感觉是BLE初始化时出错。

我们的牙刷蓝牙,是以从机的方式,即手机主动连接牙刷的蓝牙,不需要进行BLE的扫描。

主流程如下:
bool GrushApp::Launch()
{
APP_LOG(">>> Grush App initialize", LOG_COLOR_PURPLE);

initializer();
storage_mgr_ = new StorageMgr();
storage_mgr_->Initialize();
BsdManager::INSTANCE = new BsdManager();
BRUSH.init();
BRUSH.bootup();
return true;
}

void Brush::init()
{
PWRMGR.setup();
BATTERY.setup();
IMU.setup();
LAMP.setup();
KEYBUTTON.setup();
VIBMOTOR.setup();
if (APP_BLUETOOTH_FEATURE_ENABLE)
initBLE();
if (BRUSHING_DATA_UPLOAD_ENABLE)
WIFI.setup();
SESSION.setup();
}

//
void initBLE()
{
ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT));

esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg));
ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BLE));

ESP_ERROR_CHECK(esp_bluedroid_init());
ESP_ERROR_CHECK(esp_bluedroid_enable());

ESP_ERROR_CHECK(esp_ble_gatts_register_callback(gatts_event_handler));
ESP_ERROR_CHECK(esp_ble_gap_register_callback(gap_event_handler));
ESP_ERROR_CHECK(esp_ble_gatts_app_register(GATTS_GRUSH_APP_ID));

esp_ble_auth_req_t auth_req = ESP_LE_AUTH_BOND; // bonding with peer device after auth
esp_ble_io_cap_t iocap = ESP_IO_CAP_NONE; // set the IO capability to No output No input
uint8_t key_size = 16; // the key size should be 7~16 bytes
uint8_t init_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;
uint8_t rsp_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;
esp_ble_gap_set_security_param(ESP_BLE_SM_AUTHEN_REQ_MODE, &auth_req,
sizeof(esp_ble_auth_req_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_IOCAP_MODE, &iocap, sizeof(esp_ble_io_cap_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_MAX_KEY_SIZE, &key_size, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_INIT_KEY, &init_key, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_RSP_KEY, &rsp_key, sizeof(uint8_t));

STATUS.setBits(STATUS_BLE_INIT);
}

Who is online

Users browsing this forum: Bing [Bot] and 102 guests