Difference between revisions of "RK Platform Upgrage Firmware USB CAN"

From ESS-WIKI
Jump to: navigation, search
 
(12 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
Ask PM for help to get the latest firmware like <code>SLCAN-FD0V0102.bin</code>.
 
Ask PM for help to get the latest firmware like <code>SLCAN-FD0V0102.bin</code>.
  
== Tools ==
+
== Tool ==
  
 
<code>usb-flash</code> is integrated by default in version 20250408 or later.  
 
<code>usb-flash</code> is integrated by default in version 20250408 or later.  
  
 
Check <code>usb-flash</code> :
 
Check <code>usb-flash</code> :
<pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"># usb-flash -v
+
<pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;">
 +
# usb-flash -v
 
Advantech HID IAP Console v0.1
 
Advantech HID IAP Console v0.1
 
</pre>
 
</pre>
Line 18: Line 19:
 
For early versions, download the tool from here : [[Media:Usb-flash.tar.gz|usb-flash]]
 
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>
+
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 ==
 
== Firmware in DUT ==
Check firmware version in DUT:
+
Check firmware version in DUT, taking <code>can0</code> for example:
<pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;"># Command
+
<pre style="background:#eeeeee;border:2px solid #cccccc;padding:5px 10px;">
 
# /tools/test/adv/can/can_get_firmware_version.sh can0
 
# /tools/test/adv/can/can_get_firmware_version.sh can0
 
[  OK  ]: can0 Firmware Version : 0102
 
[  OK  ]: can0 Firmware Version : 0102
Line 35: Line 40:
  
 
= '''Enter Upgrade Mode''' =
 
= '''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''' =
 
= '''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 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

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