cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

sshenoy105
New Contributor II

Hello,

 

I am hoping to use the throughput test smaple code to develop an application.. but the code at https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days/Day024_Thr... does not compile if I use PSoC Creator 4.0 (with update).. It complains about version of BLE component.

I created my own little sample (attached the project) which should advertise, connect and dump data continuously (a few 10s of K of data with 509 bytes at a time).. while I can connect to it using CySmart on my windows PC, most of the packets sent are dropped (I get a error while calling the notification API CyBle_GattsNotification which returns 3 for most calls)..

any help will be greatly appreciated..

0 Likes
1 Solution
Yugandhar
Moderator
Moderator

Hello,

Please check the below points and let me know your observations.

1. Please check with increasing the BLE stack internal buffer size. For this, In PSoC Creator, go to Tools-> Options-> Design Entry-> Component Catalog and then select Enable Param Edit Views and click OK.
2. Open BLE component configuration, right-click on Advanced Tab and select Expression view.
3. Increase the MaxAttrNoOfBuffer. You can start with 3 or 4 and test.

Could you please let me know why you are using the old version(PSoC Creator 4.0) of PSoC Creator ? It is always recommended to use the latest version of PSoC Creator and latest version of BLE Component.

Thanks,
P Yugandhar.

View solution in original post

0 Likes
11 Replies
sshenoy105
New Contributor II

