Error Uploading to RAK3172 using MBedOS and STLinkV2

Hi all, I recently tried my hand at this project using a RAK3272S Breakout Board. The code managed to compile however I have issues uploading it to the board using an AliExpress STLinkV2.

When trying to debug/run the program, I constantly get the following message:
Could not complete debug

My wiring between the RAK3272S and the STLink is as follows:
RAK3272S || STLink V2
GND → GND
3V3 → 3V3
SWDIO → SWDIO
SWCLK → SWCLK

What I have tried:

  • Connecting the RST pin on the RAK3272S to the RST pin on the STLink
  • Connecting BOOT0 to GND on the RAK3272S
  • Upgrading PyOCD to version 0.33.1 on the MBedOS terminal using command: pip install -U pyocd

Attached is a snippet from the mbed logs when debug is run (and fails):

[2022-05-16T18:40:22.917] [ERROR] root/mbs-debug - c:\Users\Ethan\AppData\Local\Mbed Studio\mbed-studio-tools\python\python.exe: can't open file 'c:\Users\Ethan\AppData\Local\Mbed Studio\mbed-studio-tools\python\Scripts\pyocd-script.py': [Errno 2] No such file or directory
 []
[2022-05-16T18:40:22.917] [ERROR] MbedStudio - Request reset failed with error: PyOCD failed to reset the target, please check the logs for more information [
  'Error: PyOCD failed to reset the target, please check the logs for more information\n' +
    '    at ElectronDeviceService.<anonymous> (C:\\Users\\Ethan\\AppData\\Local\\Programs\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:125:31)\n' +
    '    at step (C:\\Users\\Ethan\\AppData\\Local\\Programs\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:50:23)\n' +
    '    at Object.throw (C:\\Users\\Ethan\\AppData\\Local\\Programs\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:31:53)\n' +
    '    at rejected (C:\\Users\\Ethan\\AppData\\Local\\Programs\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:23:65)\n' +
    '    at runMicrotasks (<anonymous>)\n' +
    '    at processTicksAndRejections (internal/process/task_queues.js:94:5)'
]
[2022-05-16T18:40:22.922] [ERROR] root/mbs-debug - Could not complete debug: Request reset failed with message: PyOCD failed to reset the target, please check the logs for more information
Error: {"code":-32603} []
[2022-05-16T18:40:22.923] [INFO] root/mbs-core - Updating CoreMbedApplicationState with updateType: DEBUG_SESSION, update: false []
[2022-05-16T18:40:22.923] [INFO] root/mbs-core - Determining program buttons status: {"BUILD":{"type":"BUILD","typeString":"BUILD","isDisabled":false,"tooltip":"Build program"},"DEBUG":{"type":"DEBUG","typeString":"DEBUG","isDisabled":false,"tooltip":"Debug program"},"RUN":{"type":"RUN","typeString":"RUN","isDisabled":false,"tooltip":"Run program"}} []
[2022-05-16T18:40:29.788] [INFO] root/mbs-about - Opening feedback dialog []
[2022-05-16T18:40:29.788] [INFO] root/mbs-about - Mbed Studio version: 1.4.4 []
[2022-05-16T18:40:29.789] [INFO] root/mbs-about - Mbed Studio platform: Windows []
[2022-05-16T18:41:05.056] [INFO] root/mbs-debug - c:\Users\Ethan\AppData\Local\Mbed Studio\mbed-studio-tools\python\Scripts\pyocd-script.py cmd -W -c reset --uid 211e07101116303030303032 --target STM32WLE5CCUx --pack c:\Users\Ethan\AppData\Local\Mbed Studio\mbed-studio-tools\cmsis-packs\Keil.STM32WLxx_DFP.1.1.0-small.pack []
[2022-05-16T18:41:05.056] [DEBUG] root/process - Starting raw process: c:\Users\Ethan\AppData\Local\Mbed Studio\mbed-studio-tools\python\python.exe, with args: c:\Users\Ethan\AppData\Local\Mbed Studio\mbed-studio-tools\python\Scripts\pyocd-script.py cmd -W -c reset --uid 211e07101116303030303032 --target STM32WLE5CCUx --pack c:\Users\Ethan\AppData\Local\Mbed Studio\mbed-studio-tools\cmsis-packs\Keil.STM32WLxx_DFP.1.1.0-small.pack,  with options: {"cwd":"c:\\Users\\Ethan\\AppData\\Local\\Mbed Studio\\mbed-studio-tools\\python\\Scripts"} []
[2022-05-16T18:41:05.056] [INFO] root/mbs-core - Updating CoreMbedApplicationState with updateType: DEBUG_SESSION, update: true []
[2022-05-16T18:41:05.056] [INFO] root/mbs-core - Determining program buttons status: {"BUILD":{"type":"BUILD","typeString":"BUILD","isDisabled":true,"tooltip":"Debug in progress"},"DEBUG":{"type":"DEBUG","typeString":"DEBUG","isDisabled":true,"tooltip":"Debug in progress"},"RUN":{"type":"RUN","typeString":"RUN","isDisabled":true,"tooltip":"Debug in progress"}} []
[2022-05-16T18:41:05.056] [INFO] root/mbs-debug - Resetting target for debug... []
[2022-05-16T18:41:05.112] [DEBUG] root/process - Process 22112 has exited with code 2. [
  'c:\\Users\\Ethan\\AppData\\Local\\Mbed Studio\\mbed-studio-tools\\python\\python.exe',
  [
    'c:\\Users\\Ethan\\AppData\\Local\\Mbed Studio\\mbed-studio-tools\\python\\Scripts\\pyocd-script.py',
    'cmd',
    '-W',
    '-c',
    'reset',
    '--uid',
    '211e07101116303030303032',
    '--target',
    'STM32WLE5CCUx',
    '--pack',
    'c:\\Users\\Ethan\\AppData\\Local\\Mbed Studio\\mbed-studio-tools\\cmsis-packs\\Keil.STM32WLxx_DFP.1.1.0-small.pack'
  ]
]
[2022-05-16T18:41:05.113] [DEBUG] root/process - Unregistering process. [ID: 48] []
[2022-05-16T18:41:05.113] [DEBUG] root/process - The process was successfully unregistered. [ID: 48] []
[2022-05-16T18:41:05.113] [ERROR] root/mbs-debug - c:\Users\Ethan\AppData\Local\Mbed Studio\mbed-studio-tools\python\python.exe: can't open file 'c:\Users\Ethan\AppData\Local\Mbed Studio\mbed-studio-tools\python\Scripts\pyocd-script.py': [Errno 2] No such file or directory
 []
