4 Replies Latest reply on Feb 1, 2019 12:39 AM by XinghaoZ_26

    Question problem i2c CYW20706 & CYBT-343026-eval

    JeRi_3276026

      Please can you explain the Hardwaruser-guide code

      BSC-i2c

      /*code*/

      include wiced_hal_i2c.h.

       

      #define I2C_SLAVE_ADDRESS (0x76)

      #define I2C_SLAVE_OPERATION_READ 0

      #define I2C_SLAVE_OPERATION_WRITE 1

       

      void test_i2c_driver( void )

       

      {

      /*What does it mean ="123456" ¿number bytes?*/

      uint8_t data_array[] = "123456";

       

      wiced_hal_i2c_init(WICED_I2C_SDA_P35_SCL_P37);

      wiced_hal_i2c_get_speed( );

      wiced_hal_i2c_set_speed( I2CM_SPEED_100KHZ );

      wiced_hal_i2c_write( data_array, sizeof( data_array ), I2C_SLAVE_ADDRESS);

      wiced_hal_i2c_read( data_array, sizeof( data_array ), I2C_SLAVE_ADDRESS);

      WICED_BT_TRACE( "Read bytes %s\n\r", data_array );

       

       

      it does not work

      Please Help.

      Thanks you team

        • 1. Re: Question problem i2c CYW20706 & CYBT-343026-eval
          JeRi_3276026

          Route->20706-A2_Bluetooth->apps-snip->hal->i2c_master

          Files:

          i2c_master.c

          makefile.mk

           

          File->makefile.mk

          APP_SRC +=i2c_master.c

          C_FLAGS += -DWICED_BT_TRACE_ENABLE

           

          File->i2c_master.c

          //Include Library\\

          #include "wiced_bt_trace.h"

          #include "wiced_hal_i2c.h"

          //Define Variables\\

          /***************************************************************************************

          *I2C_SLAVE_ADDRESS REGISTRO 0X76 BMP238

          *I2C_SLAVE_OPERATION_READ  0  // DEFINICION DE LECTURA EN 0

          *I2C_SLAVE_OPERATION_WRITE 1  // DEFINICION DE ESCRITURA EN 1

          ****************************************************************************************/

          #define I2C_SLAVE_ADDRESS (0x76)

          #define I2C_SLAVE_OPERATION_READ 0

          #define I2C_SLAVE_OPERATION_WRITE 1

           

           

          void i2c_master (void)

          {

          uint8_t data_array[] ="123456";

          wiced_hal_i2c_init( WICED_I2C_SDA_P35_SCL_P37 );

              UINT8 I2CM_SPEED_400KHZ;

          wiced_hal_i2c_set_speed(I2CM_SPEED_400KHZ);

          wiced_hal_i2c_get_speed ();

          wiced_hal_i2c_write ( data_array , sizeof ( data_array ), I2C_SLAVE_ADDRESS );

          wiced_hal_i2c_read  ( data_array , sizeof ( data_array ), I2C_SLAVE_ADDRESS );

          WICED_BT_TRACE ("Read Bytes %\n\r" , data_array );

          }

          NAME MAKE TARGET

          snip.hal.i2c_master-CYW920706WCDEVAL download  UART=COM10  VERBOSE=1

           

          Error:

          C:\Users\*\Documents\WICED-Studio-6.2\20706-A2_Bluetooth\Wiced-BT\spar/common/sparinit.c:82: undefined reference to `wiced_bt_app_start'

          makefile:300: recipe for target '../../build/i2c_master-CYW920706WCDEVAL-rom-ram-Wiced-release/A_20703A2-i2c_master-rom-ram-spar.elf' failed

          make.exe[1]: *** [../../build/i2c_master-CYW920706WCDEVAL-rom-ram-Wiced-release/A_20703A2-i2c_master-rom-ram-spar.elf] Error 1

          make.exe[1]: Leaving directory 'C:/Users/*/Documents/WICED-Studio-6.2/20706-A2_Bluetooth/Wiced-BT/spar'

          Makefile:536: recipe for target 'snip.hal.i2c_master-CYW920706WCDEVAL' failed

          make: *** [snip.hal.i2c_master-CYW920706WCDEVAL] Error 2

          • 2. Re: Question problem i2c CYW20706 & CYBT-343026-eval
            XinghaoZ_26

            Please try the attached code. Use the following API to set the I2C speed.

            bsc_SetSpeed(BSC_CTL_SCL_xxxKHZ);

            wiced_hal_i2c_set_speed(I2CM_SPEED_xxxKHZ);

            2 of 2 people found this helpful
            • 3. Re: Question problem i2c CYW20706 & CYBT-343026-eval
              JeRi_3276026

              Please can you explain.

              I don't understand you

              You can detail what you want me to do.

               

              //Include Library

              #include "wiced_bt_trace.h"

              #include "wiced_hal_i2c.h"

              //Define Variables

              /*

              *I2C_SLAVE_ADDRESS REGISTRO 0X76 BMP238

              *I2C_SLAVE_OPERATION_READ  0  // DEFINICION DE LECTURA EN 0

              *I2C_SLAVE_OPERATION_WRITE 1  // DEFINICION DE ESCRITURA EN 1

              */

              #define I2C_SLAVE_ADDRESS (0x76)

              #define I2C_SLAVE_OPERATION_READ 0

              #define I2C_SLAVE_OPERATION_WRITE 1

               

               

              void i2c_master (void)

              {

              uint8_t data_array[] ="123456";

              wiced_hal_i2c_init( WICED_I2C_SDA_P35_SCL_P37 );

                  UINT8 I2CM_SPEED_100KHZ;

              wiced_hal_i2c_set_speed( I2CM_SPEED_100KHZ );

              wiced_hal_i2c_get_speed ();

              wiced_hal_i2c_write ( data_array , sizeof ( data_array ), I2C_SLAVE_ADDRESS );

              wiced_hal_i2c_read  ( data_array , sizeof ( data_array ), I2C_SLAVE_ADDRESS );

              WICED_BT_TRACE ("Read Bytes %\n\r" , data_array );

              }

               

              Not error the code

               

               

              Errors:

              C:\Users\Zener\Documents\WICED-Studio-6.2\20706-A2_Bluetooth\Wiced-BT\spar/common/sparinit.c:82: undefined reference to `wiced_bt_app_start'

              makefile:300: recipe for target '../../build/i2c_master-CYW920706WCDEVAL-rom-ram-Wiced-release/A_20703A2-i2c_master-rom-ram-spar.elf' failed

              make.exe[1]: *** [../../build/i2c_master-CYW920706WCDEVAL-rom-ram-Wiced-release/A_20703A2-i2c_master-rom-ram-spar.elf] Error 1

              make.exe[1]: Leaving directory 'C:/Users/Zener/Documents/WICED-Studio-6.2/20706-A2_Bluetooth/Wiced-BT/spar'

              make: *** [snip.hal.i2c_master-CYW920706WCDEVAL] Error 2

              Makefile:536: recipe for target 'snip.hal.i2c_master-CYW920706WCDEVAL' failed

              • 4. Re: Question problem i2c CYW20706 & CYBT-343026-eval
                XinghaoZ_26

                Please unzip the project to your Wiecd SDK file such as: C:\Users\zhxh\Documents\WICED-Studio-6.2.1.2\20706-A2_Bluetooth\apps\demo

                And then create a make target, program your kit board.

                2 of 2 people found this helpful