cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

New Contributor II

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
Reply
1 Solution
Moderator
Moderator

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
Reply
8 Replies
New Contributor II

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

0 Likes
Reply
Moderator
Moderator

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
Reply
New Contributor II

Hi,

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

Thanks

Shilpa

0 Likes
Reply
Moderator
Moderator

Hello Shilpa,

Please refer to the below attached project.

Thanks,

P Yugandhar.

0 Likes
Reply
New Contributor II

Hi,

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

Thanks

Shilpa

0 Likes
Reply
Moderator
Moderator

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
Reply
New Contributor II

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
Reply
Moderator
Moderator

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
Reply