[2022-05-16T18:41:05.113] [ERROR] MbedStudio - Request reset failed with error: PyOCD failed to reset the target, please check the logs for more information [
  'Error: PyOCD failed to reset the target, please check the logs for more information\n' +
    '    at ElectronDeviceService.<anonymous> (C:\\Users\\Ethan\\AppData\\Local\\Programs\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:125:31)\n' +
    '    at step (C:\\Users\\Ethan\\AppData\\Local\\Programs\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:50:23)\n' +
    '    at Object.throw (C:\\Users\\Ethan\\AppData\\Local\\Programs\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:31:53)\n' +
    '    at rejected (C:\\Users\\Ethan\\AppData\\Local\\Programs\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:23:65)\n' +
    '    at runMicrotasks (<anonymous>)\n' +
    '    at processTicksAndRejections (internal/process/task_queues.js:94:5)'
]
[2022-05-16T18:41:05.115] [ERROR] root/mbs-debug - Could not complete debug: Request reset failed with message: PyOCD failed to reset the target, please check the logs for more information
Error: {"code":-32603} []
[2022-05-16T18:41:05.115] [INFO] root/mbs-core - Updating CoreMbedApplicationState with updateType: DEBUG_SESSION, update: false []
[2022-05-16T18:41:05.115] [INFO] root/mbs-core - Determining program buttons status: {"BUILD":{"type":"BUILD","typeString":"BUILD","isDisabled":false,"tooltip":"Build program"},"DEBUG":{"type":"DEBUG","typeString":"DEBUG","isDisabled":false,"tooltip":"Debug program"},"RUN":{"type":"RUN","typeString":"RUN","isDisabled":false,"tooltip":"Run program"}} []
[2022-05-16T18:41:09.226] [INFO] root/mbs-about - Opening feedback dialog []
[2022-05-16T18:41:09.226] [INFO] root/mbs-about - Mbed Studio version: 1.4.4 []
[2022-05-16T18:41:09.226] [INFO] root/mbs-about - Mbed Studio platform: Windows []

Thank you for any advice, as I would like to know if it is even worth investing time into troubleshooting this project any further or simply sticking with the AT command firmware.

Thank you!

Welcome to RAK forum @RCPilot1604 ,

I also personally tried Mbed with RAK3172 before but I encounter simple UART issues with it so I abandoned it. One of our members here @Charles (surely a RAKstar), is more experienced RAK3172 Mbed user. I hope he can share some light on your issue. Actually, the project you link is his repository.

Btw, RUI3 (RAK Unified Interfave V3) is a platform we develop so you can directly compile codes to RAK3172 using Arduino or Visual Studio IDEs. We are still doing few more test and bug fixing but will be available soon (no fix date yet though).

Hi there @carlrowan , thanks your for reply! Will definitely check RUI3 out once it is ready!