Code example for Avnet BCM4343W

Solved
sticsx's picture
sticsx
Junior(0)

Can I see some small piece of code for Avnet BCM4343W IoT Starter Kit? Just to evaluate if it is understandable to my knowledge level, before I am going to buy Starter Kit/

PeterF's picture
PeterF
Moderator(16)

Register on the Broadcom WICED WiFI forum and then download WICED-SDK-3.4.0-AWS toolsuite at:
https://community.broadcom.com/docs/DOC-2484

The examples are located in the \apps\demo\aws_mqtt folder of this SDK

 

PeterF's picture
PeterF
Moderator(16)

Note that the folder naming has changed in WICED SDK 3.5.2.
The AWS IoT examples are now located in the following folder:
...\apps\demo\aws_iot 

 

pihlung's picture
pihlung
Junior(2)

I extracted WICED-SDK 3.5.2-IDE and then I added BCM94343W_AVN directory to the platform folder.

But how do I populate the "Make Target" with the example programs? 

I assume that the apps/demo/aws_iot/pub_sub/subscriber folder contain the "Getting Started Guide" code, right clicked to create the "make target" icon. Doesn't seem to compile/download to target/work.

Please advise. Thanks.

 

PeterF's picture
PeterF
Moderator(16)

The "out-of-box" application that the Getting Started Guide document is based on, is "shadow" (ie. located in the ...\apps\demo\aws_iot\shadow folder). 

 

Three items must be attended to before building projects in WICED SDK that target the BCM4343W IoT Starter Kit:
- Add the BCM4343W_AVN Platform Files to WICED SDK
- Edit the applicable demo .mk files (shadow.mk)
- Add the compiler “Make Targets”

 

1) Add the BCM4343W_AVN Platform Files to WICED SDK
Download BCM94343W_AVN.7z platform files from the Avnet GitHub site,
Extract this 7zip archive file to the …\WICED-SDK-3.5.2\platforms folder.
(This will create the missing BCM94343W_AVN subfolder)

 

2) Edit the applicable demo .mk files (shadow.mk)
For the shadow demo app, go to apps\demo\aws_iot\shadow directory and edit shadow.mk as follows: Under the VALID_PLATFORMS section:
- add \ after BCM943438WCD1, then
- add BCM94343W_AVN to the next line
- save shadow.mk file

 

3) Add Make Target(s) to the Make Target panel
To Create Make Target, R-click on the WICED-SDK folder shown in your Make Target panel, then select New…
In the Make Target form that appears, cut+paste the following:
demo.aws_iot.shadow-BCM94343W_AVN download download_apps run
In this form, keep all check-boxes checked, then click OK

 

To launch a build + download for this target, double-click on this new Make Target…

 

An "Installation Tutorial" on this plus other aspects of developing with WICED SDK will be released shortly.... 

 

Regards
Peter
 

pihlung's picture
pihlung
Junior(2)

Thanks Peter for clear instructions! I can now build the shadow project successfully.

What is the difference between WICED-IDE and WICED Smart IDE? Or maybe should I ask if I can import bluetooth demo projects from WICED Smart IDE to WICED IDE?

andrew997's picture
andrew997
Moderator(1)

Hi,

The WICED Smart SDK is meant to target Broadcom's Bluetooth Smart (ie, BLE) Low Energy SoCs and modules.  It covers part numbers BCM20732, BCM20736, BCM20737, etc.  It's not compatible with the BCM4343W used on the Avnet module.

It won't be possible to directly import projects directly from the WICED Smart SDK to the standard WICED SDK used by the BCM4343W; the API is different and there are some key differences in syntax, especially in how GATT databases are declared.  To understand the differences I recommend looking at the "hello_sensor" projects found in both SDKs.

PeterF's picture
PeterF
Moderator(16)

WICED SMART vs the WICED SDK you are using for the BCM4343W are two completely different IDEs/API environments!
 
