SWRU580 April   2021 CC2564C , CC2564MODA , CC2564MODN

 

  1.   Trademarks
  2. Introduction
  3. A2DP (AUD) Demo Guide
    1. 2.1 Demo Overview
    2. 2.2 Demo Application
    3. 2.3 Application Commands
  4. A3DP Sink Demo Guide
    1. 3.1 Demo Overview
    2. 3.2 Demo Application
    3. 3.3 Sink Reference Board Demo Application
    4. 3.4 Multiple Source Demo
    5. 3.5 Application Commands
  5. A3DP Source Demo Guide
    1. 4.1 Demo Overview
    2. 4.2 Demo Application
    3. 4.3 Application Commands
  6. HFP Demo Guide
    1. 5.1 Demo Overview
    2. 5.2 Demo Application
    3. 5.3 Application Commands
  7. HFP Audio Gateway Demo Guide
    1. 6.1 Demo Overview
    2. 6.2 Demo Application
    3. 6.3 Application Commands
  8. HID Demo Guide
    1. 7.1 Demo Overview
    2. 7.2 Demo Application
    3. 7.3 Application Commands
  9. HSP Demo Guide
    1. 8.1 Demo Overview
    2. 8.2 Demo Application
    3. 8.3 Application Command
  10. Map Demo Guide
    1. 9.1 Demo Overview
    2. 9.2 Demo Application
    3. 9.3 Application Command
  11. 10PBAP Demo Guide
    1. 10.1 Demo Overview
    2. 10.2 Demo Application
    3. 10.3 Application Commands
  12. 11SPP Demo Guide
    1. 11.1 Demo Overview
    2. 11.2 Demo Application
    3. 11.3 Application Commands
  13. 12SPPLE Demo Guide
    1. 12.1 Demo Overview
    2. 12.2 Demo Application
    3. 12.3 Demonstrating SPP LE on an iOS Device with the LightBlue App
    4. 12.4 Demonstrating SPP LE on an iOS Device with the SPPLE Transfer App - LEGACY
    5. 12.5 SPP Demo
    6. 12.6 Application Commands
  14. 13SPPDMMulti Demo Guide
    1. 13.1 Demo Overview
    2. 13.2 Demo Application
    3. 13.3 Application Commands
  15. 14ANP Demo Guide
    1. 14.1 Demo Overview
    2. 14.2 Demo Application
    3. 14.3 Application Commands
  16. 15HFP Demo Guide
    1. 15.1 Demo Overview
    2. 15.2 Demo Application
    3. 15.3 Application Commands
  17. 16HTP Demo Guide
    1. 16.1 Demo Overview
    2. 16.2 Demo Application
    3. 16.3 Application Commands
  18. 17PASP Demo Guide
    1. 17.1 Demo Overview
    2. 17.2 Demo Application
    3. 17.3 Application Commands
  19. 18HOGP Demo Guide
    1. 18.1 Demo Overview
    2. 18.2 Demo Application
    3. 18.3 Application Commands
  20. 19PXP Demo Guide
    1. 19.1 Demo Overview
    2. 19.2 Demo Application
    3. 19.3 Applications Commands
  21. 20FMP Demo Guide
    1. 20.1 Demo Overview
    2. 20.2 Demo Application
    3. 20.3 Application Commands
  22. 21CSCP Demo Guide
    1. 21.1 Demo Overview
    2. 21.2 Demo Application
    3. 21.3 Application Commands
  23. 22Revision History

Demo Application

This section provides a description of how to use the demo application to connect two configured boards and communicate over bluetooth. Bluetooth CSCP is a simple Client-Server connection process. We will setup one of the boards as a Server and the other board as a Client. We will then initiate a connection from the Client to the Server. Once connected, we can transmit data between the two devices over bluetooth.

