0

I have a STM32 that I programm in Windows, I connected them like this:

https://electronics.stackexchange.com/questions/515810/ftdi-and-st-link-devices-together-to-stm32

Now, I moved to Linux (Ubuntu 18.04) but the Arduino IDE cannot find the ST LINK, I got the following

      -------------------------------------------------------------------
                    STM32CubeProgrammer v2.5.0                  
  -------------------------------------------------------------------

libusb:warning [libusb_open] internal signalling write failed
ST-LINK error (DEV_USB_COMM_ERR)
libusb:warning [libusb_close] internal signalling write failed, closing anyway
the selected serial port libusb:warning [libusb_close] internal signalling write failed, closing anyway
does not exist or your board is not connected

Am I missing some configuration?

2
  • stm32duino.com – Juraj Aug 11 '20 at 18:12
  • 1
    Have you set up suitable permissions for the UsB device in a udev rules file? – Majenko Aug 11 '20 at 19:48
0

These are my personal notes I wrote to myself a while back. See if they work for you too. Some of the filenames and versions may be slightly more up-to-date now, but I think this should be what you need. I look forward to hearing back from you to hear if this works for you.

STM32CubeProgrammer Linux install instructions:

Help manual: UM2237, here: https://www.st.com/en/development-tools/stm32cubeprog.html --> download link at bottom; direct link.

  1. Download & install STM32CubeProgrammer: https://www.st.com/en/development-tools/stm32cubeprog.html#get-software --> click "Get Software" download button.

  2. Download STSW-LINK007 (ST-LINK, ST-LINK/V2, ST-LINK/V2-1 firmware upgrade) tool: https://www.st.com/en/development-tools/stsw-link007.html.

    • Extract the zip file, but do not install it. There is no need to install it, as this tool comes built-in to the STM32CubeProgrammer tool above too, and all we really need from this STSW-LINK007 zip file is the readme and some udev rules.

    • Reference the readme here: stsw-link007_2.32.22/readme.txt, or even better, the readme here: stsw-link007_2.32.22/AllPlatforms/StlinkRulesFilesForLinux/Readme.txt

    • Install the udev rules:

      cd stsw-link007_2.32.22/AllPlatforms/StlinkRulesFilesForLinux
      sudo cp *.* /etc/udev/rules.d
      
  3. Referencing section 1.2.1 of UM2237 (download link above):

    sudo apt-get install libusb-1.0.0-dev
    

    Reload udev rules (source: https://unix.stackexchange.com/a/39371/114401):

    sudo udevadm control --reload-rules && udevadm trigger
    

    Unplug and plug in the STLink programmer.

  4. Open and Run STM32CubeProgrammer GUI to verify things.

  5. Make a symbolic link to the programmer CLI executable so we can run it as STM32_Programmer_CLI:

    mkdir -p ~/bin
    sudo ln -s ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI \
    ~/bin/STM32_Programmer_CLI
    
  6. If this is the first time ever creating and using your ~/bin directory, where we just placed the executable symbolic link above, log out and log back in to have Ubuntu automatically place this folder into your PATH.

  7. Now flash your chip with the programmer. Example flash command:
    (Refer to UM2237--link above--for more info on commands.)

    # connect, erase all, write, and verify; Note: the `-e all` option
    # to "erase all" is NOT necessary, as erasing the sectors to be 
    # flashed is automatic when you do the write (`-w`) command!
    # The `0x8000000` part specifies the starting address in the chip to
    # start programming. Leave this off to use the chip's default
    # programming start address, or, adjust this address to your specific
    # needs for your chip.
    STM32_Programmer_CLI -c port=SWD -w my_hex_file.hex 0x8000000 -v
    

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.