Uart_ble and central _peripheral

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

cross mob
umg_4380326
Level 3
Level 3
First like received

Hi,

I have CYBLE-2241100-00 modules.

i have tried advertising, scanning, connection establishment and communicate , operating mode switch with different examples .

How can i combine the UART_BLE and CENTRAL_PERIPHERAL codes into a single code using the sample codes .So that i am able to switch roles and also send data over uart . Also how to modify the central peripheral code without the commands from COM port to scan , connect , advertise.

i have individually been successful to make modeules as central and peripheral .

I tried to code without the commands. i added the gap scan in stack on and then after the timeout the scan stops but how to i put / combine  the CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);   CyBle_GapcStartScan(CYBLE_SCANNING_FAST) together once stack is on so that i do not have to switch mode with respect to commands from .

Thank you.

Shilpa

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello Shilpa,

Please refer to the below attached project where I configured PSoC BLE device as both central and peripheral, and in the stack on event I'm starting the advertisement and scanning at the same time. In the event CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT, all the nearby advertising devices will be displayed.

External device with BLE has to be configured as BLE Central device and then can connect to PSoC BLE peripheral device. Please refer external device libraries, code examples etc and implement as BLE central device.

Thanks,

P Yugandhar.

View solution in original post

0 Likes
8 Replies
umg_4380326
Level 3
Level 3
First like received

Also how can i impliment to connect and establish connection a CYBLE_2241100-00 peripheral and external another device as central?

0 Likes
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello Shilpa,

Please refer to the below attached project where I configured PSoC BLE device as both central and peripheral, and in the stack on event I'm starting the advertisement and scanning at the same time. In the event CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT, all the nearby advertising devices will be displayed.

External device with BLE has to be configured as BLE Central device and then can connect to PSoC BLE peripheral device. Please refer external device libraries, code examples etc and implement as BLE central device.

Thanks,

P Yugandhar.

0 Likes

Hi,

i have the following error in PSOC, unable to to open the project for the attached file.

Thanks

Shilpa

0 Likes
lock attach
Attachments are accessible only for community members.

Hello Shilpa,

Please refer to the below attached project.

Thanks,

P Yugandhar.

0 Likes

Hi,

How can it be modified so that it can switch but without the commands ?

Thanks

Shilpa

0 Likes

Hello Shilpa,

In BLE Stack on event, start both Advertisement(using CyBle_GappStartAdvertisement() API) and Scanning(using CyBle_GapcStartDiscovery() API) at the same time. And also, restart the advertisements/scans after disconnecting from a device.

Thanks,

P Yugandhar.

0 Likes

Hi

case CYBLE_EVT_STACK_ON:

            

                printf("Bluetooth STACK ON:\r\n");

            

                cyBle_discoveryInfo.discProcedure=CYBLE_GAPC_GEN_DISC_PROCEDURE;

                CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);

                CyBle_GapcStartDiscovery(&cyBle_discoveryInfo);

          

            

            break;

          

With this I am able to scan and advertise .

Here

case CYBLE_EVT_GAPC_SCAN_START_STOP:

          if(CyBle_GetState()==CYBLE_STATE_SCANNING)

              {

                    printf("Started to Scan\r\n");

                 

                    CyDelay(500);

                    CyBle_GapcStopScan();

                    CyBle_GetState()= CYBLE_STATE_DISCONNECTED;

                    if(device==1)

                    {

                        cyBle_discoveryData.advData[0]=buffer[0];

                        CyBle_ProcessEvents();

                    }

                    device=0;

                }

               CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);

break;

is this correct to store ?

can i get a sample code?

Thanks

0 Likes
lock attach
Attachments are accessible only for community members.

Hello,

Please refer to the below attached project where I'm storing the buffer data values and updating the Advertisement data while device is advertising using the CyBle_GapUpdateAdvData() API.

When you are scanning for Device B then you can see the RSSI value of Device A at central device(Device C) in the advertisement data of Advertisement report structure CYBLE_GAPC_ADV_REPORT_T.

Please let me know if you have any questions.

Thanks,

P Yugandhar.

0 Likes