Skip to main content
Visitor II
April 19, 2021
Solved

ST-Link V3 debug STM32MP157A-DK1

  • April 19, 2021
  • 4 replies
  • 4318 views

Hi,

I am trying to debug in engineering mode with the STM32MP157A-DK1 through a external ST-Link V3 but i am not being able to get it to work. I attacht the error gotten, as well as pictures of the connection and the debug configuration in Cube IDE. The image thas shows the debug configuration has the OpenOCD option configured, however i have also tried the GDB option but the board is not even found in this case. Thank you in advance.

    This topic has been closed for replies.
    Best answer by PatrickF

    I'm afraid that not so simple, you can't work without a running Linux on the platform.

    There is some mandatory learning curve related to Linux system. Overall, MPUs are more complex to use than STM32 MCUs.

    anyway, you could start with with a device tree update form DK2 using CubeIDE (new STM32 project from board DK1), then add the peripherals you need for Cortex-M4 side (as many init are done by Linux, you need to give it the information in the DT).

    Then compile/update TF-A/uBoot(FIP)/Kernel device tree by following https://wiki.st.com/stm32mpu/wiki/How_to_compile_the_device_tree_with_the_Developer_Package

    Flash the SD-Card with new files as you do for getting started (using CubeProgrammer with USB) .

    Then you could use CubeIDE to create/update/debug the M4 FW

    https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-DK2/Develop_on_Arm%C2%AE_Cortex%C2%AE-M4/Modify,_rebuild_and_reload_a_firmware

    Once working, the M4 FW should be placed in the SD-card in a linux folder (e.g. using scp from Linux PC to DK2 Linux connected in 'Ethernet over USB')

    Then M4 FW could be started, see https://wiki.st.com/stm32mpu/wiki/Linux_remoteproc_framework_overview#Remote_processor_boot_through_sysfs

    Regards.

    4 replies

    Technical Moderator
    April 19, 2021

    Hi,

    I think there is few misunderstandings.

    There is an embedded STLINK (STLINK-V2) on STM32MP157A-DK1, to debug using this one, simply connect the PC on USB CN11. No need of an external STLINK-V3.

    If you are willing to use a different probe (e.g. external STLINK-V3), you should solder wires on TP2, TP3, TP4...., see schematic page 3. Connection of external probe is more easy on EVAL board (e.g. STM32MP157F-EV1).

    Note that embedded STLINK-V2 also provide UART4 console as USB Virtual Comm Port (VCP). This require additional wiring in case external STLINK-V3 is used (not available on external STLINK-V2).

    Note: The unpopulated CN12 you are trying to use is the SWD port of the embedded STLINK-V2 itself, used only during board production to flash the initial STLINK FW, then this port is disabled and useless (if needed, STLINK FW update is done thru CubeProgrammer).

    Regards.

    DCajigalAuthor
    Visitor II
    April 20, 2021

    Thank you very much!! i hadnt seen these errors. Great help!

    DCajigalAuthor
    Visitor II
    April 20, 2021

    Hi again,

    I have connected the STLINKV3 through TP2, TP3, TP5 and TP9. The first time the device has been identifed, although the debug has failed to start. After that the error is always the same and i can get it to work. I attach you an image of the error. I have checked the connection and it seems to be ok.

    Apart from this, one of the things that i want to test here is to load code to the M4 in engineering mode and see if this code can run once i deattach the debugger, like a normal M4 core, without having flashed linux on the sd. In order to use this core like a traditional M4. Could you help me with this? Thanks again

    Technical Moderator
    April 20, 2021

    Note that CubeProgrammer with STM32MP15x cannot work with STLINK, but only connect using USB to load the platform flash.

    STLINK is only used for debug purposes with e.g. debug Cortex-M4 FW with CubeIDE.

    Engineering mode is only used to test and debug (e.g. the Cortex-M4 code), but the platform does not boot from any Flash in that mode.

    Cortex-M4 FW is always loaded/started from uBoot or Linux, it cannot be used ad a standalone MCU.

    I encourage you read the wiki:

    https://wiki.st.com/stm32mpu/wiki/Getting_started

    https://wiki.st.com/stm32mpu/wiki/Boot_chain_overview#STM32MP15_boot_chain

    https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer

    Regards.

    DCajigalAuthor
    Visitor II
    April 20, 2021

    Thank you really much! Really i have tested the STLINK in CUBEIDE and i was having that problem too. The first time it connected but after that the device is not found..i attached the picture with the programmer just in case if it was more clear there, i did not realise that it could not work with the STM32MP15x.

    Regarding to the engineering mode, i was afraid of that...The thing is that we have to develop a product now and dont have too much time in order to learn about Linux, device trees, configuration...so the idea was to use the M4 standalone and in a future update migrate part of the code to the A7 once we learn a bit more about all this system

    PatrickFAnswer
    Technical Moderator
    April 20, 2021

    I'm afraid that not so simple, you can't work without a running Linux on the platform.

    There is some mandatory learning curve related to Linux system. Overall, MPUs are more complex to use than STM32 MCUs.

    anyway, you could start with with a device tree update form DK2 using CubeIDE (new STM32 project from board DK1), then add the peripherals you need for Cortex-M4 side (as many init are done by Linux, you need to give it the information in the DT).

    Then compile/update TF-A/uBoot(FIP)/Kernel device tree by following https://wiki.st.com/stm32mpu/wiki/How_to_compile_the_device_tree_with_the_Developer_Package

    Flash the SD-Card with new files as you do for getting started (using CubeProgrammer with USB) .

    Then you could use CubeIDE to create/update/debug the M4 FW

    https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-DK2/Develop_on_Arm%C2%AE_Cortex%C2%AE-M4/Modify,_rebuild_and_reload_a_firmware

    Once working, the M4 FW should be placed in the SD-card in a linux folder (e.g. using scp from Linux PC to DK2 Linux connected in 'Ethernet over USB')

    Then M4 FW could be started, see https://wiki.st.com/stm32mpu/wiki/Linux_remoteproc_framework_overview#Remote_processor_boot_through_sysfs

    Regards.

    DCajigalAuthor
    Visitor II
    April 20, 2021

    Understood! We are really really thankful!!