PSoC™ 6 Forum Discussions
Please reply to the problem as mentioned in the subject.
Regards.
A R Bhattacharya
I am using PSoC Creator 4.2 to write a BLE application for a CYBLE-416045-02 and the basics are all working very well.
Of the 3 custom services I have, one is a readable/writable 32-character UTFS8 string. The initial value set in the component is a null string.
As the app starts up, it looks to the EEPROM to read the name that has been given to the system previously and if none has been set, it creates a default name of 'No Given Name' which is 13 character long. I use the Cy_BLE_GATTS_WriteAttributeValueLocal() function to set the name.
When this is read by the client, it is a 32-character value that is null-padded after the actual string.
When I write to the service with (say) 'Test Lamp' I can see the 'handleValPair' structure has the new value and the 'len' parameter is 9 (which is correct).
I then use the Cy_BLE_GATTS_WriteAttributeValuePeer() function to write the value to the local database (and I also update the EEPROM).
However when I then read the service value, what I get is 'Test LampName'.
When I look at the full string sent to the client, it is the same ASCII character null terminated.
If I reboot the code, it will then correctly read 'Test Lamp' form the EEPROM and sets the value in the local GATTS database accordingly.
What do I have to do to save the name to the local database with the correct length (other than rebooting!)?
The code I use is:
case CY_BLE_EVT_GATTS_WRITE_REQ:
writeReqParameter = (cy_stc_ble_gatts_write_cmd_req_param_t*)eventParam;
if( CY_BLE_LOCATION_SETTING_CHAR_HANDLE ==
writeReqParameter->handleValPair.attrHandle)
{
tLocalName newLocalName;
memset( &newLocalName, 0, sizeof( tLocalName));
memset( newLocalName.localName, ' ', sizeof( newLocalName.localName));
newLocalName.nameLength = writeReqParameter->handleValPair.value.len & 0xff;
memcpy(newLocalName.localName, writeReqParameter->handleValPair.value.val,
writeReqParameter->handleValPair.value.len & 0xff);
// Save to the EEPROM for the next reboot
EEPROM_Write(0, &newLocalName,sizeof(tLocalName));
// Save to the local GATTS database
writeReqParameter->handleValPair.value.val = newLocalName.localName;
Cy_BLE_GATTS_WriteAttributeValuePeer(&writeReqParameter->connHandle,
&writeReqParameter->handleValPair);
}
Cy_BLE_GATTS_WriteRsp(writeReqParameter->connHandle);
break;
You can see there my attempts to space-pad the name and also repoint the string pointer. (It doesn't mater if I don't do this and leave the 'val' pointer pointing to whatever it originally was.)
Susan
Show LessHi,
I created two PSoC Creator 4.3 projects in one workspace for the PSoC6 CYBLE-416045-02 on PC "A". I'm also using PDL 3.10.
In both projects, I use the printf() statements liberally. Therefore it appears that retargetio is working.
I archived this workspace to move to another PC "B". I build both projects on PC "B" (using PDL 3.10). The printf()s are working on one project but not on the other.
Note: _PutString()s on either project work OK.
What am I missing?
Len
Show LessHi,
I've just uploaded a dual project workspace that could be instructional to those getting familiar with BLE features. These projects concentrate specifically on the Advertisement phase of the BLE. PSoC6 BLE Beacon and Scanner Creator projects.
One project is a Broadcaster Role as a Beacon that ONLY transmits advertising packets. It is run-time configurable for many parameters.
The other project is a Observer Role as a Scanner that ONLY receives and reports advertising packets. It is run-time configurable for many parameters.
I found it a very good learning tool. Additionally it can be used as a launching point for your BLE projects.
Good coding!
Len
Show LessHi!
I'm trying to use the Cypress API SPI_1_SetActiveSlaveSelect-function, on a CY8C6347BZI-BLD54 using PSoC Creator 4.2 with PDL 3.1.1.
The component name are SCB_SPI_PDL_v2_0.
When I select m_ss1 it seems to not be applied on the corresponding hardware pin.
The SPI component is located in SCB7, and the SCB7_SPI_CTRL register should be located at address 0x40680020 according to the datasheet.
After I've run the following code snippet for selecting m_ss1 (SPI1_LED_CS) I get this result in the control register:
while (SPI_1_IsBusBusy());
SPI_1_SetActiveSlaveSelect(SPI_1_SPI_SLAVE_SELECT1);
10000100 00000000 00000000 00000001
||
SSEL[0-3]
But SPI1_LED_CS does not go low when writing data to the SPI bus, strange enough.
When I disconnect SPI1_DO_CS and SPI1_LED_CS from the SPI controller and control them manually it works just as expected.
So the question is if I'm missing something here?
Show Less
I am trying to gauge the various amounts of current drawn in the PSOC under the various modes of operation. There is LP, ULP, Active, Sleep, Deep Sleep, Hibernate, and Stop modes. A lot to try and make a guess. However, for the PSOC 4, there is an app note that has some rough numbers for Active, Sleep, Deep Sleep, and Hibernate, Stop modes. That is what I am looking for?
I have this app note, but it doesn't have any ball park numbers --
AN219528
Trying to come up with useful numbers based on the data sheet is useless it seems. I am looking for averages and ball parks based on average applications, something just like I was able to find for the PSOC 4. I can test the actual current, but I want to focus my energy on deciding to go with deep sleep or hibernate for example, and the least painful path, but I want data on modes and consumption, ranged data is fine, just something at a glance, I can make a call with.
Thanks,
Andre'
Show LessIs there a way to disable the TOC2 validity check within Flashboot during the boot sequence? I know there's a way to disable the app verification, wanted to see if there was something similar for the TOC2 area validation.
Thanks!
Bryan
Show LessHello,
Forgive me if this is a duplicate or stupid question, but for some reason I cannot find it in the PDFs.
Motivation:
We have a sensor that generates anywhere from a .6 to .9V pulse given a certain stimulus (think piezoelectric accelerometer). I am hoping to hook an interrupt to this signal to essentially keep a count, however I suspect that .6-.9V is below the threshold for digital logic.
Obviously I could amplify this signal, but I am hoping to keep component count down, so my questions are:
- What are the logic level thresholds for the psoc 6 GPIO interrupts?
- Can those levels be tuned or are they relative to some reference voltage?
Thanks for any help!
Show LessSome time ago, it was reported that SweynTooth Bluetooth vulnerability will affect the security of PSOC4_BLE,PSOC6_BLE, may I ask if we have fixed this problem ,
how to solve it, can provide relevant documents?thanks.
Show Less