13 Replies Latest reply on Mar 29, 2016 1:33 PM by ShawnA_01

    Newbie

      I am about as new as a guy can get.  I am just learning C programming.  I have never used an Arm processor.  I have never used the WICED IDE.  I do have a few years of experience programming Microchip parts, but that was all in assembly.  I find a lot of the questions and answers on the forum assume a certain level of knowledge and are not very helpful for starters.  I am trying to develop a Wi-Fi device based on the BCM943341.  Is there a good resource to get information/training?

        • 1. Re: Newbie
          ShawnA_01

          The first thing to do, is download the latest SDK which is version 3.5.2 from here: WICED SDK 3.5.2 IDE Installer and .7z Source files

           

          Follow the installer prompts. Afterwards, on the Project Explorer Tab (left side), expand the ~doc directory.  Inside there, read the Quick Start Guide (WICED-QSG204).pdf).

           

          Explore all the nifty code-snippets found in the ~apps/snip directory.   Explore the more full-featured code samples found in ~apps/demo.

           

          Read all the blogs:   WICED Studio Wi-Fi/Combo Forums

           

          Browse the forums!  There is more technical content in here than you can imagine.   Try not to create new discussions since they've most likely already been asked.

          • 2. Re: Newbie

            Thanks shawn.  I appreciate the response.  As I said I am very new to all of this and a lot just goes over my head.  I have downloaded and installed the WICED SDK 3.5.2 IDE.  I have read the Quick Start Guide and run some of the demos.  I have spent hours searching the forums and have found some help.  Right now I am trying to do some simple read and write to an external I2C EEPROM.  I have downloaded and run the i2c_led.  This has helped me configure the SDA and SCL.  I do have those working.

             

            Here is my main problem (and don't laugh).  I look at the APIs and I just don't understand enough to know how to use them.  I am looking for very simple examples on how to use wiced_i2c_init, wiced_i2c_read and wiced_i2c_write.

             

            Are there any good resources to help a beginner to learn how to really use the APIs?  The WICED API Reference Guide does not have any real examples and is not helpful to a true beginner.

            • 3. Re: Newbie
              MichaelF_56

              dami_1782251

               

              The Zentri board is much better suited for a beginner as it provides a higher level interface for most functionality, yet still allows you to manipulate code to make changes.  Their OS/Application essentially runs on top of our WWD driver layer, so it is WICED based, but quite a bit more user friendly.

               

              Take a look at some of the blogs that userc_6124 has created. 

               

              The WICED SDK is better suited for developers with a few years of experience under their belt.

              1 of 2 people found this helpful
              • 4. Re: Newbie

                I have been given this as a project at work, so I have no choice except to learn the WICED SDK.  Hopefully I am not too stupid.  So let me ask a specific question.  I started with the i2c_led demo.  It builds and works.  So I tried adding wiced_i2c_read.  Now I get the following error:

                WICED-SDK/WICED/platform/MCU/STM32F4xx/../wiced_platform_common.c:238: undefined reference to `platform_i2c_read'

                tools/makefiles/wiced_elf.mk:224:

                 

                How do I fix that?

                • 5. Re: Newbie

                  dmiller,

                   

                  if that question is to me.... ndutton;

                  then I would direct you to the I2C demo's in the ZentriOS SDK as a starting place.

                   

                  We have multiple examples on the Zentri Docs page (http://docs.zentri.com).

                   

                  I posted an example here: Beginners guide to ZentriOS : Simple 8x8 LED Matrix via I2C

                  1 of 1 people found this helpful
                  • 6. Re: Newbie
                    ShawnA_01

                    I have both the WICED WiFi SDK 3.5.2 installed, and also the WICED (Blutooth Low Energy) SDK 2.2.2 installed -- neither one of these have the i2c_led demo file(s).   

                     

                    Are you using the AppleHomekit enabled Broadcom SDK by chance? 

                     

                    What does your make-target look like so I can try to reproduce your issue?

                     

                    Does your source code have a #include wiced_platform.h statement and/or #include i2c.h in it -- at an acceptable location?  (again I have no way to test right now, so this is just a guess)

                    • 7. Re: Newbie
                      ShawnA_01

                      Hi,

                       

                      A colleague informed me Broadcom offers an I2C LED example - which can get integrated into the Broadcom SDK. That blog is found here:  I2C Interface Example with WICED SDK-3.x

                       

                      I took the platform.h and platform.c files form the Blog, put them into the SDK3.5.2 directory structure, and using snip.i2c_led-BCM943362WCD4 as a make-target, I had No issue compiling the code.

                       

                      Did you try to perform a make-clean before your experiment?  (I did).

                       

                      14:43:54 **** Build of configuration Default for project WICED-SDK ****

                      "C:\\Users\\santol\\Documents\\WICED\\WICED-SDK-3.5.2\\WICED-SDK\\make.exe" snip.i2c_led-BCM943362WCD4

                      MAKEFILE MAKECMDGOALS=snip.i2c_led-BCM943362WCD4 OTA2_SUPPORT is disabled

                      Making config file for first time

                      +-----------------------------------------------------------------------------------------------------+

                      | IMPORTANT NOTES                                                                                     |

                      +-----------------------------------------------------------------------------------------------------+

                      | Wi-Fi MAC Address                                                                                   |

                      |    The target Wi-Fi MAC address is defined in <WICED-SDK>/generated_mac_address.txt                 |

                      |    Ensure each target device has a unique address.                                                  |

                      +-----------------------------------------------------------------------------------------------------+

                      | MCU & Wi-Fi Power Save                                                                              |

                      |    It is *critical* that applications using WICED Powersave API functions connect an accurate 32kHz |

                      |    reference clock to the sleep clock input pin of the WLAN chip. Please read the WICED Powersave   |

                      |    Application Note located in the documentation directory if you plan to use powersave features.   |

                      +-----------------------------------------------------------------------------------------------------+

                      MAKEFILE MAKECMDGOALS=snip.i2c_led-BCM943362WCD4 OTA2_SUPPORT is disabled

                      Building Bootloader

                      Finished Building Bootloader

                       

                       

                      Processing resources

                      Creating security credentials

                      Making DCT image

                      Compiling App_I2C_Led

                      Compiling Platform_BCM943362WCD4

                      Compiling WICED

                      Compiling Lib_SPI_Flash_Library_BCM943362WCD4

                      Compiling Lib_GPIO_button

                      Compiling WWD_ThreadX_Interface

                      Compiling WICED_ThreadX_Interface

                      Compiling WWD_for_SDIO_ThreadX

                      Compiling Supplicant_BESL

                      Compiling Lib_DNS

                      Compiling NetX_Duo

                      Compiling Lib_Wiced_RO_FS

                      Compiling STM32F2xx

                      Compiling Lib_TLV

                      Compiling Lib_base64

                      Compiling Lib_crypto_open

                      Compiling Lib_micro_ecc

                      Compiling WWD_NetX_Duo_Interface

                      Compiling WICED_NetX_Duo_Interface

                      Compiling common_GCC

                      Compiling STM32F2xx_Peripheral_Drivers

                      Compiling Lib_Ring_Buffer

                      Compiling Lib_crc

                      Compiling Lib_DHCP_Server

                      Compiling Lib_Linked_List

                      Compiling STM32F2xx_Peripheral_Libraries

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/App_I2C_Led.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Platform_BCM943362WCD4.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/WICED.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_SPI_Flash_Library_BCM943362WCD4.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_GPIO_button.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/WICED_ThreadX_Interface.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Supplicant_BESL.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_DNS.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/WWD_ThreadX_Interface.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/WWD_for_SDIO_ThreadX.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/NetX_Duo.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_Wiced_RO_FS.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/STM32F2xx.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_TLV.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_base64.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_micro_ecc.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/WICED_NetX_Duo_Interface.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/common_GCC.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_crypto_open.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/STM32F2xx_Peripheral_Drivers.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/WWD_NetX_Duo_Interface.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_Ring_Buffer.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_crc.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_DHCP_Server.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/Lib_Linked_List.a

                      Making build/snip.i2c_led-BCM943362WCD4/libraries/STM32F2xx_Peripheral_Libraries.a

                      Making snip.i2c_led-BCM943362WCD4.elf

                       

                       

                      Making snip.i2c_led-BCM943362WCD4.bin

                      snip.i2c_led-BCM943362WCD4

                      ----------------------------------|---------|---------|

                                                        |         |  Static |

                                    Module              |  Flash  |   RAM   |

                      ----------------------------------+---------+---------|

                      App                               |     878 |      12 |

                      crc                               |    1060 |       0 |

                      Host MCU-family library           |   13186 |    2485 |

                      Interrupt Vectors                 |     388 |       0 |

                      libc                              |   23423 |    3064 |

                      Networking                        |     941 |    8455 |

                      NetX-Duo - Interfaces & Stacks    |       0 |      16 |

                      Other                             |    3518 |      92 |

                      Packet Buffers                    |       0 |   23086 |

                      platform                          |    1076 |     168 |

                      RAM Initialisation                |    2324 |       0 |

                      resources                         |      16 |       0 |

                      Ring_Buffer                       |      92 |       0 |

                      Startup Stack & Link Script fill  |       9 |       3 |

                      ThreadX                           |    7668 |     396 |

                      Wi-Fi Firmware                    |  210624 |       0 |

                      WICED                             |    2731 |     928 |

                      WWD                               |   11450 |    2991 |

                      ----------------------------------+---------+---------|

                      TOTAL (bytes)                     |  277060 |   41696 |

                      ----------------------------------|---------|---------|

                       

                       

                      Build complete

                      Making .gdbinit

                       

                       

                      14:44:50 Build Finished (took 56s.81ms)

                      • 8. Re: Newbie

                        shawn

                        I used the same i2c_led downloaded from the forums.  I was able to build and run on the BCM943341.

                         

                        After running it, I tried to make a simple modification.  I declared an array (uint8_t EepromBuffer[256]) and added the following line: result = wiced_i2c_read(&i2c_device, 0, EepromBuffer, 8);  My hope was to read 8 bytes of data from an external EEPROM on the I2C bus.  Adding this line gave me this error:

                        WICED-SDK/WICED/platform/MCU/STM32F4xx/../wiced_platform_common.c:238: undefined reference to `platform_i2c_read'

                        tools/makefiles/wiced_elf.mk:224: recipe for target 'build/demo.i2c

                         

                        wiced_i2c_read is taken from the API.  Why would this create a problem?  How do I correct it?

                        • 9. Re: Newbie
                          ShawnA_01

                          The function declaration of wiced_i2c_read() states:  wiced_result_t wiced_i2c_read( const wiced_i2c_device_t* device, uint16_t flags, void* buffer, uint16_t buffer_length )

                           

                          From this, the first parameter passed is a pointer to a static structure of type wiced_i2c_device_t.  I suspect you've never created this data structure in your code - which is why you're getting the undefined reference to `platform_i2c_read'.

                           

                          For example, there is an example structure found in ~libraries/drivers/power_management/max17040/max17040.c stating:

                           

                          static wiced_i2c_device_t maxim17040 =

                          {

                              .port          = WICED_I2C_1,

                              .address       = 0x36,

                              .address_width = I2C_ADDRESS_WIDTH_7BIT,

                              .flags         = 0,

                              .speed_mode    = I2C_HIGH_SPEED_MODE,

                          };

                           

                          Later in this same code we see:

                           

                          /* Read bytes from maxim register address into read_buffer */

                              if (wiced_i2c_read(&maxim17040, WICED_I2C_REPEATED_START_FLAG | WICED_I2C_STOP_FLAG, read_buffer, read_buffer_size) != WICED_SUCCESS)

                              {

                                  return WICED_ERROR;

                              }

                           

                           

                          In your firmware, you are trying:  result = wiced_i2c_read(&i2c_device, 0, EepromBuffer, 8)

                           

                          Do you have a wiced_i2c_device_t structure declared for i2c_device representing the physical I2C EEPROM on your board?

                          • 10. Re: Newbie

                            shawn,

                             

                            I modified the original wiced_i2c_device_t that is in the i2c_led.c

                             

                            static wiced_i2c_device_t i2c_device =

                            {

                                .port          = WICED_I2C_1,

                                .address       = 0x50,

                                .address_width = I2C_ADDRESS_WIDTH_7BIT,

                                .speed_mode    = I2C_STANDARD_SPEED_MODE,

                            };

                             

                            When I run the code with no other changes it does work and I am getting results from my I2C device.  I wanted to use the i2c_read API as a simple way to read my device.  My application requires a simple routine to read the external EEPROM at power up.  It will write data occasionally, but only when there is new data to be stored.  It is actually very simple or at least it should be.

                            • 11. Re: Newbie
                              ShawnA_01

                              The “wiced_i2c_read(…)” and “wiced_i2c_write(…)” functions are only available for the BCM4390x MCU from Broadcom.

                               

                              For other MCUs, such as STM32Fxxx, Atmel, NXP, etc, please use wiced_i2c_transfer(…) to interface to the I2C devices.

                              • 12. Re: Newbie

                                Can I ask where you found that little bit of info?  Thanks for finding it and letting me know.

                                • 13. Re: Newbie
                                  ShawnA_01

                                  After you install a fresh copy of the SDK, you should Index the files to make the search results valid.

                                   

                                  To do that, Right Click WICED-SDK in the Project Explorer Tab, then Index|Rebuild, as shown below:

                                   

                                  Afterwards, Do a File Search (via CTRL-H) in Eclipse for "wiced_i2c_read".   Expand the Search Tab on the right and you'll see it lives in wiced_platform_common.c (look at Line 229).  Ultimately, at the bottom of that function you can see the lower level function called "platform_i2c_read" gets invoked:

                                   

                                   

                                  When you then search for that function, you see that it only exists in the ~platforms/MCU/BCM4390x directory: