PSoC™ 4 Forum Discussions
text.format{('custom.tabs.no.results')}
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 LessHi All,
I was following the tutorial video of "How to Make an iOS App to Control a Robot Using Bluetooth Low Energy (BLE)" , (link: http://www.cypress.com/training/how-make-ios-app-control-robot-using-bluetooth-low-energy-ble) but there was some error in building it. I downloaded the Xcode programming software of Xcode 9, but when I opened the project (which I got from the github) it says that the build editor version isn't compatible with the program.
I noticed in the video Lesson 6 it says that the attached project would be in Xcode 7, so I tried that, but I got another error saying that the program wasn't compatible with the Xcode 7. Then, I downloaded Xcode 8, and then there were no build errors, but when I programmed it to my phone, it says that ios11.4 does not support Xcode 8.
Can anyone please tell me how to update the program so that it would be suitable for Xcode 9?
Any help would be appreciated,
Andrew Collins
Show LessWhile doing development work for new GATT services and profiles within Bluetooth SIG, there is a need for more than just GATT explorer type of functionality so the source code is important. But, the volume of data that needs to be available on the display makes even tablets unworkable for this development work. The specification that I am working on has 38 data fields within a single characteristic and some of those fields are bit-fields with meaning for each bit that needs to be readily available on-screen.
Show LessHi,
I'm trying to have data read by sensors sent via BLE to my phone, at the moment to the CySmart app. I followed the tutorial here:
http://www.cypress.com/training/psoc-video-tutorial-series-how-create-android-apps-interact-cypress-ble
and have modified it to just send uint8's.
the data I have is currently in the form of xxx.xx and xx.xx, stored in floats. I would like to have this be sent to the app, but I cannot figure out how. I tried to multiply them by 100 to make them just uints, not floats as I figured that would be simpler, but it doesn't seem to work. I do get numbers coming out on the CySmart app, but 1. they are in hex, and 2. they don't convert to the right numbers.
Please help, I'm relatively new to this all, so I may have just made some stupid mistakes or something like that.
Thanks!
Show LessI am working on a project that communicates via TCP/IP and I'm trying to implement a firmware upgrade functionality. My current approach is to have a dual application setup with a bootloader that operates as a launcher only (no communication) and an application that handles the network communication (this already exists for my actual application), this application will also have to handle the actual loading of the firmware from the host server into flash (this is the part I'm working on now).
Are there any examples that work like this? It seems as though a lot of my task involves pulling out all of the existing bootloader generated source, cleaning it up and compiling it into my application (adjusting the communication interface stuff). I don't think I can incorporate the bootloader into my project and have it operate as a runtime component rather than an actual bootloader, is that correct? I'm basically implementing the following data flow (Ref: AN86526 Appendix C) but built on top of the TCP/IP communication interface, am I going in the right direction or is there an easier way?
Show Less
Currently my advertisement has :
cyBle_discoveryModeInfo.advParam->advIntvMin = CYBLE_SLOW_ADV_INT_MIN;
cyBle_discoveryModeInfo.advParam->advIntvMax = CYBLE_SLOW_ADV_INT_MAX;
Can i advertise one packet by command wherever i want in code and close advertisement until i want to send the next one ?
Without having the thresholds active?
Show Less