PSoC™ 4 Forum Discussions
I need send big array through CyBle_GattsNotification. I want to know when the big array sent over?
do you have blocking version of CyBle_GattsNotification function?
In the following code, it can be realize blocking sending data?
do
{
apiResult = CyBle_GattsNotification(cyBle_connHandle,¬ificationPacket);
CyBle_ProcessEvents();
}while((CYBLE_ERROR_OK != apiResult) && (CYBLE_STATE_CONNECTED == cyBle_state));
I am developing a device based on the CYBLE-022001-00 with BLE Stack V3.10
The device is a Central GATT Client on a custom profile.
Scanning works fine and I can connect to the peripheral.
I enable indication on that peripheral, and that seems to work, too.
I write a command to the RX-characteristic of the peripheral, the peripheral performs some tasks and writes a response to the TX-characteristic, which causes an indication to be issued at the central.
I am using two different commands, let's call them L ("long") and S ("short"). The length of the commands is the same, but the generated response in 18 bytes for S and 21 bytes for L.
MTU is 20 bytes.
Hence I get two indications for L and a single one for S. Let's call these response packets [1x] and [2x], where x is S or L to identify the command that generated the packet.
This is the behavior I experience:
- Start up the device, load the stack, perform a scan
- Connect to the peripheral
- Send L
- Indication: [2L][1L][2L]
- Send L
- Indication: [1L][2L]
- Send L
- Indication: [1L][2L]
- Send L
- Disconnect from the peripheral
- Re-connect to the peripheral
- Send L
- Indication: [2L][1L][2L]
- Send L
- Indication: [1L][2L]
- Send S
- Indication [1S]
- Send S
- Indication [1S]
- Send L
- Disconnect from the peripheral
- Re-connect to the peripheral
- Send S
- Indication [1S][1S]
- Send S
- Indication [1S]
- Send S
- Indication [1S]
- Send S
- Disconnect from the peripheral
- Re-connect to the peripheral
- Send L
- Indication [1S][1L][2L]
- Send L
- Indication [1L][2L]
- Send L
- Indication [1L][2L]
- Send S
- Indication [1S]
- Send L
- Indication [1L][2L]
- Send L
- Disconnect from the peripheral
- Re-connect to the peripheral
- Send S
- Indication [2L][1S]
- Send S
Summary: the first response after connection starts with a erroneous indication packet. This packet contains the payload of the last indication received before disconnection. If there was no previous connection, then the packet contains the payload of the last packet of the current response. All subsequent responses are correct.
Any idea on what could cause this strange behavior?
For completeness, here is how I get the indications:
switch (event)
{
// all other cases omitted for the sake of readability
case CYBLE_EVT_GATTC_HANDLE_VALUE_IND:
indicationResponse = (CYBLE_GATTC_HANDLE_VALUE_NTF_PARAM_T *)eventParam;
LL = indicationResponse->handleValPair.value.len;
// debug info:
for (ii = 0; ii < LL; ii++)
{
UART_UartPutChar(indicationResponse->handleValPair.value.val[ii]);
}
//rxHandler(indicationResponse);
CyBle_GattcConfirmation(cyBle_connHandle); // send ACK on indication
break;
}
Normally I would do some computation on the response, but here I commented out the call to the rxHandler to simplify the problem.
Here is how I disconnect the device from the peripheral:
void requestDisconnect()
{
if (CyBle_GetState() != CYBLE_STATE_CONNECTED)
return;
CyBle_GapDisconnect(cyBle_connHandle.bdHandle);
txCharHandle = 0; /* Handle for the TX data characteristic */
rxCharHandle = 0; /* Handle for the RX data characteristic */
txCharDescHandle = 0; /* Handle for the TX data characteristic descriptor */
bleUartServiceHandle = 0; /* Handle for the BLE UART service */
bleUartServiceEndHandle = 0; /* End handle for the BLE UART service */
mtuSize = CYBLE_GATT_MTU; /* MTU size to be used by Client and Server after MTU exchange */
infoExchangeState = INFO_EXCHANGE_START;
notificationEnabled = false;
return;
}
Any help is greatly appreciated!
Kind regards, Enpa
Show LessI want to download program data to BLE pioneer base board with no install PSoC PC.
Will be able to download program data to BLE pioneer base board without using PSoC creator?
Best Regards,yoshizu
Hi,
I am very new to using a PSoC or any cypress product for that matter.
Here's the datasheet for the device I'm using: http://www.cypress.com/file/137466/download (Page 15 is where the pertinent pins are listed)
The pins I want to use are: P4_0, P4_1, P5_0, P5_1. They are all dedicated to the SCB1_SPI peripheral. The "mode" they correspond to is Deep-Sleep #1 (value = 15).
My question is this: How do I use this information to actually connect the pins to perform their SPI functions? I have been unable to find a single well-explained resource that can tell me how to use the HSIOM register to manipulate the ports, their pins, and perform a peripheral selection.
Like I know I should be starting with CYREG_HSIOM_PORT_SEL4, but what do I set it equal to? How do I select a pin and a "mode"?
Thanks.
EDIT: I came across the CY_SET_XTND_REG32 function which'll let me set the CYREG_HSIOM_PORT_SELx registers. But I don't know what value I set the register to.
EDIT 2: Okay. Is this how it's done?
/*For pin P4_0: x = 4, y = 0. Configure bits 3:0 to value 15 for deep sleep mode 3 */
/*Bits 3:0 are selected because 4y+3:4y*/
CY_SET_XTND_REG32(CYREG_HSIOM_PORT_SEL4, (0x0000000F|0x0000000F));
I recently purchased a PSOC motor control unit (CY8CKIT-037) with a PSoC 4 (CY8CKIT-042). The system comes with code to get everything up and running. I have been going through the sensored BLDC motor control code and I am a bit confused on what the timer/counter does to get the speed measurement from the hall sensors. I see that there is a count, capture, and clock input. I am not sure how the signal from the hall sensor is detected and what interval it is detected on. In addition I am confused about the difference between "on terminal count" versus "on compare/capture count". If someone can run through with me the basic functions such as how the sampling and interrupt function in this code I would be very appreciative. I have attached photos of the Timer/counter block
CY_ISR(speed_measure_isr)
{
uint16 cntCaptur = 0;
cntCaptur = Counter_Spd_ReadCapture();
speedCur = preCntCaptur - cntCaptur;
/* If speed is too low, Regard motor is stopped*/
if(speedCur > 5000) /* < 300Rpm*/
speedCur = 5000;
/* filter for speed measured */
speedCur = (preSpeedCur >> 2) + (preSpeedCur >> 1) + (speedCur >> 2);
preCntCaptur = cntCaptur;
preSpeedCur = speedCur;
Counter_Spd_ClearInterrupt(Counter_Spd_INTR_MASK_CC_MATCH);
}
Hi, I'm currently developing with Cy8ckit0-442-BLE kit in my company. The initial idea is to develop an application with the PSoC Creator IDE, then use the MCU CYBL10161-56LQXI in our products. The question is When we buy the MCU (PROC BLE) are we already paying license to Cypress ?. Thanks in advance
Show LessI am able to write a new device name to a peripheral from an iOS device and have it appear in the advertising data using this code:
char newName[] = "any new name";
Cyble_GapSetLocalName(newName);
Cyble_GapUpdateAdvData(cyBle_discoveryModeInfo.advData, CyBle_discoveryModeInfo.scanRspData);
And following Zadek's method at http://www.cypress.com/forum/psoc-4-ble/writing-device-name-characteristic?source=search&keywords=PSoC4%20BLE%20write%20to%202A00%20characteristic&cat=community, I have also made a GATT characteristic for the new device name which I can easily write to with an iOS device. Here is that code:
case CYBLE_EVT_GATTS_WRITE_REQ:
wrReqParam = (CYBLE_GATTS_WRITE_REQ_PARAM_T *)eventParam;
if( wrReqParam->handleValPair.attrHandle == CYBLE_MY_SERVICE_DEVICE_NAME_CHAR_HANDLE ){
CyBle_GattsWriteAttributeValue( &wrReqParam->handleValPair, 0, &connectionHandle, CYBLE_GATT_DB_LOCALLY_INITIATED);
CyBle_GattsWriteRsp( connectionHandle );
};
Do I now use a Cyble_GattsRead AttributeValue() on my device name characteristic so that I may assign the read-response to my char newName[] variable? If so, what does that code look like? Thanks.
Also, I would like to put the new name in the SFLASH as Zadek did, so that it survives power downs. What does that code look like? (the link provided no longer works) Thanks again.
Show LessHello I am reading in a microphone into the PSOC 4200 BLE ADC for about a 1.5 secs using 15000 samples at 10000 SPS, 10 bit resolution and VDD = 3.3. Attaching a screenshot of my settings. I am having a hard time reading in the microphone as I am not seeing the same thing I'm seeing on my oscilloscope.
Show LessHi,
i think this is a noob question here, but anyway. My application involves interfacing an ADXL345 with the PSOC4 BLE, over SPI, and communicating the data to the computer serially via UART.
However, im unale to send the integer data over UART. Here's a short code that im trying to run :
the idea is to print "784.4564549" onto my serial monitor.
int bytesWritten;
char myString[50];
bytesWritten = sprintf(myString, "%f", myFloat);
UART_UartPutChar(myString);
UART_UartPutString("\r\n");
However, all that the serial monitor prints is a dash!
Any suggestions on how else to send an integer over UART? thanks 🙂
Show Less