Difference between revisions of "RK Platform Upgrage Firmware USB CAN"
Yunjin.jiang (talk | contribs) (Created page with "TBD") |
Yunjin.jiang (talk | contribs) |
||
| (14 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | ||
| + | = '''Prepare''' = | ||
| + | |||
| + | For Upgrade firmware, A tool named <code>usb-flash</code> and a new firmware are needed. | ||
| + | |||
| + | == New Firmware == | ||
| + | Ask PM for help to get the latest firmware like <code>SLCAN-FD0V0102.bin</code>. | ||
| + | |||
| + | == Tool == | ||
| + | |||
| + | <code>usb-flash</code> is integrated by default in version 20250408 or later. | ||
| + | |||
| + | Check <code>usb-flash</code> : | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # usb-flash -v | ||
| + | Advantech HID IAP Console v0.1 | ||
| + | </pre> | ||
| + | |||
| + | For early versions, download the tool from here : [[Media:Usb-flash.tar.gz|usb-flash]] | ||
| + | |||
| + | And unzip <code>usb-flash</code> to <code>/usr/local/bin/</code> on DUT. | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # tar -zxvf usb-flash.tar.gz -C /usr/local/bin/ | ||
| + | # chmod +x /usr/local/bin/usb-flash | ||
| + | </pre> | ||
| + | |||
| + | == Firmware in DUT == | ||
| + | Check firmware version in DUT, taking <code>can0</code> for example: | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # /tools/test/adv/can/can_get_firmware_version.sh can0 | ||
| + | [ OK ]: can0 Firmware Version : 0102 | ||
| + | </pre> | ||
| + | |||
| + | <div style="background:#FFF8E6;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | <span style="font-size:x-large;">'''CAUTION'''</span> | ||
| + | |||
| + | Firmware upgrades are only supported in V0102 or later versions | ||
| + | |||
| + | </div> | ||
| + | |||
| + | = '''Enter Upgrade Mode''' = | ||
| + | == Stop slcan driver == | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # pkill slcanfd | ||
| + | </pre> | ||
| + | |||
| + | == Get Can port == | ||
| + | Get can port <code>ttyACMx</code> (x=0、1、2...) | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # dmesg | grep slcan | ||
| + | [ 6.880193] can0: slcan on ttyACM0. | ||
| + | [ 6.890344] can1: slcan on ttyACM1. | ||
| + | </pre> | ||
| + | |||
| + | == Swith MCU to IAP mode == | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # usb-flash -s /dev/ttyACM0 | ||
| + | # usb-flash -s /dev/ttyACM1 | ||
| + | # usb-flash -s /dev/ttyACM2 | ||
| + | ... ... | ||
| + | </pre> | ||
| + | |||
| + | == Reboot DUT == | ||
| + | Reboot DUT for MCU to enter IAP mode. | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # reboot | ||
| + | </pre> | ||
| + | |||
| + | = '''Upgrade Firmware''' = | ||
| + | == Check IAP Mode == | ||
| + | Check whether MCU is in IAP mode.If there are nodes <code>hirawx (x=0、1、2...)</code>, MCU is in IAP mode. | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # ls /dev/hidraw* -al | ||
| + | crw------- 1 root root 235, 0 Apr 8 05:56 /dev/hidraw0 | ||
| + | crw------- 1 root root 235, 1 Apr 8 05:56 /dev/hidraw1 | ||
| + | </pre> | ||
| + | |||
| + | == Upgrade Firmware == | ||
| + | Taking <code>SLCAN-FD0V0102.bin</code> as an example of the file name of the latest firmware. | ||
| + | |||
| + | Suppose <code>SLCAN-FD0V0102.bin</code> is located in the root folder of the USB flash disk. | ||
| + | |||
| + | Adjust <code>SLCAN-FD0V0102.bin</code> and <code>/run/media/sda1/SLCAN-FD0V0102.bin</code> according to your actual situation. | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # cp /run/media/sda1/SLCAN-FD0V0102.bin ./ | ||
| + | # usb-flash -f SLCAN-FD0V0102.bin | ||
| + | </pre> | ||
| + | |||
| + | Enter <code>Y</code> for each can to start upgrade process. | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | Do you want to update firmware on this device? (Y/N)Y | ||
| + | [==================================================] 100 % | ||
| + | |||
| + | /dev/hidraw1 update successful | ||
| + | Do you want to update firmware on this device? (Y/N)Y | ||
| + | [==================================================] 100 % | ||
| + | |||
| + | /dev/hidraw0 update successful | ||
| + | </pre> | ||
| + | |||
| + | <div style="background:#FFEBEC;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | <span style="font-size:x-large;">'''Caution'''</span> | ||
| + | |||
| + | DO NOT cancel the process of upgrade while upgrade is going. | ||
| + | |||
| + | DO NOT power off DUT while upgrade is going. | ||
| + | </div> | ||
| + | |||
| + | == Reboot DUT == | ||
| + | Reboot DUT for MCU to enter normal mode. | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # reboot | ||
| + | </pre> | ||
| + | |||
| + | = '''Check Firmware''' = | ||
| + | Check if the firmware has been updated successfully, taking <code>can0</code> for example: | ||
| + | <pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"> | ||
| + | # /tools/test/adv/can/can_get_firmware_version.sh can0 | ||
| + | [ OK ]: can0 Firmware Version : 0102 | ||
| + | </pre> | ||
Latest revision as of 07:08, 11 April 2025
Contents
Prepare
For Upgrade firmware, A tool named usb-flash and a new firmware are needed.
New Firmware
Ask PM for help to get the latest firmware like SLCAN-FD0V0102.bin.
Tool
usb-flash is integrated by default in version 20250408 or later.
Check usb-flash :
# usb-flash -v Advantech HID IAP Console v0.1
For early versions, download the tool from here : usb-flash
And unzip usb-flash to /usr/local/bin/ on DUT.
# tar -zxvf usb-flash.tar.gz -C /usr/local/bin/ # chmod +x /usr/local/bin/usb-flash
Firmware in DUT
Check firmware version in DUT, taking can0 for example:
# /tools/test/adv/can/can_get_firmware_version.sh can0 [ OK ]: can0 Firmware Version : 0102
CAUTION
Firmware upgrades are only supported in V0102 or later versions
Enter Upgrade Mode
Stop slcan driver
# pkill slcanfd
Get Can port
Get can port ttyACMx (x=0、1、2...)
# dmesg | grep slcan [ 6.880193] can0: slcan on ttyACM0. [ 6.890344] can1: slcan on ttyACM1.
Swith MCU to IAP mode
# usb-flash -s /dev/ttyACM0 # usb-flash -s /dev/ttyACM1 # usb-flash -s /dev/ttyACM2 ... ...
Reboot DUT
Reboot DUT for MCU to enter IAP mode.
# reboot
Upgrade Firmware
Check IAP Mode
Check whether MCU is in IAP mode.If there are nodes hirawx (x=0、1、2...), MCU is in IAP mode.
# ls /dev/hidraw* -al crw------- 1 root root 235, 0 Apr 8 05:56 /dev/hidraw0 crw------- 1 root root 235, 1 Apr 8 05:56 /dev/hidraw1
Upgrade Firmware
Taking SLCAN-FD0V0102.bin as an example of the file name of the latest firmware.
Suppose SLCAN-FD0V0102.bin is located in the root folder of the USB flash disk.
Adjust SLCAN-FD0V0102.bin and /run/media/sda1/SLCAN-FD0V0102.bin according to your actual situation.
# cp /run/media/sda1/SLCAN-FD0V0102.bin ./ # usb-flash -f SLCAN-FD0V0102.bin
Enter Y for each can to start upgrade process.
Do you want to update firmware on this device? (Y/N)Y [==================================================] 100 % /dev/hidraw1 update successful Do you want to update firmware on this device? (Y/N)Y [==================================================] 100 % /dev/hidraw0 update successful
Caution
DO NOT cancel the process of upgrade while upgrade is going.
DO NOT power off DUT while upgrade is going.
Reboot DUT
Reboot DUT for MCU to enter normal mode.
# reboot
Check Firmware
Check if the firmware has been updated successfully, taking can0 for example:
# /tools/test/adv/can/can_get_firmware_version.sh can0 [ OK ]: can0 Firmware Version : 0102