PSoC™ 4 Forum Discussions
Hi,
We would like to use receive @iBeacon and @Eddystone advertisements on the CYBLE modules.
The module supports iBeacon and Eddystone modes but we want to module to receive (central/master) not just transmit the beacons.
This is because the module is on a gateway device that needs to interpret beacons.
If there are any app notes, that would be great.
thanks,
Adrian
Show LessSomething to share with the community, working with my awesome Cypress FAE we determined that the BLE on PRoC and PSoC4 at least use the free SFLASH for the bonding data for any bonded devices. That is why you are limited to only 4 devices, there are only four free SFLASH areas.
So if you are using BLE and need to be able to pair more than four phones, your have to use white listing, and if you try to use the SFLASH and store a phone it will over write your data.
Show LessRemoving bonded devices: Here is my attempt to clear all bonded devices, will this work?
CyBle_GapRemoveBondedDevice(cyBle_sflashDeviceAddress);
CyBle_GapRemoveBondedDevice(cyBle_sflashDeviceAddress-1);
CyBle_GapRemoveBondedDevice(cyBle_sflashDeviceAddress-2);
CyBle_GapRemoveBondedDevice(cyBle_sflashDeviceAddress-3);
Determining if a device needs to be stored: there is no clear dialog if the BLE handler determines that for you or not, it seems like it does, but there is no documentation I can find that proves that, how do I determine if a device is already paired. So how do you know if you need to store the device or not?
Executing the CyBle_GapGetBondedDevicesByRank(); I just cannot seem to figure out how to point at the list and how to create the right buffer, I have tried many ideas, none seem to work.
Show LessI have tried it, seem as 3MHZ, is it correct? Thanks.
I am designing a DC data buss system i have modeled in my circuit simulator. I am trying to set up a test to validate its data transfer of this system. Currently I have a Pioneer kit testing its functions. I have tied the TX pin P0.5 to the RX pin P0.4. I wrote a little bit of code to send data out the UART to my PC and validate it was revived then post it back to PC Screen. I also toggle an LED on and off each time the data is correct. In my code below it always works one or two times thorough the loop but anything over two time it errors. Can anyone tell me why it is not correct every time through the loops sense I have tied the TX and RX pins together. Also is there a proper way to detect when data has completed sending and receiving. In my code i just put delays but i believe this is not correct way to do this.
Thanks
Show Less
Hi,
I'm using the CY8CKIT-042-BLE-A PIONEER KIT and working on the Find Me project. My observer is an Android app that reads the advertising data (without establishing any connection), that is, using the getManufacturerSpecificData(MANUFACTURER_ID) Android function.
I set the advertising data fields (Manufacturer ID and some data) in the GAP Settings and when I start advertising, my Android app gets this data, but sometimes, some junk data is also fetched. Initially I thought it was the "scan response" data and I unchecked all the boxes in this tab but the same thing is repeated.
Broadcaster (board): My Manufacturer specific data: 01
Observer (Android):
Reading size: 1 with value: 01 (NEED ONLY THIS ONE)
Reading size: 27 with value: 07 19 01 02 20 21 77 0F 00 00 00 D5 67 C4 B7 15 54 63 22 B1 2B 06 09 57 36 AB 1A
Reading size: 8 with value: 09 06 03 03 C0 A8 4A 0A
Code in Android:
byte[] data = result.getScanRecord().getManufacturerSpecificData(MANUFACTURER_ID);
if (data != null) Log.d(TAG, "Reading size: " + data.length + " with value: " + bytesToHex(data));
I'm a beginner. Any help is appreciated.
Show LessHi,
Im new to EZ-Serial, are there any app notes to show how to use the CYBLE-012011-00 in central mode.
Is there a limit on the number of connections to peripherals etc ?
Any good sample implementations out there.
The application is an IoT gateway that needs to connect to dozens of sensors within range of the gateway.
The CYBLE-012011-00 is on the gateway.
thanks
Show LessCannot explain why my android test phones stay connected, but the apples ones timeout, with this message? Takes approximately 30 seconds, but does it consistently. Connect, and in ~30 seconds it disconnects, no explanation. Timeout EVT never fires.
BLE Stack Here:
/* Call back that gets called at any time, and point the BLE block to that call back*/
void Custom_Event_Handler(uint32 event, void * eventparam) /* event is the read or write, eventparam point to event data */
{
CYBLE_GATTS_WRITE_REQ_PARAM_T *write_request_param; /* this is local variable structure where all the data from the write request event we be stored, this cast makes them the same structure */
switch(event)
{
case CYBLE_EVT_STACK_ON:
/* Start Advertisement and enter Discoverable mode*/
LedColor(CYAN);
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
break;
case CYBLE_EVT_GATTS_WRITE_REQ: /* this is the event where a value is written to the gatt from the phone */
write_request_param = (CYBLE_GATTS_WRITE_REQ_PARAM_T *) eventparam; /* this is where the entire data structure of the BLE packet is stored, value, size length, descriptor, limits, etc */
if(CYBLE_PWM1_PWM1_VALUE_CHAR_HANDLE == write_request_param->handleValPair.attrHandle) /* the recieved event is compared to the assigned event value in the definition */
{
BLE_PWM_1 = write_request_param->handleValPair.value.val[0]; /* the PWM value is loaded with the actual value*/
/* Update control handle with new values */
PWM_1.attrHandle = CYBLE_PWM1_PWM1_VALUE_CHAR_HANDLE;
PWM_1.value.val = &BLE_PWM_1;
PWM_1.value.len = PWM_1_CHAR_DATA_LEN;
if(PWM_1_ReadCompare() != BLE_PWM_1)
{ delta_PWM_1 = 1;
PWM_1_WriteCompare(BLE_PWM_1);
}
/* Send updated control handle as attribute for read by central device, so that
* Client reads the new data */
CyBle_GattsWriteAttributeValue(&PWM_1,FALSE,&connHandle,FALSE);
}
if(CYBLE_PWM2_PWM2_VALUE_CHAR_HANDLE == write_request_param->handleValPair.attrHandle) /* the recieved event is compared to the assigned event value in the definition */
{
BLE_PWM_2 = write_request_param->handleValPair.value.val[0]; /* the PWM value is loaded with the actual value*/
/* Update control handle with new values */
PWM_2.attrHandle = CYBLE_PWM2_PWM2_VALUE_CHAR_HANDLE;
PWM_2.value.val = &BLE_PWM_2;
PWM_2.value.len = PWM_2_CHAR_DATA_LEN;
if(PWM_2_ReadCompare() != BLE_PWM_2)
{
delta_PWM_2 = 1;
PWM_2_WriteCompare(BLE_PWM_2);
}
/* Send updated handle as attribute for read by central device, so that
* Client reads the new data */
CyBle_GattsWriteAttributeValue(&PWM_2,FALSE,&connHandle,FALSE);
}
if(CYBLE_SWITCH1_SWITCH1_VALUE_CHAR_HANDLE == write_request_param->handleValPair.attrHandle) /* the recieved event is compared to the assigned event value in the definition */
{
BLE_Switch1_Binary = write_request_param->handleValPair.value.val[0]; /* the PWM value is loaded with the actual value*/
/* Update control handle with new values */
SW_1.attrHandle = CYBLE_SWITCH1_SWITCH1_VALUE_CHAR_HANDLE;
SW_1.value.val = &BLE_Switch1_Binary;
SW_1.value.len = SW_1_CHAR_DATA_LEN;
curr_BLE_switch1_status = BLE_Switch1_Binary;
delta_BLE_switch1 = curr_BLE_switch1_status ^ prev_BLE_switch1_status;
prev_BLE_switch1_status = curr_BLE_switch1_status;
/* Send updated control handle as attribute for read by central device, so that
* Client reads the new data */
CyBle_GattsWriteAttributeValue(&SW_1,FALSE,&connHandle,FALSE);
}
if(CYBLE_SWITCH2_SWITCH2_VALUE_CHAR_HANDLE == write_request_param->handleValPair.attrHandle) /* the recieved event is compared to the assigned event value in the definition */
{
BLE_Switch2_Binary = write_request_param->handleValPair.value.val[0]; /* the PWM value is loaded with the actual value*/
/* Update control handle with new values */
SW_2.attrHandle = CYBLE_SWITCH2_SWITCH2_VALUE_CHAR_HANDLE;
SW_2.value.val = &BLE_Switch2_Binary;
SW_2.value.len = SW_2_CHAR_DATA_LEN;
curr_BLE_switch2_status = BLE_Switch2_Binary;
delta_BLE_switch2 = curr_BLE_switch2_status ^ prev_BLE_switch2_status;
prev_BLE_switch2_status = curr_BLE_switch2_status;
/* Send updated control handle as attribute for read by central device, so that
* Client reads the new data */
CyBle_GattsWriteAttributeValue(&SW_2,FALSE,&connHandle,FALSE);
}
// Pairing
if(CYBLE_PAIRING_PAIRING_CONTROL_CHAR_HANDLE == write_request_param->handleValPair.attrHandle) /* the recieved event is compared to the assigned event value in the definition */
{
Pairing_control = write_request_param->handleValPair.value.val[0]; /* the PWM value is loaded with the actual value*/
/* Update control handle with new values */
PAIRING.attrHandle = CYBLE_PAIRING_PAIRING_CONTROL_CHAR_HANDLE;
PAIRING.value.val = &Pairing_control;
PAIRING.value.len = PAIRING_CHAR_DATA_LEN;
pairingUpdate = 1;
/* Client reads the new data */
CyBle_GattsWriteAttributeValue(&PAIRING,FALSE,&connHandle,FALSE);
}
//STATUS
if(CYBLE_STATUS_STATUS_VALUE_CHAR_HANDLE == write_request_param->handleValPair.attrHandle) /* the recieved event is compared to the assigned event value in the definition */
{
Status = write_request_param->handleValPair.value.val[0]; /* the PWM value is loaded with the actual value*/
/* Update control handle with new values */
STATUS.attrHandle = CYBLE_STATUS_STATUS_VALUE_CHAR_HANDLE;
STATUS.value.val = &Status;
STATUS.value.len = STATUS_CHAR_DATA_LEN;
CyBle_GattsWriteAttributeValue(&STATUS,FALSE,&connHandle,FALSE);
}
/* Send the response to the write request received. */
CyBle_GattsWriteRsp(((CYBLE_GATTS_WRITE_REQ_PARAM_T *)eventparam)->connHandle);
break;
case CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ:
break;
case CYBLE_EVT_GAP_DEVICE_CONNECTED:
/* This flag is used in application to check connection status */
/* Update attribute handle on GATT Connection*/
LedColor(BLUE);
deviceConnected = TRUE;
break;
case CYBLE_EVT_GAP_DEVICE_DISCONNECTED:
/* Start Advertisement and enter Discoverable mode*/
deviceConnected = FALSE;
LedColor(GREEN);
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
break;
case CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP:
if((deviceConnected == FALSE) && (CyBle_GetState() != CYBLE_STATE_ADVERTISING))
{
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
LedColor(YELLOW);
}
if((deviceConnected == TRUE) && (CyBle_GetState() != CYBLE_STATE_ADVERTISING))
{
CyBle_GappStopAdvertisement();
LedColor(MAGENTA);
}
break;
case CYBLE_EVT_GATT_CONNECT_IND:
CyBle_GappStopAdvertisement();
break;
case CYBLE_EVT_GATT_DISCONNECT_IND:
break;
case CYBLE_EVT_TIMEOUT:
LedColor(RED);
break;
default: /*this is where you go for any event not listed in the event handler, you just leave */
break;
}
}
Error on Apple
Show LessI am working with the PSoC 4000s Prototyping Kit and want to convert the RawCount readings from CapSense back to capacitance values. Using the given formula requires a knowledge of the Imod value, which I cannot find. Any help is much appreciated!
Show LessHi. I'm trying to add a second I2C bus to my device so it can run 4 sensors instead of just 2.
I also need to run SPI (for a flash chip to sample data to) and UART to get my data out of there at the end of the run.
So to make this work, I moved my UART from an SCB-based one to the UDB-based UART 2.50.
Unfortunately, I'm now getting
-maximum number of macrocells exceeded (max 32, need 37)
-maximum number of unique p-terms exceeded (max 64, need 77)
-maximum number of status cells exceeded (max 4, needed 6)
Does anyone have any good tips on how to scrounge the extra cells? Or has anyone successfully managed to use both a SPIM and a UDB UART in the same project?
Otherwise, I'll either have to use a hardware I2C multiplexer or I'll have to do a full duplex, bit banged 1 Mbps UART, which may not even be possible (seeing as the TX only SW UART tops out at 115.2k). Both fairly unattractive options.
Show Less