WICED SMART SDK
Relies on the BLE-only stack that is built into the ROM of the BCM2073x devices (which includes the profiles and low level peripheral drivers)

 

WICED SDK
Here the bluetooth functionality is achieved using something developed internally by Broadcom called BTE, that runs from flash memory of the MCU that accompanies the combo wireless device (eg. BCM4343W)

pihlung's picture
pihlung
Junior(2)

I am working on "light_sensor_controlled_window" example(analog sensor) to work the same way as the "shadow" application(on/off sensor)  with AWS and push notification to sms (if below a threshold), 

If I am sending multiple sensor values from the same starterkid_0xxx, do I need to create a thing for each sensor in AWS (starterkid_0xxxS1.. starterkid_0xxxSn)?

I have been looking for an example of a WICED multi-threaded program to handle multi sensor reading from same board without luck.

 

pihlung's picture
pihlung
Junior(2)

Hi,

In order to publish the raw light sensor value to my AWS topic, I used itoa() to convert analog reading to a string. I included stdio and stdlib as header files, but the IDE can't find itoa() in the link process. Please advise, and  let me know if there is a better way to send a analog reading to MQTT topic?

Also, is there a document that describe throughly the build process in WICED IDE?

Thanks

"

#include <stdio.h>

#include <stdlib.h>

