Welcome to mirror list, hosted at ThFree Co, Russian Federation.

readme.txt « DFU_Standalone « USB_Device « Applications « P-NUCLEO-WB55.Nucleo « Projects - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 17a6c0f70dfb734bc0007e8cb9d6e422b80b0921 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/**
  @page DFU_Standalone USB Device Firmware Upgrade (DFU) application

  @verbatim
  ******************************************************************************
  * @file    USB_Device/DFU_Standalone/readme.txt
  * @author  MCD Application Team
  * @brief   Description of the USB DFU application.
  ******************************************************************************
  *
  * Copyright (c) 2019 STMicroelectronics. All rights reserved.
  *
  * This software component is licensed by ST under Ultimate Liberty license
  * SLA0044, the "License"; You may not use this file except in compliance with
  * the License. You may obtain a copy of the License at:
  *                               www.st.com/SLA0044
  *
  ******************************************************************************
  @endverbatim

@par Application Description

Compliant implementation of the Device Firmware Upgrade (DFU)
capability to program the embedded Flash memory through the USB peripheral.


At the beginning of the main program the HAL_Init() function is called to reset all the peripherals,
initialize the Flash interface and the systick. The user is provided with the SystemClock_Config()
function to configure the system clock (SYSCLK). The Full Speed (FS) USB module uses
internally a 48-MHz clock, which is generated from an integrated PLL.

The DFU transactions are based on Endpoint 0 (control endpoint) transfer. All requests and status
control are sent/received through this endpoint.

The Internal flash memory is split as follows:
 - DFU area located in [0x08000000 : USBD_DFU_APP_DEFAULT_ADD-1]: Only read access
 - Application area located in [USBD_DFU_APP_DEFAULT_ADD : Device's end address]: Read, Write, and Erase
   access

In this application, two operating modes are available:
 1. DFU operating mode:
    This mode is entered after an MCU reset in case:
     - The DFU mode is forced by the user: the user presses the key sw2 button.
     - No valid code found in the application area: a code is considered valid if the MSB of the initial
       Main Stack Pointer (MSP) value located in the first address of the application area is equal to
       0x2000

 2. Run-time application mode:
    This is the normal run-time activities. A binary which toggles LED2 on the P-NUCLEO-WB55 board is
    provided in Binary directory.

@note After each device reset (unplug the P-NUCLEO-WB55 board from PC), Plug the P-NUCLEO-WB55 board with Key User push-button (SW1) button
pressed to enter the DFU mode.

Traditionally, firmware is stored in Hex, S19 or Binary files, but these formats do not contain the
necessary information to perform the upgrade operation, they contain only the actual data of the program
to be downloaded. However, the DFU operation requires more information, such as the product identifier,
vendor identifier, Firmware version and the Alternate setting number (Target ID) of the target to be
used, this information makes the upgrade targeted and more secure. To add this information, DFU file
format is used. For more details refer to the "DfuSe File Format Specification" document (UM0391).

To generate a DFU image, download "DFUse Demonstration" tool and use DFU File Manager to convert a
binary image into a DFU image. This tool is for download from www.st.com
To download a *.dfu image, use "DfuSe Demo" available within "DFUse Demonstration" install directory.

Please refer to UM0412, DFuSe USB device firmware upgrade STMicroelectronics extension for more details
on the driver installation and PC host user interface.

@note A binary which toggles LED1 on the P-NUCLEO-WB55 board is provided in Binary directory.

@note The application needs to ensure that the SysTick time base is set to 1 millisecond
      to have correct HAL configuration.

@note Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds)
      based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from
      a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower)
      than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
      To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function.

@note The build-in USB peripheral of the stm32wbxx does not provide a specific interrupt for USB cable plug/unplug
      detection. The correct way to detect the USB cable plug/unplug is to detect the availability of the VBUS line
      using a normal GPIO pin (external interrupt line).


@par USB Library Configuration

It is possible to fine tune needed USB Device features by modifying defines values in USBD configuration
file “usbd_conf.h” available under the project includes directory, in a way to fit the application
requirements, such as:
 - USBD_DFU_APP_DEFAULT_ADD, specifying the address from where user's application will be downloaded.

Device's end address is the end address of the flash memory and it is dependent on the device in use.

@par Keywords

Connectivity, USB_Device, USB, DFU, Firmware upgrade

@par Directory contents

  - USB_Device/DFU_Standalone/Core/Src/main.c                           Main program
  - USB_Device/DFU_Standalone/Core/Src/system_stm32wbxx.c         stm32wbxx system clock configuration file
  - USB_Device/DFU_Standalone/Core/Src/stm32wbxx_it.c             Interrupt handlers
  - USB_Device/DFU_Standalone/Core/Src/stm32wbxx_hal_msp.c        HAL MSP Module
  - USB_Device/DFU_Standalone/USB_Device/App/usb_device.c               USB Device application code
  - USB_Device/DFU_Standalone/USB_Device/App/usb_desc.c                 USB device descriptor
  - USB_Device/DFU_Standalone/USB_Device/App/usbd_dfu_flash.c           Internal flash memory management
  - USB_Device/DFU_Standalone/USB_Device/Target/usbd_conf.c             General low level driver configuration
  - USB_Device/DFU_Standalone/Core/Inc/main.h                           Main program header file
  - USB_Device/DFU_Standalone/Core/Inc/stm32wbxx_it.h             Interrupt handlers header file
  - USB_Device/DFU_Standalone/Core/Inc/stm32wbxx_hal_conf.h       HAL configuration file
  - USB_Device/DFU_Standalone/USB_Device/App/usb_device.h               USB Device application header file
  - USB_Device/DFU_Standalone/USB_Device/App/usbd_desc.h                USB device descriptor header file
  - USB_Device/DFU_Standalone/USB_Device/App/usbd_dfu_flash.h           Internal flash memory management header file
  - USB_Device/DFU_Standalone/USB_Device/Target/usbd_conf.h             USB device driver Configuration file


@par Hardware and Software environment

  - This application runs on stm32wbxx devices.

  - This application has been tested with STMicroelectronics P-NUCLEO-WB55
    board and can be easily tailored to any other supported device
    and development board.

  - P-NUCLEO-WB55 board Set-up
    - Install the DFU driver available in "DfuSe Demonstrator" installation directory
      For Windows 8.1 and later : Update STM32 DFU device driver manually from Windows Device Manager.
      The install of required device driver is available under:
      "Program Files\STMicroelectronics\Software\DfuSe v3.0.5\Bin\Driver\Win8.1" directory.
    - Connect the P-NUCLEO-WB55 board CN1 to the PC through micro A-Male to standard A Male cable.


@par How to use it ?

In order to make the program work, you must do the following:
 - Open your preferred toolchain
 - Rebuild all files and load your image into target memory
 - To run the application, proceed as follows:
   - Install "DfuSe Demonstrator"
   - Install the DFU driver available in "DfuSe Demonstrator" installation directory
   - For Windows 8.1 and later : Update STM32 DFU device driver manually from Windows Device Manager.
     The install of required device driver is available under:
     "Program Files\STMicroelectronics\Software\DfuSe v3.0.6\Bin\Driver\Win8.1" directory.
   - Open "DfuSe Demo", choose the "P-NUCLEO-WB55.Nucleo_LED_Toggle_@0x0800C000.dfu" provided in Core\Binary
     directory, upgrade and verify to check that it is successfully downloaded.
   - This application allows also to upload a dfu file (either the provided DFU file or by creating a new dfu file).
     To check that the upload was successfully performed, choose the dfu uploaded file, upgrade and verify.
   - To run the downloaded application, execute the command "leave the DFU mode" or simply reset the
     board.

 * <h3><center>&copy; COPYRIGHT STMicroelectronics</center></h3>
 */