find the log (first number is error code and number in brackets is a simple loop count indicating how many times did we run.. as you can see, the call goes through approximately once every 12-13 times and all other times I get the error  CYBLE_ERROR_MEMORY_ALLOCATION_FAILED 

========= BLE GATT Throughput Measurement - Server side =========


Advertising with Address: 00 A0 50 00 00 01
Connected.

NOTIFICATION ENABLED


01


data sent: 00 (00)
data send failed: 03 (01)
data send failed: 03 (02)
data send failed: 03 (03)
data send failed: 03 (04)
data send failed: 03 (05)
data send failed: 03 (06)
data send failed: 03 (07)
data send failed: 03 (08)
data send failed: 03 (09)
data send failed: 03 (0A)
data send failed: 03 (0B)
data send failed: 03 (0C)
data send failed: 03 (0D)
data send failed: 03 (0E)
data send failed: 03 (0F)
data send failed: 03 (10)
data send failed: 03 (11)
data sent: 00 (12)
data send failed: 03 (13)
data send failed: 03 (14)
data send failed: 03 (15)
data send failed: 03 (16)
data send failed: 03 (17)
data send failed: 03 (18)
data send failed: 03 (19)
data send failed: 03 (1A)
data send failed: 03 (1B)
data send failed: 03 (1C)
data send failed: 03 (1D)
data send failed: 03 (1E)
data send failed: 03 (1F)
data send failed: 03 (20)
data send failed: 03 (21)
data send failed: 03 (22)
data send failed: 03 (23)
data send failed: 03 (24)
data sent: 00 (25)
data send failed: 03 (26)
data send failed: 03 (27)
data send failed: 03 (28)
data send failed: 03 (29)
data send failed: 03 (2A)
data send failed: 03 (2B)
data send failed: 03 (2C)
data send failed: 03 (2D)
data send failed: 03 (2E)
data send failed: 03 (2F)
data send failed: 03 (30)
data send failed: 03 (31)
data send failed: 03 (32)
data send failed: 03 (33)
data send failed: 03 (34)
data send failed: 03 (35)
data send failed: 03 (36)
data sent: 00 (37)
data send failed: 03 (38)
data send failed: 03 (39)
data send failed: 03 (3A)
data send failed: 03 (3B)
data send failed: 03 (3C)
data send failed: 03 (3D)
data send failed: 03 (3E)
data send failed: 03 (3F)
data send failed: 03 (40)
data send failed: 03 (41)
data send failed: 03 (42)
data send failed: 03 (43)
data send failed: 03 (44)
data send failed: 03 (45)
data send failed: 03 (46)
data send failed: 03 (47)
data send failed: 03 (48)
data send failed: 03 (49)
data sent: 00 (4A)
data send failed: 03 (4B)
data send failed: 03 (4C)
data send failed: 03 (4D)
data send failed: 03 (4E)
data send failed: 03 (4F)
data send failed: 03 (50)
data send failed: 03 (51)
data send failed: 03 (52)
data send failed: 03 (53)
data send failed: 03 (54)
data send failed: 03 (55)
data send failed: 03 (56)
data send failed: 03 (57)
data send failed: 03 (58)
data send failed: 03 (59)
data send failed: 03 (5A)
data send failed: 03 (5B)
data send failed: 03 (5C)
data sent: 00 (5D)
data send failed: 03 (5E)
data send failed: 03 (5F)
data send failed: 03 (60)
data send failed: 03 (61)
data send failed: 03 (62)
data send failed: 03 (63)
data send failed: 03 (64)
data send failed: 03 (65)
data send failed: 03 (66)
data send failed: 03 (67)
data send failed: 03 (68)
data send failed: 03 (69)
data send failed: 03 (6A)
data send failed: 03 (6B)
data send failed: 03 (6C)
data send failed: 03 (6D)
data send failed: 03 (6E)
data sent: 00 (6F)
data send failed: 03 (70)
data send failed: 03 (71)
data send failed: 03 (72)
data send failed: 03 (73)
data send failed: 03 (74)
data send failed: 03 (75)
data send failed: 03 (76)
data send failed: 03 (77)
data send failed: 03 (78)
data send failed: 03 (79)
data send failed: 03 (7A)
data send failed: 03 (7B)
data send failed: 03 (7C)
data send failed: 03 (7D)
data send failed: 03 (7E)
data send failed: 03 (7F)
data send failed: 03 (80)
data send failed: 03 (81)
data send failed: 03 (82)
data send failed: 03 (83)
data send failed: 03 (84)
data sent: 00 (85)
data send failed: 03 (86)
data send failed: 03 (87)
data send failed: 03 (88)
data send failed: 03 (89)
data send failed: 03 (8A)
data send failed: 03 (8B)
data send failed: 03 (8C)
data send failed: 03 (8D)
data send failed: 03 (8E)
data send failed: 03 (8F)
data send failed: 03 (90)
data send failed: 03 (91)
data send failed: 03 (92)
data send failed: 03 (93)
data send failed: 03 (94)
data send failed: 03 (95)
data send failed: 03 (96)
data send failed: 03 (97)
data send failed: 03 (98)
data send failed: 03 (99)
data send failed: 03 (9A)
data send failed: 03 (9B)
data sent: 00 (9C)
data send failed: 03 (9D)
data send failed: 03 (9E)
data send failed: 03 (9F)
data send failed: 03 (A0)
data send failed: 03 (A1)
data send failed: 03 (A2)
data send failed: 03 (A3)
data send failed: 03 (A4)
data send failed: 03 (A5)
data send failed: 03 (A6)
data send failed: 03 (A7)
data send failed: 03 (A8)
data send failed: 03 (A9)
data send failed: 03 (AA)
data send failed: 03 (AB)
data send failed: 03 (AC)
data send failed: 03 (AD)
data send failed: 03 (AE)
data send failed: 03 (AF)
data send failed: 03 (B0)
data sent: 00 (B1)
data send failed: 03 (B2)
data send failed: 03 (B3)
data send failed: 03 (B4)
data send failed: 03 (B5)
data send failed: 03 (B6)
data send failed: 03 (B7)
data send failed: 03 (B8)
data send failed: 03 (B9)
data send failed: 03 (BA)
data send failed: 03 (BB)
data send failed: 03 (BC)
data send failed: 03 (BD)
data send failed: 03 (BE)
data send failed: 03 (BF)
data sent: 00 (C0)
data send failed: 03 (C1)
data send failed: 03 (C2)
data send failed: 03 (C3)
data send failed: 03 (C4)
data send failed: 03 (C5)
data send failed: 03 (C6)
data send failed: 03 (C7)
data send failed: 03 (C8)
data send failed: 03 (C9)
data send failed: 03 (CA)
data send failed: 03 (CB)
data send failed: 03 (CC)
data send failed: 03 (CD)
data send failed: 03 (CE)
data send failed: 03 (CF)
data send failed: 03 (D0)
data send failed: 03 (D1)
data send failed: 03 (D2)
data sent: 00 (D3)
data send failed: 03 (D4)
data send failed: 03 (D5)
data send failed: 03 (D6)
data send failed: 03 (D7)

WE ARE DONE SENDING ALL BYTES - D8

 

0 Likes
sshenoy105
New Contributor II

Further, I added delays (CyDelay) between each call to CyBle_GattsNotification .. even after a delay of 250ms (CyDelay(250)), only one out of 5 calls to CyBle_GattsNotification  go through and rest give error 3..

ata sent: 00 (00)
data send failed: 03 (01)
data send failed: 03 (02)
data send failed: 03 (03)
data send failed: 03 (04)
data sent: 00 (05)
data send failed: 03 (06)
data send failed: 03 (07)
data send failed: 03 (08)
data send failed: 03 (09)
data sent: 00 (0A)
data send failed: 03 (0B)
data send failed: 03 (0C)
data send failed: 03 (0D)
data send failed: 03 (0E)
data sent: 00 (0F)
data send failed: 03 (10)
data send failed: 03 (11)
data send failed: 03 (12)
data send failed: 03 (13)
data sent: 00 (14)

I have also increased the heap to 0x400 which didn't help

I don;t know if this is related - Cysmart log (from my windows laptop) shows the following when it gets the first packet that I am sending

[16:41:06:961] : 'GATT Error Notification' event received
[16:41:06:961] : Error Code: BLE_GATT_ERR_INSUFFICIENT_RESOURCE
[16:41:08:239] : 'Characteristic Value Notification' event received

0 Likes
Yugandhar
Moderator
Moderator

Hello,

Please check the below points and let me know your observations.

1. Please check with increasing the BLE stack internal buffer size. For this, In PSoC Creator, go to Tools-> Options-> Design Entry-> Component Catalog and then select Enable Param Edit Views and click OK.
2. Open BLE component configuration, right-click on Advanced Tab and select Expression view.
3. Increase the MaxAttrNoOfBuffer. You can start with 3 or 4 and test.

Could you please let me know why you are using the old version(PSoC Creator 4.0) of PSoC Creator ? It is always recommended to use the latest version of PSoC Creator and latest version of BLE Component.

Thanks,
P Yugandhar.

View solution in original post

0 Likes
sshenoy105
New Contributor II

I should have mentioned this earlier.. I had already tried the buffer increase thing.. Unfortunately, I don;t even see the "Expression View" (check attached screen shots.

Can you also please let me know if there is a version of the Throughput project ( https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days/Day024_Thr... does not compile if I use PSoC Creator 4.0 (with update).. It complains about version of BLE component.. I don't think it will compile on newer version of Creator given the project is over 6 years old.

I am using Creator 4.0 (with update) because this is a old repo from a vendor/partner and they won't support anything else.. I didn't want to upgrade to avoid additional porting effort (if any)

 

cypress_ticket_1.jpgcypress_ticket_2.jpg

0 Likes
sshenoy105
New Contributor II

I would greatly appreciate quick response if at all possible.. I am blocked since I am not able to  send data out via BLE fast enough.. If I had a throughput project that works on Creator 4.0 or above (or even compiles), that will be a great start for me.. 

0 Likes
Yugandhar
Moderator
Moderator

Hello,

I'm able to see the expression view in the BLE component as shown in attached image. Could you please send the build version of the PSoC Creator which you are using ? In the PSoC Creator, Goto Help-> About and send the screenshot of the build version as shown in attached image.

Thanks,
P Yugandhar.

0 Likes
sshenoy105
New Contributor II

please find attached the image with build version.. I have also pasted the contents of the "about" window.. FYI: I would love to get the Day24 throughput test source that will work on this Creator version.. that will be greatly appreciated 

 

creator_version.jpg

 

Environment:
PSoC Creator 4.0 Update 1 (4.0.0.432)
Culture: English (United States)
OS Version: Microsoft Windows NT 6.2.9200.0
CLR Version: 4.0.30319.42000

Installed CyInstaller Products:
CySmart 1.3
Peripheral Driver Library 2.1.0
PSoC Programmer 3.29.0
PSoC Creator 4.0 Update 1

Loaded Plugins:
Name: Feedback Plugin
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Add a feedback page to the framework

Name: Customizer Loader
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Loads component customizers.

Name: Addin Discovery
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Discovers PSoC Creator addins (kits, language packs, etc)

Name: Device Catalog
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Device Catalog Plugin

Name: Documentation
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Adds the topics available in the documentation.

Name: Start Page
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Adds a start page to the framework.

Name: Output Window Plugin
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Adds the output window

Name: SCC Manager
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: The Source Code Control Manager is the central class used for SCC actions within PSoC Creator.

Name: Symbol, Schematic and SchMacro Factory
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: The Symbol and Schematic Factory is used to load, cache, and retrieve symbols and schematics.

Name: Project Manager Plugin
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Adds project management related functionality.

Name: File Editor Factory Plugin
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Add file editors to the framework.

Name: GDE Plugin
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Loads the Symbol and Schematic editors

Name: Language Plugin
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Supports user files in multiple languages

Name: Workspace Factory
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: The Workspace Factory is used to retrieve instances of PSoC Creator workspaces.

Name: Project Factory
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: The Project Factory is used to retrieve instances of PSoC Creator projects.

Name: Toolchain Manager
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: PSoC Creator Toolchain Manager

Name: ARM GCC Generic
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: ARM GNU Generic

Name: ARM MDK Generic
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: ARM MDK Generic

Name: ARM IAR Generic
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: ARM IAR Generic

Name: DP8051 Keil Generic
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: DP8051 Keil Generic

Name: Device Selector
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Adds a dialog that allows the user to select a device.

Name: Transport Framework
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Provides a generic device communication framework for use by other plugins.

Name: Debugger Core
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: The Core Debugger provides an architecture independent framework for the common debug features.

Name: PSoC Debugger
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Provides debugging support for the different PSoC families through a GDB backend.

Name: FM Debugger
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Provides debugging support for FM device families

Name: Device IO Transport
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Provides device IO support for Cypress devices though PSoC Programmer APIs.

Name: Serial Transport
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Provides basic serial device support for the rest of the tool.

Name: Bootloader Host
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Provides a host tool to perform bootloading operations.

Name: Background Elaborator
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: PSoC Creator Background Elaborator.

Name: TypeCache Factory
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: The TypeCache Factory is used to retrieve instances of TypeCaches.

Name: PSoC Fitter
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: PSoC Fitter Plugin

Name: FM Fitter
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: FM Fitter Plugin

Name: DWR Plugin
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Registers resource editors with devices.

Name: DMA Wizard
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Enables quick and correct development of applications that use DMA.

Name: Tuner Plugin
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: Manages custom component tuner executables

Name: Notice Window
Version: 4.0.0.432
Company: Cypress Semiconductor
Description: The Notice Window displays notices (status messages / errors with managed lifetimes).

 

 

 

0 Likes
Yugandhar
Moderator
Moderator

Hello,

Please refer to the attached 'Day24_Throughput' example project which works on PSoC Creator 4.0 update1 IDE. I'm able to increase the MaxAttrNoOfBuffer value in the BLE component.
Please let me know if this helps.

Thanks,
P Yugandhar.

0 Likes
sshenoy105
New Contributor II

thanks for the response.. Whatever you saw is something that works for me as well.. but if you change  your code to the following, you will see the problem I am seeing.. this is the reason why throughput is very low.. (if we use your code, there will be a LOT of dropped packets).. so I added this code and also added retries to ensure all packets went through.. but obviously throughput is low to begin with

//CyBle_GattsNotification(cyBle_connHandle, &notificationPacket);
CYBLE_API_RESULT_T apiResult = CyBle_GattsNotification(cyBle_connHandle, &notificationPacket);
if(apiResult != CYBLE_ERROR_OK) {
UART_UartPutString("\n\rdata send failed: ");
UART_UartPutChar(HexToAscii(apiResult, 1));
UART_UartPutChar(HexToAscii(apiResult, 0));
}

0 Likes
Yugandhar
Moderator
Moderator

Hello,

Increasing the MaxAttrNoOfBuffer value to 10 in the BLE component should not provide error in your project. So, please check with increasing the MaxAttrNoOfBuffer value in BLE component (Open BLE component configuration, right-click on Advanced Tab and select Expression view and Increase the MaxAttrNoOfBuffer. )

Thanks,

P Yugandhar.

0 Likes
sshenoy105
New Contributor II

apologies for the delay.. Thank you very much for the response. I did try the change (thanks for the tip "select expression view") and increased the buffer value to 10..

1. The number of times I get a out of memory error when i call CyBle_GattsNotification reduces to 0.

2. Throughout  is around 45Kilo Bytes per second (Release build).. I send (34 * 3600 * 24) bytes and it takes approx 65 seconds (ran this test multiple times and hence I know this is consistent)

3. What I do see is this line of code doesn't return true for significant amount of time which will of course affect throughput.. what might be keeping stack busy ? I send data 509 bytes at a time and between each send, i check if stack is busy.

if( (CyBle_GattGetBusStatus() == CYBLE_STACK_STATE_FREE)
&& (CyBle_GetState() == CYBLE_STATE_CONNECTED)
&& (CyBle_GattGetBusyStatus() == CYBLE_STACK_STATE_FREE))

0 Likes