void application_start( void )
{....

wiced_adc_take_sample( WICED_LIGHT, &light_value );

itoa(light_value,msg,10);

 ret = aws_mqtt_app_publish( app_info.mqtt_object, WICED_MQTT_QOS_DELIVER_AT_LEAST_ONCE, (uint8_t*) app_info.shadow_state_topic, (uint8_t*) msg, strlen( msg ) );

 

...

apps/demo/aws_iot/shadowAnalog/shadow.c:211:13: warning: implicit declaration of function 'itoa' [-Wimplicit-function-declaration]
             itoa(light_value,msg,10);
             ^
Making build/demo.aws_iot.shadowAnalog-BCM94343W_AVN/libraries/App_aws_shadow.a
Making demo.aws_iot.shadowAnalog-BCM94343W_AVN.elf
build/demo.aws_iot.shadowAnalog-BCM94343W_AVN/libraries/App_aws_shadow.a(shadow.o): In function `application_start':
C:\Users\pihlungpang\Documents\WICED\WICED-SDK-3.5.2\WICED-SDK/apps/demo/aws_iot/shadowAnalog/shadow.c:211: undefined reference to `itoa'
tools/makefiles/wiced_elf.mk:224: recipe for target 'build/demo.aws_iot.shadowAnalog-BCM94343W_AVN/binary/demo.aws_iot.shadowAnalog-BCM94343W_AVN.elf' failed
make.exe[1]: *** [build/demo.aws_iot.shadowAnalog-BCM94343W_AVN/binary/demo.aws_iot.shadowAnalog-BCM94343W_AVN.elf] Error 1
Makefile:220: recipe for target 'main_app' failed
make: *** [main_app] Error 2"

PeterF's picture
PeterF
Moderator(16)

Publishing data values to AWS IoT

Your question on using itoa() for integer to string conversion is an important one but it's recommended that this type of query (ie. not specific to the Avnet IoT Starter Kit) rather be posted on Broadcom's WICED Wi-Fi Community Forum where it will reach a more extensive group of WICED SDK experts (and resolution of the question will benefit a wider audience of other users)

PS: The attached shadow_light_sense project (an adaptation of the shadow example) shows one method of publishing actual light sensor data values to AWS IoT. 

Regards
Peter

 

Attachments: 
pihlung's picture
pihlung
Junior(2)

Thanks Peter. I will pay more attention to what forum I am placing a question in the future. 

mnoonan2's picture
mnoonan2
Junior(0)

Hi Peter,

Does the "wl" tool work with the Avnet BCM94343W_AVN module?  I am evaluating the radio and tools for this hardware and need to know if it is supported and also how to get it working.

Thanks, Mike

pihlung's picture
pihlung
Junior(2)

There is not much response in WICED WIFI forum. Please help me to setup/configure a AWS desired state value as a number (instead of a string that is the case in all the demo applications), or what function do I use to convert a string number to number if I can't use atoi(). Thanks

rtechgeek's picture
rtechgeek
Junior(0)

Peter,

This thread was helpful for getting an Avnet targeted build in WICED IDE,  but I need your help.   Is there ANY code example in Avnet or Broadcom's domain of the Bluetooth BLE functionality.    While I see BLE as being supported in the sales brochures, and I see some low-level object files in the build tree for BLE, I can not find any documentation or code example to implement a BLE solution with Avnet.

The only example I see is related to a dev board from Broadcom which has BT code embedded on the board.

Do you have any guidance for where to start with supporting BLE on the Avnet BCM4343W IoT Starter Kit board?

Regards,

Rob Lieb

PeterF's picture
PeterF
Moderator(16)

Rob

I suggest take a look at the following sample app that posted to the Broadcom WICED WiFi forum last week:
"BLE Central using TI CC2650 SensorTag and IBM Watson BCM4343W based IoT Quickstart"

 

This specifically targets the Avnet BCM4343W IoT Starter Kit and exercises, BLE, WiFi and MQTT broker communication with Watson IoT...

 

The demo code procedure and source files are located here:

https://community.broadcom.com/docs/DOC-3014 

 

rtechgeek's picture
rtechgeek
Junior(0)

Thank you so much,

Rob

rtechgeek's picture
rtechgeek
Junior(0)

Peter,

I got the example code working just fine and transmitting to the IBM Watson server, it supports a GATT client implementation, very nice, thanks; However, my end product will need the GATT connection to be in a Peripheral Role (the Avnet board will be the GATT Server and a phone will be the GATT client.   Is there any reference code for a simple GATT peripheral device?   Or can you refer me to a broadcom contact who can supply me one?  certainly in the absence of documentation, reference code would be the most helpful.

By the way, it appears that the MQTT software has a problem where it eventually runs out of GKI blocks (after 0 to 2000+ attributes are published on the server).  I am not sure if it is related to the responsiveness of the quickstart.internetofthings.ibmcloud.com server at IBM. If I disable the publish calls to MQTT, the code will receive 30000+ measurements without crashing.   But I can say that the reference code doesn't work flawlessly.  

Also, the build make file sensortag_cloud.mk was missing some include paths to make the build work with the WICED SDK 3.5.2.

I had to add the following: 

$(NAME)_INCLUDES   := .
$(NAME)_INCLUDES   += ../../include
$(NAME)_INCLUDES   += ../../../libraries/drivers/bluetooth_le/include
$(NAME)_INCLUDES   += ../../../libraries/drivers/bluetooth_le/BTE
$(NAME)_INCLUDES   += ../../../libraries/drivers/bluetooth_le/BTE/main
$(NAME)_INCLUDES   += ../../../libraries/drivers/bluetooth_le/BTE/WICED
$(NAME)_INCLUDES   += ../../../libraries/drivers/bluetooth_le/BTE/Components/stack/include
$(NAME)_INCLUDES   += ../../../libraries/utilities/linked_list
$(NAME)_INCLUDES   += ../../../libraries/protocols/MQTT

Regards,
Rob

jmahesh17's picture
jmahesh17
Junior(1)

Hi Peter, 

After I flashed with aws bat file, WICED is in limited connection and not able to connect to the default 192.168.0.1 to upload the ceritificates. 

 

PeterF's picture
PeterF
Moderator(16)

This can occur when you have a strong competing Wi-Fi Access Point at your location on the same channel (channel 1). I suggest try this at a different location, or hard-code the certificate info and network info into your application. (This is detailed within Part 2 of the Install Tutorials)