1
\$\begingroup\$

I’m using an STM32 Nucleo board connected to a Raspberry Pi. To flash the MCU I drop a binary file to a mounted drive. The problem is that it takes a random, and sometimes long time, from the moment I drop the file to the actual moment the MCU is flashed. As a contrast, I have an instantaneous result when flashing from Windows. Is there a way to expedite the process?

\$\endgroup\$
  • \$\begingroup\$ The Nucleo and RPi are parts of a robot. When its loaded, I don't have access to the USB input. When I'm flashing through the RPi, I'm able to flash wirelessly. \$\endgroup\$ – sas Feb 9 '17 at 14:36
  • \$\begingroup\$ The size is not an issue when I'm flashing from Windows. \$\endgroup\$ – sas Feb 9 '17 at 14:39
  • \$\begingroup\$ You should describe the flashing method, implemented on the RPi. \$\endgroup\$ – Bence Kaulics Feb 9 '17 at 14:43
  • 1
    \$\begingroup\$ To elaborate on the flashing process: the Nucleo is mounted on the RPi as a flash drive to a specific folder. To actually flash it, I copy the binary file to the above mentioned folder using WinSCP. I tried copying the file from within the RPi itself with the same result. \$\endgroup\$ – sas Feb 9 '17 at 14:52
3
\$\begingroup\$

Linux thinks it's just some external storage, and holds back (caches) writes while it's mounted. You can try to

  • umount the Nucleo interface after copying, forcing everything to be written back
  • issue a sync command after copying
  • mount it with -o sync to disable write caching.

The first two methods are preferred over -o sync (as long as they work), because writes are still cached until the system is told to write everything, using up fewer flash write cycles.

If none of the above works reliably, then install openocd or texane st-link on the pi, and use that for flashing.

\$\endgroup\$
  • \$\begingroup\$ @sas Do not forget to accept this answer then by clicking on the tick mark. :) \$\endgroup\$ – Bence Kaulics Feb 10 '17 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.