Server setup on the demo application
  1. We will setup the first board as a Server. Note the bluetooth address of the Server; we will later use this to initiate a connection from the Client.Up to four commands are all that is needed to setup the CSCS Server.
  2. The first command we need is RegisterCSCS, this command will register the service and initiate the Server, issue the RegisterCSCS command.
    GUID-20210311-CA0I-SQV0-7NBF-69HD3L1PWLX2-low.jpg Figure 21-2 CSCP Demo CSCS Register
  3. In order to set the supported features we issue the SetSupportedFeatures <Wheel Measurement Support> <Crank Measurement Support> <Multiple Location Support>.
    GUID-20210311-CA0I-JXXV-ZDWB-PXVFCKGXGTBG-low.jpg Figure 21-3 CSCP Demo STM32 Set Supported Features Usage
    Issue the SetSupportedFeatures 1 1 1 command to enable all features, the terminal will display a note that indicates the we need to issue the GetRemoteFeatures command in the Client's terminal.
  4. If Multiple Location is supported, in order to set the supported sensor locations list we issue the SetSupportedSensorLocationBitMask <BitMask> command, which is a bitmask that will enable the supported locations in the Server.
    GUID-20210311-CA0I-TQFB-PHWS-DWPS2Q6MRLQP-low.jpg Figure 21-4 CSCP Demo CSCS Set Supported Sensor Location Bit Mask Usage
    Issue the SetSupportedSensorLocationBitMask 0x7fff command to set all the available locations in the list, the terminal will display that the update was successful.
  5. Now, after we configured the Server, we can begin advertising to nearby devices by issuing the AdvertiseLE 1 command.
    GUID-20210311-CA0I-GLHZ-3GSL-BDDGNFWHHHQ0-low.jpg Figure 21-5 CSCP Demo CSCS Features and Location
Initiating connection from the Client
Note: Steps 1 and 2 are optional if you already know the Bluetooth address of the device that you want to connect to.
  1. The Client LE device can try to find which LE devices are in the vicinity by issuing the StartScanning command.
  2. Once you have found the device, you can stop scanning by issuing the StopScanning command.
    GUID-20210311-CA0I-HQ9H-JTDK-TGVBMN4VMF1D-low.jpg Figure 21-6 CSCP Demo STM32 Start Scanning
  3. Retrieve the Bluetooth address of the first board that was configured as a Server.
  4. Issue a ConnectLE <BD_ADDR of Server> command in the Client terminal.
  5. When a Client successfully connects to a Server, both the Client and Server will output LE_Connection_Complete notification and information about the current connection.
    GUID-20210311-CA0I-99SZ-HBQG-GXPX9BKR7SBZ-low.jpg Figure 21-7 CSCP Demo STM32 Client Connect LE
    Discovering and Configuring the Server

    Now we have a connection established and both devices are ready to send data to each other. Before Cycle Speed and Cadence information can be sent we must first initialize commands in the Client terminal.

  6. In order to discover The service handles we issue the DiscoverCSCS command and the handles that are discovered will be displayed in the terminal.
    GUID-20210311-CA0I-THTP-GVBV-G1MCSQJ4TTN8-low.jpg Figure 21-8 CSCP Demo STM32 Discover CSCS
  7. After discovering the handles we need to discover the supported features of the Server, so we issue the GetRemoteFeatures command, which will display the supported features in the Client terminal.
    GUID-20210311-CA0I-QZKQ-NZGZ-NSBTVMF3CPKB-low.jpg Figure 21-9 CSCP Demo STM32 Get Remote Features
  8. In order to enable Server notifications, and if the SC Control Point exists also enable indications we issue the ConfigureRemoteCSCS 1 command in the Client's terminal. If the configuration succeeds information about the CCCD configuration will be displayed in the Client and Server terminals.
    GUID-20210311-CA0I-71GF-Q424-LLDTRKCTBRLQ-low.jpg Figure 21-10 CSCP Demo STM32 Configure Remote Enable
Transferring Cycle Speed and Cadence Information

Now we have a connection established and both devices configured and are ready to send data to each other.

We can now notify from the Sensor (Jump to paragraph t) or we can send SC Control Point Command to the sensor from the collector (next paragraph).

