Other Parts Discussed in Thread: CC2340R5, CC2651R3
After porting a working reader app from blestack to the ble5stack, I cannot get past the device initialization,
i.e the breakpoint set in GAP_DEVICE_INIT_DONE_EVENT: in SimpleCentral_processGapMsg() is not hit.
The thread goes something like this:
SimpleCentral_init() GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, (void *)attDeviceName);
icall_directAPI() errno = ICall_waitMatch(ICALL_TIMEOUT_PREDEFINE, matchLiteCS, NULL, NULL, (void **)&pCmdStatus);
if (errno == ICALL_ERRNO_TIMEOUT) { ICall_abort(); }
The ICall_waitMatch() takes about 5 seconds and then returns with ICALL_ERRNO_TIMEOUT.
It's likely something wrong with the porting, so I can use your help in figuring out what needs to change.
It may be more productive to have a remote debug session to go through the ported reader project and step through the code.
Let me know if that's possible and if so a convenient time to meet.
static void SimpleCentral_init(void)
{
uint8_t i;
// ******************************************************************
// N0 STACK API CALLS CAN OCCUR BEFORE THIS CALL TO ICall_registerApp
// ******************************************************************
// Register the current thread as an ICall dispatcher application
// so that the application can send and receive messages.
ICall_registerApp(&selfEntity, &syncEvent);
uint32_t ccReg;
ccMode = CC_MODE_NORMAL;
curRssi = 0;
sendRssiMsg = FALSE;
// Create an RTOS queue for message from profile to be sent to app.
appMsgQueue = Util_constructQueue(&appMsg);
//Create a queue to hold messages to send
sendMsgQueue = Util_constructQueue(&sendMsg);
// Setup discovery delay as a one-shot timer
Util_constructClock(&startDiscClock, SimpleBLECentral_startDiscHandler,
DEFAULT_SVC_DISCOVERY_DELAY, 0, false, 0);
Util_constructClock(&oneMinClock, oneMinuteClockHandler,
ONE_MINUTE_DELAY, 0, false, 0);
Util_constructClock(&discCompleteClock, discCompleteHandler,
SVC_DISCOVERY_COMPLETE, 0, false, 0);
dispHandle = Display_open(SBC_DISPLAY_TYPE, NULL);
// Initialize internal data
for (i = 0; i < MAX_NUM_BLE_CONNS; i++)
{
readRssi[i].connHandle = CONNHANDLE_INVALID;
readRssi[i].pClock = NULL;
}
GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN,
(void *)attDeviceName);
//Set default values for Data Length Extension
//Extended Data Length Feature is already enabled by default
//in build_config.opt in stack project.
{
//Set initial values to maximum, RX is set to max. by default(251 octets, 2120us)
#define APP_SUGGESTED_PDU_SIZE 251 //default is 27 octets(TX)
#define APP_SUGGESTED_TX_TIME 2120 //default is 328us(TX)
//This API is documented in hci.h
//See the LE Data Length Extension section in the BLE5-Stack User's Guide for information on using this command:
//http://software-dl.ti.com/lprf/ble5stack-latest/
//HCI_LE_WriteSuggestedDefaultDataLenCmd(APP_SUGGESTED_PDU_SIZE, APP_SUGGESTED_TX_TIME);
}
// Initialize GATT Client
VOID GATT_InitClient();
// Register to receive incoming ATT Indications/Notifications
GATT_RegisterForInd(selfEntity);
// Initialize GATT attributes
GGS_AddService(GATT_ALL_SERVICES); // GAP
GATTServApp_AddService(GATT_ALL_SERVICES); // GATT attributes
// Register for GATT local events and ATT Responses pending for transmission
GATT_RegisterForMsgs(selfEntity);
// Accept all parameter update requests
GAP_SetParamValue(GAP_PARAM_LINK_UPDATE_DECISION, GAP_UPDATE_REQ_ACCEPT_ALL);
// Register with GAP for HCI/Host messages (for RSSI)
GAP_RegisterForMsgs(selfEntity);
// Initialize GAP layer for Central role and register to receive GAP events
GAP_DeviceInit(GAP_PROFILE_CENTRAL, selfEntity, addrMode, NULL);
}