Trying to read beacons and also broadcast, but no dual Broadcaster/Observer?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi all,

   

     I'm trying to use a PSoC 4 BLE module from the CY8CKIT-042-BLE-A (CY8C4248LQI-BL583) to read the signal strength of two non-connectable Bluetooth beacons which operate at 10Hz. I then want to do some on-device calculations, and send out a vector based on the signal strengths to another PSoC 4 module. 

   

 

   

     However, I can't figure out how to set up the Bluetooth so that it can both read advertisements and write them. I've tried numerous sample projects from the "100 Projects in 100 Days" put out by Cypress. For the "Day 10: Observer" project, it will read the beacons, but when I try to switch the GAP to anything but "Observer",  it stops working. There is no option for "Broadcaster and Observer" like there is for "Central and Peripheral". I have read that Central and Peripheral should have all the API's enabled, but that doesn't seem to be the case because it breaks the functionality of this code.

   

 

   

Additionally, "Day 11: Central and Observer" seems like it would be exactly what I need, but it won't read the beacons because they're non-connectable, and I don't understand what I need to change to get it to read them. 

   

 

   

Does anyone have any advice on how I can both read from non-connectable beacons and then re-broadcast an advertisement of my own? (it doesn't need to be connectable)

0 Likes
1 Solution
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi,

   


Yes, it is possible to do both broadcaster and observer at the same time. In the BLE component, You can put the device in to Central and Peripheral GAP role 

   

Broadcaster settings to be noted: Make the advertisement settings as : Discovery mode: Non discoverable Advertising: Non connectable undirected advertising

   

Observer settings to be noted: To make the central in observer mode, add the below code in the CYBLE_EVT_STACK_ON event. cyBle_discoveryInfo.discProcedure=CYBLE_GAPC_OBSER_PROCEDURE; (for making observation procedure) After this call start scan API. Call start advertising API also in stack on. Now the device will act both as broadcaster and observer.
 

   

Thanks,

   

Anjana

View solution in original post

0 Likes
4 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi,

   


Yes, it is possible to do both broadcaster and observer at the same time. In the BLE component, You can put the device in to Central and Peripheral GAP role 

   

Broadcaster settings to be noted: Make the advertisement settings as : Discovery mode: Non discoverable Advertising: Non connectable undirected advertising

   

Observer settings to be noted: To make the central in observer mode, add the below code in the CYBLE_EVT_STACK_ON event. cyBle_discoveryInfo.discProcedure=CYBLE_GAPC_OBSER_PROCEDURE; (for making observation procedure) After this call start scan API. Call start advertising API also in stack on. Now the device will act both as broadcaster and observer.
 

   

Thanks,

   

Anjana

0 Likes

Hello, 
I am trying to get the broadcaster and observer work at the same time. I made the changes you suggested but it doesn't work. You said to add code for scanning and advertising under CYBLE_EVT_STACK_ON case correct?

I did that and it didn't work. I then moved it under CYBLE_EVT_GAP_DEVICE_DISCONNECTED. It didn't work but when I commented out CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST) API, the observer code worked and when I commented out the observer code the broadcaster code worked. But I couldn't get both to work at the same time. 

I have attached my project. See lines 90-94 in main.c

0 Likes
Anonymous
Not applicable

You can only dynamically update the advertisement packet when the BLESS state returns CYBLE_BLESS_STATE_EVENT_CLOSE, that could be the cause of not being able to both broadcast and observe simultaneously.

0 Likes

Hello Pratt, 
I modified dynamicAdvPayloadUpdate() to

if(CyBle_GetBleSsState() == CYBLE_BLESS_STATE_EVENT_CLOSE){
            DynamicADVPayloadUpdate(); 
        }

in the project attached to my previous comment. It's still the same. Broadcast and observe doesn't work simultaneously. 

0 Likes