Difference between revisions of "Pinecil"

Jump to navigation Jump to search
Line 172: Line 172:
== How to update the firmware ==
== How to update the firmware ==


The official firmware that comes with the Pinecil is IronOS, you will want that if you just want to use your Pinecil as a soldering iron.
The official firmware that comes with the Pinecil is IronOS. You will want that if you just want to use your Pinecil as a soldering iron.


If you're using the manual firmware update method described below, you can [https://github.com/Ralim/IronOS/releases/ download new IronOS releases from here].
For update instructions, please visit the [https://github.com/Ralim/IronOS/blob/master/Documentation/Flashing.md#pinecil-pine64 documentation on GitHub].
 
While you can't brick your Pinecil permanently (DFU is in ROM); a firmware update can make your Pinecil inoperable if you flash an invalid firmware. However, flashing a working firmware using these same instructions will remedy that.
 
{{warning|1=Do not have a barrel jack PSU plugged in at the same time as a USB-C cable. Doing this will severely damage your computer, or Type-C PSU.}}
=== With application ===
 
# Download Pinecil Firmware Updater for [http://pinecil.pine64.org/updater/get-binaries.php?platform=win64 Windows], [http://pinecil.pine64.org/updater/get-binaries.php?platform=macos64 MacOS], or build by yourself from [https://github.com/pine64/pinecil-firmware-updater sources].
# (Windows only) Be sure that you have installed Microsoft Visual C++ Redistributable x64. Else, you can download it [http://pinecil.pine64.org/updater/vc_redist.x64.exe here]
# Open it, select operating system you want to flash and click '''Flash'''. (Don't connect Pinecil yet)
# Follow application instructions for correct Pinecil connection to your PC.
# '''In case of error''': If you will get error about erasing the Pinecil, you need to tick '''Mass Erase''' checkbox and try again.
 
=== Manually ===
 
Method tested on Linux, should work on any OS which supply dfu-util 0.10+.
 
# Use the command <code>dfu-util -V</code> to check your version.  If your distro comes with 0.9 you might soft-brick your Pinecil, install the latest stable release from [http://dfu-util.sourceforge.net/ sourceforge].
# Enter the update mode. For that, unplug a barrel jack PSU if you have one plugged in. Then, plug USB cable while holding *-* button (button that's closest to USB-C port). The screen may be blank which is fine.
# Check that your Pinecil is available by listing devices with <code>dfu-util -l</code> and look for device with 28e9:0189 ID. Try running with sudo if your device is not listed. If dfu-util reports <code>alt=0, name="@Internal Flash  /0x08000000/128*001Kg"</code> you are fine, otherwise you need to upgrade to 0.10+, important part is <code>128*001Kg</code>, which is flash amount of blocks and block size, as a chip used in Pinecil have 128 KB of Flash with 1KB page size
# Make a firmware backup: <code>dfu-util -d 28e9:0189 -a 0 -U ~/pinecil/internal.flash.stock -s 0x08000000</code>
## <code>28e9:0189</code> -- USB Device ID (can be obtained from <code>lsusb</code> or <code>dfu-util -l</code> but in dfu-util output it might be hard to identify the Pinecil device)
## <code>-a 0</code> -- selects partition to flash. List of possible options can be obtained via <code>dfu-util -l</code>. Partition 0 - internal SPI flash. Partition 1 - fuses (description of fuses can be found in User Manual for the chip)
## <code>-U</code> -- specifies a mode. U is upload, which means that firmware will be downloaded and saved to file (yes, that's confusing, but it is what it is, feel free to verify that in a manual of your version of dfu-util). Command must be followed by a path to file where you want to save your firmware. dfu-util will refuse to dump firmware if you already have a file with that name.
## <code>-s 0x08000000</code> -- specify the address in a flash from which dump will start. This can be obtained from <code>dfu-util -l</code>.
# Flash a new firmware: <code>dfu-util -d 28e9:0189 -a 0 -D Pinecil_EN.bin -s 0x08000000:mass-erase:force</code>
## <code>-D</code> -- is a mode to Download firmware to the device (yes, that's confusing, but you indeed Upload from device and Download to device with dfu-util). That should follow the file with the firmware. Update archive from Ralim usually contains two files: <code>.hex</code> and <code>.bin</code>. One that is required - is <code>.bin</code>. <code>_EN</code> is the language code of the firmware, means that <code>_EN</code> will flash english version of firmware.
## <code>-s 0x08000000:mass-erase:force</code> -- specified the address where to flash the file. <code>:mass-erase:force</code> is required to force-erase flash before updating firmware with the first batch, otherwise you might have unpredictable results.
## If it fails with <code>Error during special command "MASS_ERASE" get_status</code> (as has happened with recent shipments) then use ...<code>-s 0x08000000</code> without attempting "mass-erase". Full command example: <code>dfu-util -d 28e9:0189 -a 0 -D Pinecil_EN.bin -s 0x08000000</code>
## If the hex and dfu files cannot be flashed, convert the hex file to bin with this command: <code>objcopy --input-target=ihex --output-target=binary Pinecil_EN.hex Pinecil_EN.bin</code>


== Disassembly steps ==
== Disassembly steps ==