6.4.3 Software requirements
1. Patch/Configuration data in header (.h) file format STSW-WBC86FWBPP
2. STWLC NVM programming reference code
3. STM32CubeIDE
6.4.4 Source files
The source files included in the reference code are listed below.
1. STWBC86.h
– Provides NVM programming API and holds the structure and register definitions of STWBC86.
2. STWBC86.c
– Main file which describes the NVM related programming sequences and I2C Write/WriteRead
operations.
3. nvm_data.h
– Patch and Configuration data in Header file format to be programmed into the chip.
6.4.5 Reference code porting procedure
1. Create a new project in the STM32CubeIDE with an STM32 development board. Visit the
STMicroelectronics website for STM32CubeIDE documentation.
2. Enable the I2C and UART features of STM32.
Figure 68. Connectivity
3. Copy STWBC86.h, STWBC86.c, and nvm_data.h into the main directory (Core/Src).
4. Add the following code into Core/Src/main.c.
a. Include the Header file
/* USER CODE BEGIN includes */
#include "STWBC86.h"
/* USER CODE END includes */
b. Configure I2C and UART master in main()
/* USER CODE BEGIN 2 */
// WLC - initialize I2C and UART peripheral
hi2c = &hi2c1;
huart = &huart3;
c. Execute NVM programming
// WLC - display chip information
char buff[PAGE_SIZE] = {0};
chip_info_show(buff);
pr_info(buff);
// WLC - perform NVM programming
/* USER CODE END 2 */
pr_info(buff);
nvm_program_show(buff);
memset(buff, 0, PAGE_SIZE);
UM3161
Reference code with STM32 development boards
UM3161 - Rev 1
page 53/78