Simplify Upload

This commit is contained in:
pascallanger 2018-08-12 16:58:55 +02:00 committed by GitHub
parent 1647d3d841
commit cf857f3256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,23 +80,27 @@ Global variables use 4064 bytes (19%) of dynamic memory, leaving 16416 bytes for
You can proceed to the next step.
## Preparing to upload the firmware
If you have already burned the bootloader, and are simply recompiling firmware to re-flash using your TX or USB cable, you can skip this step and go straight to [Flash from TX](#flash-from-tx) or [Upload via USB](#upload-via-usb).
If you have already burnt the bootloader, and are simply recompiling firmware to re-flash using your TX or USB cable, you can skip this step and go straight to [Flash from TX](#flash-from-tx) or [Upload via USB](#upload-via-usb).
STM modules, until now, do not come with a preloaded bootloader which makes the USB port unusable and discovered by a computer as unknown device. **For the first time use, you must use the upload method Upload via Serial inc. Bootloader (FTDI)** independently of what method you wish to use in future.
The latest Jumper 4-in-1 modules come with a USB port but it's in fact a built in FTDI appearing on the computer as a CP2102 serial device. You should use the method **Upload via Serial inc. Bootloader** instead of Upload via USB. 'Flash from TX' is supported once the bootloader is installed.
### Select an Upload Method
There are three methods to upload firmware to an STM32 module:
* **Flash from TX** - highly recommended, uses maintenance mode in radios running ersky9x to upload the firmware
* **Flash from TX** - highly recommended, uses maintenance mode in radios running ersky9x or OpenTX to upload the firmware
* **Upload via USB** - uses the USB port on the module
* **Upload via Serial (FTDI)** - uses the serial interface on the module via a USB-to-TTL adapter
* **Upload via Serial inc. Bootloader (FTDI)** - uses the serial interface on the module via a USB-to-TTL adapter
**Note:** 'Flash from TX' is only available with radios running ersky9x r221e2 or newer
**Note:** 'Flash from TX' is available with radios supporting ersky9x or OpenTX and running the latest bootloader with the Multi Flash app.
**Flash from TX** is highly recommended if your transmitter supports it, **Upload via USB** is recommended for all others. **Upload via Serial** can be used if your module does not have a working USB port and your transmitter does not run ersky9x.
**Flash from TX** is highly recommended if your transmitter supports it, **Upload via USB** is recommended for all others. **Upload via Serial inc. Bootloader** can be used if your module does not have a USB port and your transmitter does not run ersky9x or OpenTX.
1. Under **Tools -> Upload Method** select an upload method
The rest of this process will vary depending on the upload method you selected.
### Connect the programmer
### Upload via Serial inc. Bootloader (FTDI)
It is **strongly** recommended that you power your module from the transmitter when flashing it. This ensures that the module cannot be inadvertently supplied with 5V, which will damage the RF modules. This guide assumes that you will follow that advice, and instructs you to leave the V+ pin on the USB-to-TTL adapter disconnected. You may choose to ignore that advice at your own risk!
The wiring for the USB-to-TTL adapter is:
@ -116,14 +120,7 @@ The wiring for the USB-to-TTL adapter is:
1. Plug the USB-to-TTL adapter into the PC
1. In the Arduino IDE click **Tools -> Port** and choose the COM port which matches the USB-to-TTL adapter
### Burn the bootloader
If you are using **Upload via Serial** you can skip this step and proceed to [Upload via Serial](#upload-via-serial).
If you have selected either **Flash from TX** or **Upload via USB** the module will need to install the appropriate bootloader, which is selected automatically based on the Upload Method selection.
The bootloader only needs to be installed once unless you decide to switch from one upload method to the other.
In order to flash the bootloader the **BOOT0** jumper must be installed connecting **BOOT0** to 3.3V. The location of **BOOT0** varies by hardware module.
In order to flash the bootloader the **BOOT0** jumper must be installed connecting **BOOT0** to 3.3V. The location of **BOOT0** varies by hardware module. The latest Jumper modules with an intergrated FTDI do not need the BOOT0 jumper.
| **DIY Multiprotocol Module** | **Banggood 4-in-1 Module** | **iRangeX IRX4 Module** | **iRangeX IRX4 Plus Module** | **Vantac MPM Lite** |
|:---:|:---:|:---:|:---:|:---:|
@ -133,10 +130,9 @@ In order to flash the bootloader the **BOOT0** jumper must be installed connecti
1. If on Linux, ensure you have permissions to access serial interfaces as described in [Install the Maple USB drivers](#install-the-maple-usb-drivers)
1. Install the **BOOT0** jumper as described above.
1. Switch on the transmitter
1. Verify that you have selected the desired upload method under **Tools -> Upload Method**
1. Verify that you have selected the upload method **Upload via Serial inc. Bootloader (FTDI)** under **Tools -> Upload Method**
1. Verify that you have selected **stm32flash (FTDI)** as the programmer under **Tools -> Programmer**
1. Verify that the USB-to-TTL adapter is correctly connected to your module and you have selected the correct port under **Tools -> Port**
1. Click on **Tools -> Burn Bootloader**
Output will look similar to this:
```
@ -173,21 +169,13 @@ Assuming the process is successful:
1. Remove the **BOOT0** jumper
1. Disconnect the USB-to-TTL adapter
## Uploading the firmware
Follow the instructions which apply to the **Upload method** you previously selected.
* [Flash from TX](#flash-from-tx)
* [Upload via USB](#upload-via-usb)
* [Upload via Serial](#upload-via-serial)
## Flash from TX
1. Click **Sketch -> Export compiled Binary**, or press **Ctrl+Alt+S**
1. Locate the file named **multifw.bin** in the **Multiprotocol** folder
1. Follow the instructions [here](/docs/Flash_from_Tx.md) to upload the firmware using your radio
## Upload via USB
The **Upload via USB** bootloader enables your PC to detect the Multiprotocol module as a **Maple DFU** device. It will not be detected as a USB serial device until the firmware is uploaded to it, when it will be detected as a **Maple Serial** device.
In order for these devices to be correctly identified in Windows it is necessary to install drivers. This only needs to be done once.
In order for the module to be correctly identified in Windows it is necessary to install drivers. This only needs to be done once.
### Install the Maple USB drivers
##### Windows 7 or newer:
@ -234,6 +222,8 @@ After adding yourself to the groups as above and installing and running the udev
1. On Windows look for the USB device in the Windows Device Manager
1. On Mac OSX look in the System Information which is accessed by holding option and selecting the first item under the Apple Menu. Select the USB list on the left and look for the USB device.
1. On Linux execute the command ```lsusb``` and examine the output.
1. select the correct COM port, which should be labelled **COMx (Multi 4-in-1 (STM32F103CB))**. If the device is in "DFU" mode, the module COM port will not appear, select any available COM port to continue the upload procedure.
<p align="center"><img src="images/maple-serial-port-select.jpg"/></p>
1. In the Arduino IDE click **Sketch -> Upload**, or press **Ctrl+U**
You should see output similar to this:
@ -267,54 +257,6 @@ error resetting after download: usb_reset: could not reset device, win error: Th
**Note:** The line `Reset via USB Serial Failed! Did you select the right serial port?` is expected because the uploader initially looks for a Maple Serial device, which isn't yet available, before failing back to Maple DFU. That error only appears the first time and won't appear when re-flashing firmware. The final line warning, stating that the device could not be reset, is also expected.
For subsequent firmware uploads you need only repeat steps 1-3 above, ensuring that you first select the correct COM port, which should be labelled **COMx (Multi 4-in-1 (STM32F103CB))**.
<p align="center"><img src="images/maple-serial-port-select.jpg"/></p>
## Upload via Serial
Upload via Serial follows the same process as burning the bootloader and uses the same USB-to-TTL adapter.
1. Ensure your USB-to-TTL adapter is connected as described in [Connect the programmer](#connect-the-programmer)
1. If on Linux, ensure you have permissions to access serial interfaces as described in [Install the Maple USB drivers](#install-the-maple-usb-drivers)
1. Install the **BOOT0** jumper
1. Turn on the transmitter
1. Click **Sketch -> Upload**
You should see output similar to this:
```
Sketch uses 62772 bytes (47%) of program storage space. Maximum is 131072 bytes.
Global variables use 3216 bytes (15%) of dynamic memory, leaving 17264 bytes for local variables. Maximum is 20480 bytes.
C:\Users\blye\AppData\Local\Arduino15\packages\multi4in1\hardware\STM32F1\1.0.0/tools/win/serial_upload.bat COM4 0x8000000 C:\Users\blye\AppData\Local\Temp\arduino_build_868436/Multiprotocol.ino.bin
stm32flash -v -g 0x8000000 -b 57600 -w C:\Users\blye\AppData\Local\Temp\arduino_build_868436\Multiprotocol.ino.bin COM4
stm32flash 0.4
http://stm32flash.googlecode.com/
Using Parser : Raw BINARY
Interface serial_w32: 57600 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0410 (Medium-density)
- RAM : 20KiB (512b reserved by bootloader)
- Flash : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
Wrote and verified address 0x08000100 (0.41%)
Wrote and verified address 0x08000200 (0.82%)
...
Wrote and verified address 0x0800f500 (99.92%)
Wrote and verified address 0x0800f534 (100.00%) Done.
Starting execution at address 0x08000000... done.
```
Once the firmware has uploaded, remove the **BOOT0** jumper and disconnect the USB-to-TTL adapter.
## Flashing pre-compiled binaries
Pre-compiled binaries are available [here](https://github.com/pascallanger/DIY-Multiprotocol-TX-Module/releases).
- **Multiprotocol_V1.X.X_STM32.bin** files are for transmitters with support for hardware telemetry inversion, such as Turnigy 9X, 9XR, 9X+.