In Client Terminal:

  1. When we make new connection between collector and Sensor we need to Set the wheel circumference so the collector will be able to calculate Instantaneous speed, so we issue the SetWheelCircumference <Circumference> command to set the circumference in cm. Type SetWheelCircumference 210 in order to set wheel circumference of 210 cm.
    GUID-20210311-CA0I-T8VJ-XGJW-LHKPRFFSF8Z4-low.jpg Figure 21-11 CSCP Demo STM32 Set Wheel Circumference
  2. When we want to change data in the sensor we can do it only from the collector by issuing the SetSCControlPoint command. We can update the cumulative wheel revolutions, the sensor location or retrieve a list of supported sensor locations using this command. After each command the collector will receive a response indication from the sensor.
    GUID-20210311-CA0I-JD2F-Z9VT-PD8RSW0XGRMZ-low.jpg Figure 21-12 CSCP Demo STM32 Set SC Control Point Usage
  3. If we want, and only when we support wheel revolutions, we can update the cumulative wheel revolutions using the SC Control Point Command. To do so we issue the SetSCControlPoint 1 <Cumulative value to update> command, for example type SetSCControlPoint 1 2000.
    GUID-20210311-CA0I-J901-7F5D-40WNJRSFVCBM-low.jpg Figure 21-13 CSCP Demo Set SC Control Point
  4. If we want to change sensor location, and only if we support multiple sensor location, we can change it only to locations that the sensor supports. To see the supported locations list, we issue the DisplayAvailableLocations command. If the list is empty we need to retrieve it first, we will do so in the next paragraph. If the list isn't empty jump to paragraph "p".
    GUID-20210311-CA0I-5NVX-PZMQ-FZ4MNHKFJ2SK-low.jpg Figure 21-14 CSCP Demo STM32 Display Available Locations
  5. In order to retrieve the sensor location list, and only when we supported multiple sensor location, we need to use the set SC Control Point command which retrieve the list, to do so we use SetSCControlPoint 3. Type SetSCControlPoint 3 and you will see the available sensor locations.
  6. You can see confirmation for the command and the indication from the sensor that includes the list.
    GUID-20210311-CA0I-FJRM-KPM6-GQMD6HQKBKB7-low.jpg Figure 21-15 CSCP Demo STM32 Set SC Control Point 2
  7. After the collector has the sensor supported list locations, the collector can update the sensor location using SetSCControlPoint 2 and the number of the location from the list that we want to update, type SetSCControlPoint 2 3.
    GUID-20210311-CA0I-QWX2-RPRM-Q5S3VTGVGNHG-low.jpg Figure 21-16 CSCP Demo STM32 Set CS Control Point 3
    In Server Terminal:
  8. After we set new sensor location, we can check it by issuing the Querylocation command and you will be able to see the new location.
    GUID-20210311-CA0I-WSCD-QRTF-MD6SHTPMC57J-low.jpg Figure 21-17 CSCP Demo STM32 Query Location
  9. Now, when we finish with all the configurations and command the sensor can start notifying his measurements, in order to do so, we issue the NotifyMeasurements command. When the sensor support only wheel revolutions or crank revolutions you need to input 2 parameters, cumulative value, and time event value, when both are supported you need to input 4 parameters wheel cumulative value, wheel time event value, crank cumulative value and crank time event value.
    GUID-20210311-CA0I-HZF4-S5DM-V53DCWZ7SR00-low.jpg Figure 21-18 CSCP Demo STM32 Notify Usage
  10. In this example wheel revolutions and crank revolutions are supported. then type NotifyMeasurements 2008 64000 65534 9300, you will be able to see on the Client terminal the parameters you entered.
    • Server Terminal
      GUID-20210311-CA0I-RQSC-CWVJ-1X6PQCSQF25X-low.jpg Figure 21-19 CSCP Demo STM32 Notify
    • Client Terminal
    • The Calculation for instantaneous speed

      Speed[cm/(s/1024)] = (Difference in two successive Cumulative Wheel Revolution values * Wheel Circumference) / (Difference in two successive Last Wheel Event Time values) In order to receive Speed[km/h] we need to multiple the result with (3.6*1024/100) - The Demo is doing the calculation for us when we use DISPLAY_DEBUG definitions in the environment

    • The Calculation for instantaneous cadence

      Cadence[r/(s/1024)] = (Difference in two successive Cumulative Crank Revolution values) / (Difference in two successive Last Crank Event Time values) In order to receive Cadence[rpm] we need to multiple the result with (60*1024) - The Demo is doing the calculation for us when we use DISPLAY_DEBUG definitions in the environment

    GUID-20210311-CA0I-HFDB-899P-VD0KC3LPM9LP-low.jpg Figure 21-20 CSCP Demo STM32 Notify Client
  11. When using debug mode, the application will calculate the Instantaneous Speed and Instantaneous Cadence. In order to do this calculation we need to send another notification. Type NotifyMeasurements 2016 65024 65535 10324, now in the Client Terminal you can see Instantaneous Speed [km/h] and Instantaneous Cadence [rpm].
    • Server Terminal
      GUID-20210311-CA0I-FCDD-NZRQ-VSKVWNQNH2SR-low.jpg Figure 21-21 CSCP Demo STM32 Notify 2
    • Client Terminal
    GUID-20210311-CA0I-CZRJ-LNB4-D0BZBJZKDQTR-low.jpg Figure 21-22 CSCP Demo STM32 Notify Client 2