Custom PCB STM32G071RB stuck on run program: 3%

Hello everyone.

I am experiencing a bit of a problem regarding a custom PCB with STM32G071RB. I have based the custom PCB on the Nucleo-G071RB card. The Nucleo-G071RB development board is able to flash code without problems, however the custom pcb with the same microcontroller STM32G071RB together with an STLINK-V3MINIE does not work in mbed studio and the program gets stuck on 3% running program.

I have set up the custom PCB as a custom target with standard configuration
Target name - NUCLEO-G071RB
build target - NUCLEO-G071RB
Deploy and debug target - STM32G071RBTx
Debug flags - --target STM32G071RBTx --erase=chip --frequency 1800000 --pack ‘c:\ProgramData\Mbed Studio\mbed-studio-tools\cmsis-packs\Keil.STM32G0xx_DFP.1.2.0-small.pack’ -O connect_mode=under-reset

I am however able to flash code in STM32CudeIDE and STM32CubeProgrammer, however seeing as all of my project code is currently in mbed studio i would like to continue using it. When using the .bin file from the mbed studio program into STM32CudeProgrammer i the thread_sleep_for() function of the mbed-os-example-blinky-baremetal did not seem to work when doing this, but HAL_Delay() works (I am guessing this is because its a part of mbed.h, but seeing as i uploaded the .bin file I though it would still work)

I get the following in the log file when it stops at 3%:
[2023-03-06T08:12:16.406] [INFO] root/mbs-deploy - Waiting for a debug probe matching unique ID ‘003B00423431511937393330’ to be connected…

This seems to indicate that its not detecting the pcb, but I am not sure.

Any help would be much appreciated!