This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SimpleBLECentral USB Dongle Read AdvData

I've flashed the USB dongle with an updated SimpleBLECentral code (updated to include the USB configuration) and my goal is to read the advertisement data. I understand that a bunch of 'GAP_DEVICE_INFO_EVENT' events are added to the stack as peripheral devices that are advertising in the area are scanned. However, when I walk through the code with the debugger, these events never occur (I'm using the KeyFobDemo and toggled on advertising). 

I understand that the SimpleBLECentral is designed to use a display and joystick (which I don't have) so I updated the START_DEVICE_EVT to simulate a joystick up event (to start scanning). Below is the updated code:

if ( events & START_DEVICE_EVT )
{
// Start the Device
VOID GAPCentralRole_StartDevice( (gapCentralRoleCB_t *) &simpleBLERoleCB );

// Register with bond manager after starting device
GAPBondMgr_Register( (gapBondCBs_t *) &simpleBLEBondCB );

SimpleBLECentral_PerformAction ( START_SCAN ); // calls: OnBoard_SendKeys( HAL_KEY_UP, 0); 

simpleBLECentralStartDiscovery();


return ( events ^ START_DEVICE_EVT );

Any ideas why the GAP_DEVICE_INFO_EVENT isn't getting reached? When I debug it goes through the initialization phase and then after a few loops through the OSAL, appears to time out (debugger buttons go gray and I'm not able to step forward).

Thanks!

  • Hi,

    Do you get any error return codes during init? Where is the PC when it halts? Maybe the HW config was updated correctly. Does it run if you don't do simpleBLECentralStartDiscovery()? I would start with this as a first step.

    Best wishes
  • Hi,

    Thanks for the response. I removed the StartDiscovery() and noticed that the device starts to scan (I set the LED to green once the GAP_DeviceDiscoveryRequest() is triggered). However, what's strange is that the callback event after initialization (GAP_DEVICE_INIT_DONE_EVENT: ) is never reached. However, if I end the scan (SimpleBLECentral_PerformAction ( START_SCAN ); // calls: OnBoard_SendKeys( HAL_KEY_UP, 0); ) then the callback is reached.

    Any ideas why?

    I would just like to start scanning initially (without using the Joystick) and red the address of the peripheral devices

    Thanks!
  • Update: I now successfully have it scan (GAP_DEVICE_INIT_DONE_EVENT) is reached but even with Peripheral devices in the area, the GAP_DEVICE_INFO_EVENT is never reached. How can I check if I get error return codes during init? (I don't believe I do get them)

    Thanks!
  • You can check the return values of any non-void functions such as GAPCentralRole_StartDevice. You should also be able to see what is happening by tracing the events you receive. You can debug what is happening by checking the state machine events in simpleBLECentralEventCB. I would recommend storing each one you receive in an array and then inspecting this array when you pause the program at some point.

    If you don't receive the GAP_DEVICE_DISCOVERY_EVENT (which will occur at the end of scanning even if you don't see any devices), this means you never successfully started scanning. In this case, you should then check the return value of GAPCentralRole_StartDiscovery().