husarion / rosbot_ros

ROS packages for ROSbot 2, 2R and 2 PRO
132 stars 62 forks source link

Cannot flash new firmware #102

Closed PhilShaw852 closed 4 months ago

PhilShaw852 commented 7 months ago

Rosbot-2R (ROS2 Humble)

With the command as detailed in the procedure:

ros2 launch rosbot_utils flash_firmware

The response below is seen:

file 'flash_firmware' was not found in the share directory of package 'rosbot_utils' which is at '/home/husarion/ros2_ws/install/rosbot_utils/share/rosbot_utils'

Any suggestions?

rafal-gorecki commented 7 months ago

Hi @PhilShaw852, Thank you for the information. We made a typo, because we run this command via ros2 run. Let me know if it helped.

PhilShaw852 commented 7 months ago

Thanks Rafal, I now get: ros2 run rosbot_utils flash_firmware

Flashing /home/husarion/ros2_ws/install/rosbot_utils/share/rosbot_utils/firmware/firmware-0.11.0.bin over /dev/ttyUSB0 System architecture: aarch64 Device: RPi

Traceback (most recent call last): File "/home/husarion/ros2_ws/install/rosbot_utils/lib/python3.10/site-packages/rosbot_utils/flash-firmware.py", line 136, in main() File "/home/husarion/ros2_ws/install/rosbot_utils/lib/python3.10/site-packages/rosbot_utils/flash-firmware.py", line 131, in main flasher.flash_firmware() File "/home/husarion/ros2_ws/install/rosbot_utils/lib/python3.10/site-packages/rosbot_utils/flash-firmware.py", line 102, in flash_firmware self.try_flash_operation("Write-UnProtection", sh.stm32flash, ["-u"]) File "/usr/lib/python3/dist-packages/sh.py", line 3518, in getattr return self.env[name] File "/usr/lib/python3/dist-packages/sh.py", line 3316, in getitem__ raise CommandNotFound(k) sh.CommandNotFound: stm32flash Firmware flashing failed with return code 1

rafal-gorecki commented 7 months ago

You need also install stm32flash, use sudo apt install stm32flash.

PhilShaw852 commented 7 months ago

Unfortunately I think there is still an issue. I have also now lost the ability to teleop the robot.

husarion@my-robot:~/ros2_ws$ ros2 run rosbot_utils flash_firmware Flashing /home/husarion/ros2_ws/install/rosbot_utils/share/rosbot_utils/firmware/firmware-0.11.0.bin over /dev/ttyUSB0 System architecture: aarch64 Device: RPi

stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1 Version : 0x31 Option 1 : 0x00 Option 2 : 0x00 Device ID : 0x0413 (STM32F40xxx/41xxx)

Write-UnProtection error! Trying again. Error:

RAN: /usr/bin/stm32flash /dev/ttyAMA0 -u

STDOUT:

STDERR: Failed to read ACK byte Failed to write-unprotect flash


stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1

Write-UnProtection error! Trying again. Error:

RAN: /usr/bin/stm32flash /dev/ttyAMA0 -u

STDOUT:

STDERR: Failed to read ACK byte


stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1

Write-UnProtection error! Trying again. Error:

RAN: /usr/bin/stm32flash /dev/ttyAMA0 -u

STDOUT:

STDERR:


WARNING! Write-UnProtection went wrong. stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1

Read-UnProtection error! Trying again. Error:

RAN: /usr/bin/stm32flash /dev/ttyAMA0 -k

STDOUT:

STDERR: Failed to read ACK byte Unexpected reply from device on command 0x01


stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1 Version : 0x31 Option 1 : 0x00 Option 2 : 0x00 Device ID : 0x0413 (STM32F40xxx/41xxx)

stm32flash 0.5

http://stm32flash.sourceforge.net/

Using Parser : Raw BINARY Interface serial_posix: 115200 8E1

Flashing error! Trying again. Error:

RAN: /usr/bin/stm32flash /dev/ttyAMA0 -v -w /home/husarion/ros2_ws/install/rosbot_utils/share/rosbot_utils/firmware/firmware-0.11.0.bin -b 115200

STDOUT:

STDERR: Failed to init device.


stm32flash 0.5

http://stm32flash.sourceforge.net/

Using Parser : Raw BINARY Interface serial_posix: 115200 8E1 Version : 0x31 Option 1 : 0x00 Option 2 : 0x00 Device ID : 0x0413 (STM32F40xxx/41xxx)

Flashing error! Trying again. Error:

RAN: /usr/bin/stm32flash /dev/ttyAMA0 -v -w /home/husarion/ros2_ws/install/rosbot_utils/share/rosbot_utils/firmware/firmware-0.11.0.bin -b 115200

STDOUT:

STDERR: Failed to read memory at address 0x08000000


stm32flash 0.5

http://stm32flash.sourceforge.net/

Using Parser : Raw BINARY Interface serial_posix: 115200 8E1

Flashing error! Trying again. Error:

RAN: /usr/bin/stm32flash /dev/ttyAMA0 -v -w /home/husarion/ros2_ws/install/rosbot_utils/share/rosbot_utils/firmware/firmware-0.11.0.bin -b 115200

STDOUT:

STDERR: Failed to read ACK byte


WARNING! Flashing went wrong. Done! Firmware flashing completed successfully.

rafal-gorecki commented 7 months ago

Please make sure that no programs using the firmware are running in the background, as it is not possible to use the port when it is already occupied.

  1. Check with the docker ps -a command whether there are any running processes. If there are any, please remove them.
  2. Disable all ros2 processes. You can check them via ros2 node list

If this doesn't work, try using the ~/flash_firmware.sh script. If this script does not exist, I recommend updating the system to the latest Husarion OS https://husarion.com/software/os/installation/.