I decided to go back to Zigbee.
I tried to buy dongle with 1MB Flash but it is not available at Mouser, who is a distributor of Telink products.
So, I had to buy a TLSR8258F1KET32 chip and make a board for it.
The result is that now gateway with concurrent Zigbee and BLE is working.
I have tried to get BLE scanning in adv. mode to work but it didn t work.
I had a look at previous SDK and noticed that in the file appscommonzigbee_ble_switch.c function zb_ble_switch_proc() has the following code:
if(zigbee_process == 0){
g_bleTaskTick = clock_time();
/*
* ble task
*
* */
#if SCAN_IN_ADV_STATE
/* add scan functionality after advertising during ADV state, just for slave mode */
do{
/* disable pm during scan */
#if PM_ENABLE
if(blt_state == BLS_LINK_STATE_ADV){
bls_pm_setSuspendMask (SUSPEND_DISABLE);
}
#endif
blt_sdk_main_loop();
}while((blt_state == BLS_LINK_STATE_ADV) && blc_scan_busy_in_adv(g_bleTaskTick,2));//MY_ADV_INTERVAL*3/4
/* enable pm after scan */
#if PM_ENABLE
bls_pm_setSuspendMask (SUSPEND_ADV | SUSPEND_CONN);
#endif
#else
blt_sdk_main_loop();
#endif DBG_ZIGBEE_STATUS(0x30);
#if BLE_MASTER_ROLE_ENABLE
if(g_bleMasterHandler.updateCb){
g_bleMasterHandler.updateCb();
}
#endif
r = irq_disable();
The part #if SCAN_IN_ADV_STATE/#endif is not present in the latest version 2.1.0.0 of the SDK.
I copied the part of the code between #if SCAN_IN_ADV_STATE and #endif into the new SDK:
if(CURRENT_SLOT_GET() == DUALMODE_SLOT_BLE){
g_dualModeInfo.bleTaskTick = clock_time();
/*
* ble task
*
* */
// blt_sdk_main_loop();
#if SCAN_IN_ADV_STATE
/* add scan functionality after advertising during ADV state, just for slave mode */
do{
/* disable pm during scan */
#if PM_ENABLE
if(blt_state == BLS_LINK_STATE_ADV){
bls_pm_setSuspendMask (SUSPEND_DISABLE);
}
#endif
blt_sdk_main_loop();
}while((blt_state == BLS_LINK_STATE_ADV) && blc_scan_busy_in_adv(g_dualModeInfo.bleTaskTick,2));//MY_ADV_INTERVAL*3/4
/* enable pm after scan */
#if PM_ENABLE
bls_pm_setSuspendMask (SUSPEND_ADV | SUSPEND_CONN);
#endif
#else
blt_sdk_main_loop();
#endif
DBG_ZIGBEE_STATUS(0x30);
r = drv_disable_irq();
Now, scanning is working, but I am not sure that the code should be like this, since it has been removed from the latest SDK?
In the previous version there is: if(zigbee_process == 0){
In the last version there is: if(CURRENT_SLOT_GET() == DUALMODE_SLOT_BLE){
So there is a different way it is done.
Could someone from Telink check and advise if it is the correct way of getting scanning to work?
No related topics |
HI,
you can port pre SDK code to new,and it is ok.