Programming the 20732S MODULE USING 2073xTAG Board v. 1.0
TTL-232RG-VREG3V3-WE - defined correct cable with 3V Output
Removed SPIL, Added NEW Loader file and LOTS of corrections
Corrections to Switch settings, correct Loader zip files for TAG2, TAG3
|1.5||Example for command line programming of Serial FLASH||01/18/16|
Section 1: Overview
This application note describes two recommended procedures of programming the Broadcom BCM2073xTAG board.
Programming the TAG2 (BCM20732 device)
The programming procedure utilizes the Broadcom WICED-Smart-SDK-1.1.0-IDE-Installer that may be downloaded from our Broadcom WICED Community site - WICED-Smart-SDK-1.1.0-IDE-Installer
Programming the TAG3 (BCM20737 device)
The programming procedure utilizes the Broadcom WICED-Smart-SDK-2.2.0-IDE-Installer that may be downloaded from our Broadcom WICED Community site - WICED-Smart-SDK-2.2-IDE-Installer (Windows)
The production environment rarely allows for the compete SDK at the programming station and Broadcom has enabled
programmability utilizing a command line utility loader program that may be downloaded from the attachment below.
The following sections describe the BCM2073xTAG programming procedure:
Section 1: “Overview,” lists the links for the SDK.
Section 2: “BCM20732TAG Setup: Component/Switch Locations,” contains the setup.
Section 3: “BCM2073xTAG Setup: Component/Switch Locations,” contains the setup.
Section 4: “USB Connection to the PC,” describes the USB enumeration preparation process.
Section 5: “Setup for Command Line Programming.
Section 6: "Command Line Programming Procedure using the Loader.exe,” describes the Command Line Tool.
Section 7: “Hex File and BD_ADDR Configurations in Development and Mass Production", describes engineering development of BD_ADDR and Final Configuration for Mass Production.
Section 2: BCM20732TAG Setup:
Component/Switch Locations BCM20732/BCM2073x TAG Board Configuration
1. BCM20732TAG - Locate the SW2 and SW3 Pins on the Board
Figure 1: BCM20732 TAG2 Switches and Buttons
2. BCM20732TAG - Place the SW2 and SW3 to the UP Positions as shown:
3. BCM20732TAG - All Dip switches should be in the ON(Up) Position as shown below:
Figure 4: BCM20732 TAG2 4 Pin Switch Settings
Section 3: BCM2073xTAG Setup: Component/Switch Locations
BCM2073xTAG Board Configuration
1. Locate the SW3 and SW3 Pins on the BCM20737TAG Board
Figure 6: BCM20737TAG Switches and Buttons
2. Place the SW2 to UP Position and SW3 to the DOWN Position as shown:
Figure 7: BCM20737TAG SW2 Up and SW3 Down Positions
Figure 8: BCM20737TAG Dip Switch
4. Place the Dip Switch positions should be in the ON(Up) Position as shown below:
Figure 9: BCM2073xTAG3 4 Pin Switch Settings
Section 4: USB Enumeration Connection to the PC
USB Enumeration of the BCM2073xTAG Board
The BCM2073xTAG board must be enumerated by the Programing PC. The FTDI chip on the TAG Board will enumerate the device on the Device Manager under the Ports Section as shown below:
Figure 10: Sample COM Port before 20732TAG USB Insertion
1. Open up the Device Manager in the Control Panel as shown above.
2. Insert the USB Cable (Connected to the USB Port on the BCM2073xTAG board) to enumerate the Device Driver for the FTDI chip on the Board.
Figure 11: Correct FTDI Cable
b. This enables the programming of the BCM2073x devices without the need for a JTAG Interface
c. Note that Serial Wire Debug (SWD) debug/trace messages can also be output through the HCI UART port that’s onboard.
d. The SWD pins are muxed with HCI UART and are used in such a manner that the hardware and firmware can auto-detect the presence of SWD or the HCI host
e. This means that HCI based download (programming) and SWD (debugging) are mutually exclusive of one another.
b. Power your board up while making sure that RXD is held high during power up. Note that by default this pin is pulled low through an internal 10k ohm resistor
c. Program the board using the Broadcom IDE just as you would if a BCM20732S Tag board were connected.
4. As an example, the BCM2073xTAG board has been enumerated as COM16 as shown below:
Figure 12: Sample COM AFTER 2073xTAG USB Insertion – COM16 Enumerated
If you’re not familiar with the installation of the drivers for your TAG board, refer to the WICED Smart™ Quick Start Guide found in the ~Docs folder of the SDK.
Section 5: Programming
Section 5.1: Software Programming Setup
Broadcom BCM20732x devices are be programmed using either the SDK Developer’s Tools or by using a command line tool called loader.exe.
The Loader directory of files to download can be found as an attachment at the bottom of this BLOG.
The SDK combined with the BCM2073xTAG Board provide the developer a convenient methodology for programming the BCM2073x or BCM2073xS Modules discussed below or for the developer’s Pre-Production Board.
To prepare the Production Board for Mass Production programming, the Loader command line tools provide a convenient process to automate the programming at a contract manufacturing facility or at a distribution programming center.
You will also need the ChipLoad.exe file attached at the bottom of this BLOG.
Section 5.2 System Programming Tools Setup:
The programming ecosystem of the BCM2073x/BCM2073xS devices involves the use of executable files both compile and produce necessary files for use in programming the modules.
The first file needed is the cgs.exe file to enable the board address (BD_ADDR) programming at the time of production.
The cgs.exe file is included in the SDK Directory (WICED\WICED-Smart-SDK-x.x.x\WICED-Smart-SDK\Tools\CGS\Win32) as shown below but can also be extracted from the loader.zip file located on the WICED SMART Community Forums download page located at the bottom of this BLOG.
Figure 13: Location of cgs.exe
The second file needed is the chipload.exe file to download the programming file to the programmer at the time of production.
The Chipload.exe file is included in the SDK Directory (WICED\WICED-Smart-SDK-x.x.x\WICED-Smart-SDK\Tools\ChipLoad\Win32) as shown below but can also be extracted from the loader.zip file located on the WICED SMART Community Forums download page located at the bottom of this BLOG.
Figure 14: Location of ChipLoad.exe
The cgs file can also be edited in the SDK Build window as shown below:
The third file needing editing for programming is the EEPROM file BCM2073xAx.cgs file. The cgs file is located in the SDK Directory (WICED\WICED-Smart-SDK-x.x.x/build/hello_sensor-BCM*_Q32-rom-ram-Wiced-release/A_*-hello_sensor-rom-ram-spar.cgs as shown below.
This is the file uses to program the EEPROM with the customer application.
Figure 15: Location of 20737_EEPROM.cgs file
The fourth file needing editing for programming is the EEPROM file 2073x_EEPROM.btp file.
The btp file is located in the SDK Directory (WICED\WICED-Smart-SDK-x.x.x\WICED-Smart-SDK\Platforms\BCM2073xTAG_Q32) as shown below.
This is the file uses to program the EEPROM with the customer application.
Figure 16: Location of 2073x_EEPROM.btp file
Section 6: Command Line Programming Procedure using the Loader.exe
Using the Loader Software Command Line Tools
The Loader Software tool utilizes a Command Line Tool to call the appropriate programming files to program the same BD_ADDR programming as the SDK Tool Chain, but in used in the volume programming environment.
Programming Procedure using Cygwin utility
The Cygwin Utility can be found at: http://www.cygwin.com/install.html is used to execute the Loader commands and accesses the appropriate configuration files used in the programming procedure.
NOTE: Cygwin is a 32GB file that takes time to download and install
Below is an example of using Cygwin to execute the Loader command line utilities.
Please observe the highlighted files described previously:
Figure 17: Contents of Loader.zip file at bottom of BLOG
Figure 18: Cygwin BCM2073x File Location
NOTE: You need to move the files highlighted above into the cygwin\home\<your name>\ directory under Cygwin.
Section 6.1 Converting cgs file to hex file
The following procedure converts the cgs file to a hex file:
1. Using Cygwin Tools installed above, type the following command:
a. ./cgs.exe -I <output_file_name.hex> –A 0xFF000000 –B <btp_file.btp> -D <file.hdf>
Note: -D refers to a different directory
b. Example below:
./cgs.exe –I output.hex –A 0xFF000000 –B 20732_TAG32_EEPROM.btp –D . A_20732A0-bleprox_mod-rom-ram-spar.cgs
3. Definitions of parameters:
a. output_file_name.hex – will be the converted hex file.
b. btp_file.btp – btp file for the 2073x_TAG board.
c. input_file.cgs – built cgs file for the application from the SDK
d. 0xFF000000 – base address for the EEPROM
e. File.hdf - directories for hdf file
Results of the successful command execution:
Figure 19: Converting cgs file to hex file success
Section 6.2 Downloading the hex file
The following procedure downloads the hex file:
1. Run chipload.exe using the following command:
a. ./Chipload.exe –BLUETOOLMODE –PORT COM16 –BAUDRATE 115200nfc –MINIDRIVER <minidriver.hex> -CONFIG <output_file_name.hex> -BTP <btp_file.btp> -NODLMINIDRIVER
b. Example Below:
./chipload.exe –BLUETOOLMODE –BAUDRATE 115200nfc –PORT COM16 –MINIDRIVER uart_64bytes_DISABLE_EEPROM_WP_PIN1.hex –CONFIG output.hex –NODLMINIDRIVER –BTP 20732_TAG32_EEPROM.btp
3. Definitions of parameters:
a. COM16 – connected port as connected thru enumeration
b. btp_file.btp – btp file for the TAG Board
c. Output_file_name.hex – converted hex file.
d. btp_file.btp – btp file for the TAG
e. minidriver - Loads the Hex file into EEPROM or SFLASH image.
- The MiniDriver uses P1 as the Write Protect Pin
- If you use a different pin for Write Protect, then the MiniDriver will NOT work.
- MiniDriver is specific to the P1 Write Protect Pin because it is driven LOW before Writing begins.
f. Chipload.exe - Runs the MiniDriver and does the CheckSum
- Chipload loads the image and does the CRC
- If it returns "0", it PASSES
- If it returns "1", it will PRINT the errors that were encountered
Results of the successful command execution:
Figure 20: Hex File Command Success
Results of the successful hex file download execution:
Figure 21: Download is completed successfully
The key to programming procedure is to know the state of the device:
1. If device has never been programmed OR device is in recovery mode:
- Add –NODLMINIDRIVER to chipload.exe
2. If device has been successfully programmed before AND it is not in recovery mode:
- Do *not* add –NODLMINIDRIVER to chipload.exe
3. If in doubt, always use recovery mode.
The following example shows the command line for programming Serial FLASH:
$ ./chipload.exe -BLUETOOLMODE -PORT COM100 -BAUDRATE 115200nfc -MINIDRIVER uart_64bytes_DISABLE_EEPROM_WP_PIN1.hex -CONFIG output.hex -BTP 20737_SFLASH.btp
Download minidriver successfully had written 251 bytes to address 0x0020AF00
Download minidriver successfully had written 251 bytes to address 0x0020AFFB
Download minidriver successfully had written 251 bytes to address 0x0020B0F6
Download minidriver successfully had written 251 bytes to address 0x0020B1F1
Download minidriver successfully had written 251 bytes to address 0x0020B2EC
Download minidriver successfully had written 251 bytes to address 0x0020B3E7
Download minidriver successfully had written 251 bytes to address 0x0020B4E2
Download minidriver successfully had written 251 bytes to address 0x0020B5DD
Download minidriver successfully had written 251 bytes to address 0x0020B6D8
Download minidriver successfully had written 251 bytes to address 0x0020B7D3
Download minidriver successfully had written 251 bytes to address 0x0020B8CE
Download minidriver successfully had written 251 bytes to address 0x0020B9C9
Download minidriver successfully had written 251 bytes to address 0x0020BAC4
Download minidriver successfully had written 251 bytes to address 0x0020BBBF
Download minidriver successfully had written 251 bytes to address 0x0020BCBA
Download minidriver successfully had written 251 bytes to address 0x0020BDB5
Download config successfully had verified 167 bytes at address 0xFF004B58: 78 25 30 38 58 2C 20 55 47 20 6C 65 6E 67 74 68 3A 20 30 78 25 30 38 58 00 0D 75 70 67 72 61 64 65 20 63 6F 6D 70 6C 65 74 65 2C 20 70 65 72 66 6F 72 6D 20 72 65 73 65 74 00 49 6E 76 61 6C 69 64 61 74 65 64 20 4F 6C 64 20 53 53 2E 00 0A 4C 00 BC 9E 20 00 0A 48 0B 49 08 B5 88 42 02 D0 0A 4A 35 F6 4C FE 00 22 09 49 09 48 35 F6 8D FE 09 4A 09 4B 22 F0 0F 02 1A 60 BD E8 08 40 FE F7 B4 BB 60 9A 20 00 60 9A 20 00 00 00 00 00 5C 04 00 00 60 9A 20 00 DC 9E 20 00 50 0F 20 00 0B 04 00 BD 9E 20 00 FE 00 00
Chip reset to address 0x00000000 succeeded
Downloaded 0 code bytes ( 0.0%) and 18279 data bytes (100.0%). Verified 0 code bytes ( 0.0%) and 18279 data bytes (100.0%). Current state: Completed successfully
A total of 2 contiguous memory areas were filled:
[FF000000..FF000027] DATA (40 bytes)
[FF0004C0..FF004BFE] DATA (18239 bytes)
Section 6.3 Hex File and BD_ADDR and Descriptions in Development
The WICED SMART SDK build process allows the programming of the BD_ADDR.
Below are the following steps:
1. The SDK is able to program some of the BD_ADDR bytes with random values or
2. The user can edit Platforms/BCM920736ATAG_Q32/20732_EEPROM.btp file and set DLConfigBD_ADDRBase to the desired value.
3. To use random address set DLConfigBD_ADDRBase = "20736A0*****" where every “*” will be replaced with a random value.
Section 6.4 SDK 2.0 HDF File Changes
The WICED SMART SDK 2.2 .hdf file is now in binary form.
Figure 22: Binary Form of .hdf file
Section 7 Hex File and BD_ADDR Configurations in Development and Mass Production
BCM2073x Design: Using the BCM20736 in SDK 2.2 from the Platforms Directory
Figure 23: Binary Form of .hdf file
Ex: DLConfigBD_ADDRBase = “20736A1*****”
1. Previously in SDK 1.1 this was the same Random Address on all computers.
2. Now, in SDK 2.2 it is random per computer that you use.
3. If you have 2 computers, it will generate 2 different Random addresses.
4. Everyone in your development team downloads on different computers, everyone will get different addresses.
5. However, in Development, the same bluetooth address when you reload the application.
6. Programing multiple boards on the same computer you will get the same address.
7. In the BUILD target say Device BD_ADDR = BD_ADDR or
8. Device BD_ADDR = Random and Make will generate a random number.
9. Each “*” is a random nibble – so you can place the “*” in the middle and have *1234.
a. Programming 4 devices on the same PC.
11. BD_ADDR goes into a file that the application does not have access.
12. It is loaded into a completely different sector
13. We can include it in one of the build targets to show users the option is there.
Figure 24: BT_DEVICE_ADDRESS in the Makefile
14. You want your board to have a specific BD_ADDR:
a. You can modify the Make Target:
b. For instance in i2c_temperature_sensor-BCM920736TAG_Q32 download:
Figure 25: _i2c_temperature_sensor selected
c. You can assign 6 bytes in Hex to the Target Name:
Figure 26: 6 Bytes assigned to Target Name
e. Here we did BT_DEVICE_ADDRESS=20736A112345
f. This is in the Quick Start Guide on the Make Target
g. Or you can put BT_DEVICE_ADDRESS=random
h. This will be random every time we do a build.
i. So this may be a good option for the user INSTEAD of the cgs.exe
j. The *.btp file parameters that you can change:
- ConfigDSLocation – Dynamic Section – This is where the code and the Config is stored
- DLConfigVSLocation = is where your Link Keys are stored
- We need 1K for at least 5 devices paired at the same time – Takes up 600 bytes. And this is all in EPROM Layout
Section 7.1 Hex File and BD_ADDR and Descriptions in Production
1. The WICED SMART SDK build process produces 2 hex files.
2. What is downloaded in the factory during mass production is the factory <app_name>-<platform>-rom-ram-Wiced-release.hex
3. This is the factory image and includes the BD_ADDR.
4. The SDK and will program some of the BD_ADDR bytes with random values or
5. The user can edit Platforms/BCM920732ATAG_Q32/20732_EEPROM.btp file and set DLConfigBD_ADDRBase to the desired value.
6. To use random address set DLConfigBD_ADDRBase = "20732A0*****" where every “*” will be replaced with a random value.
1. ChipLoad.exe loads the hex file into EEPROM or SFLASH depending on your configuration.
2. Once you generate the .hex file, you know were the BD_ADDR is going to be: Byte 21 offset
3. Jump to 21 Byte location and then generate the next 6 Bytes for the BD_ADDR and then you are done!
Please feel free to add comments and questions and I will update appropriately.