5 Replies Latest reply on Dec 10, 2019 12:05 AM by XinghaoZ_26

    CYBT_333047-02 via HCI interface on Raspberry Pi


      I successfully programmed my EVAL board CYBT_333047-02 with "ezserial_343026-CYBT_343026_EVAL-rom-ram-Wiced-release.hex",


      I checked the code is running using my iPhone and turned bluetooth scanning "on". Immediately the iPhone found a bluetooth device "EZ-Serial 17:1C:B1_BT". So the WICED code is running.


      Now I wanted to make use of the HCI commands on the USB side on my Linux Raspberry Pi. When I plugin the EVAL board USB cable into my Raspberry Pi two interfaces are added (similar to Windows COM8 and COM9) called /dev/ttyACM0 and /dev/ttyACM1.


      As usual for Linux I was using the "hciattach" Linux command to attach the Bluez Linux socket to the HCI interface of the EVAL board.


      # hciattach -s 115200 /dev/ttyACM0 any 115200 noflow nosleep

      # device setup complete


      So this works. Then I looked to the hci devices attached using the command "hciconfig"


      # hciconfig

      # hci1:   Type: Primary  Bus: UART

                   BD Address: F9:9C:84:17:1C:B1  ACL MTU: 1021:6  SCO MTU: 64:1


                   RX bytes:113 acl:0 sco:0 events:9 errors:0

                   TX bytes:40 acl:0 sco:0 commands:10 errors:0


      You see Linux bluetooth stack has attached to the F9:9C:84:17:1C:B1 device which is the EZ-serial device. And also you see there is a bidirectional communication running over /dev/ttyACM0 based on the RX/TX bytes counted. So this seems to work fine also.


      Now usual in Linux is to bring up a HCI device into "UP" state using "hciconfig hci1 up" command


      # hciconfig hci1 up

      # Can't init device hci1: Device or resource busy (16)


      But as you can see Linux is giving back an error. Do you have idea why this happens?


      I read on the forum that a patch is needed to support the full range of HCI commands. Is this true? Where to I get this patch from?


      Thank you


        • 1. Re: CYBT_333047-02 via HCI interface on Raspberry Pi

          We don't need a patch for the module. But you need to download an application to the module to initiate it.

          Could you refer to the following blog to see if it can help: Run CYW20706 in HCI Mode

          • 2. Re: CYBT_333047-02 via HCI interface on Raspberry Pi

            Yes XinghaoZ_26 you are right. Meanwhile I got the module operative in standard HCI mode loading an "empty" application with WICED Studio instead of hello_sensor example. This is all I have added in my C-file:


            #include "sparcommon.h"

            APPLICATION_START() {}


            But let me ask you this. The module is only available in standard HCI mode if I keep "recovery" button for SPI2_MOSI signal pressed during power cycle. Is this normal?


            My expectation was if I load an empty application into flash then the module should automatically activate standard HCI mode? Is my understanding wrong?


            I am asking because when we make a real design in of the module later in our product, then we need to connect SPI2_MOSI signal to Host processor in order to trigger it.


            Thank you


            • 3. Re: CYBT_333047-02 via HCI interface on Raspberry Pi

              Per my test, in the recover mode, the device can only accept the HCI reset command once.

              You need to pull the CTS pin to high during the power on reset, then it can accept all the standard HCI commands.

              • 4. Re: CYBT_333047-02 via HCI interface on Raspberry Pi

                XinghaoZ_26 There is one last question: when we receive fresh CYBT-333047-02 modules from Cypress distributor, is then the on-board flash memory completely empty or is there any application already pre-loaded in flash-memory?


                I am just thinking of the final production step with our end device when CYBT-333047-02 is soldered on PCBA. So we would connect the 4 UART pins to host processor, we would connect the SPI2_MOSI signal to Host processor and we would connect XRES to Host processor.  I think with CYBT-333047-02 it is the signal SPI2_MOSI to switch to recovery mode and not signal CTS (which is for CYW20706 only). Please confirm again.


                Then the following startup procedure will happen:


                1.) we would apply SPI2_MOSI to GND by HOST processor

                2.) we would apply XRES to GND to reset module and then we would release the XRES signal. Module is now in recovery mode.

                3.) now we would download the "empty application" into CYBT-333047-02 flash memory via UART by Host processor using HCI commands

                4.) now we again apply SPI2_MOSI to GND by HOST processor

                5.) then we apply XRES and release XRES, now module should accept standard HCI commands


                Is my understanding correct?

                • 5. Re: CYBT_333047-02 via HCI interface on Raspberry Pi

                  The CYBT-333047 is a CYW20706 based module. It is shipped with EZ-Serial FW.

                  I just tested on the 333047 kit board with cybluetool. If the device is in recover mode, it only receives the HCI reset command.

                  You need to pull the CTS to high then it can receive all the standard HCI command. So please pull CTS to high in step 4. You can double check it on your own kit board.