Skip to main content
Visitor II
November 5, 2019
Solved

Toogle Pins for STM32MP157C-DK2

  • November 5, 2019
  • 8 replies
  • 5882 views

Hello,

I am working on the evaluation board STM32MP157CDk2

I am trying to add my code in the main method while loop in order to toogle pins.

I added the following code:

while (1)
 {
 /* USER CODE END WHILE */
	 HAL_GPIO_TogglePin(atoi(1), GPIO_PIN_11);
	 HAL_Delay(100);
	 HAL_GPIO_TogglePin(atoi(0), GPIO_PIN_11);
 /* USER CODE BEGIN 3 */
 }
 /* USER CODE END 3 */

I have two questions.

1) I get the following error (attached) after i choose target and then program chip

2) I am connected through usb and UART in the eclipe, am using the system work bench as an IDE. Is there something to do before doing the build for connecting with the device in a special way?. I can see in the console that i am connected to the board. and Eclipse shows the message at the buttom (Serial Console in use).

I am new to this. I appreciate your help alot

Best Regards

    This topic has been closed for replies.
    Best answer by Bumsik Kim

    Don't use "run" but go to "Debug" and then look for "ST’s STM32 MPU Debugging" configuration.

    You are going to want to read this: https://www.openstm32.org/Using%2BSTM32-CoPro-MPU%2Bplugin

    8 replies

    Visitor II
    November 5, 2019

    You should use GPIOA (point to PA11 in your case) instead atoi(1) and atoi(0)

    Also, add delay function after second toggle or remove line 6 at all.

    Visitor II
    November 5, 2019

    I did but that is not the problem. It seams like its not finding some config file, i do not know if that the config file of the OCD and where to find it and where to define it in the program.

    Visitor II
    November 6, 2019

    What IDE are you using? The error message clearly states that you don't have the OpenOCP config file.

    Visitor II
    November 6, 2019

    I am using the System Workbench. i configured the OpenOCD. through run-> external tools-> as seen in the attachment. and the openocd now is configured, it is just listening on port 333 for the gdb. but after i configured the gdb. I have the following message:

    Open On-Chip Debugger 0.10.0+dev-01124-gbfb41e6 (2018-11-16-15:00)

    Licensed under GNU GPL v2

    For bug reports, read

       http://openocd.org/doc/doxygen/bugs.html

    cortex_a interrupt mask on

    cortex_a interrupt mask on

    cortex_a domain access control fixup on

    cortex_a domain access control fixup on

    3333

    none separate

    adapter speed: 5000 kHz

    adapter_nsrst_assert_width: 200

    adapter_nsrst_delay: 200

    none srst_pulls_trst

    srst_only srst_pulls_trst srst_gates_jtag srst_open_drain connect_deassert_srst

    Info : Listening on port 6666 for tcl connections

    Info : Listening on port 4444 for telnet connections

    Info : STLINK V2J34S25 (API v2) VID:PID 0483:3752

    Info : using stlink api v2

    Info : Target voltage: 3.257143

    Info : clock speed 5000 kHz

    Info : SRST line released

    Info : stlink_connect(connect)

    Info : SWD DPIDR 0x6ba02477

    Info : stm32mp15x.cpu0: hardware has 6 breakpoints, 4 watchpoints

    Info : stm32mp15x.cpu1: hardware has 6 breakpoints, 4 watchpoints

    Info : Listening on port 3334 for gdb connections

    Info : Listening on port 3333 for gdb connections

    srst_only srst_pulls_trst srst_gates_jtag srst_open_drain connect_deassert_srst

    Info : accepting 'gdb' connection on tcp/3333

    Info : stm32mp15x.cpu2: hardware has 6 breakpoints, 4 watchpoints

    target halted due to debug-request, current mode: Thread

    xPSR: 0x01000000 pc: 0x00000008 msp: 0x00000100

    Info : New GDB Connection: 1, Target stm32mp15x.cpu2, state: halted

    ap 0 selected, csw 0x10006000

    Info : SRST line asserted

    Info : SRST line released

    Info : stlink_connect(connect)

    Info : SWD DPIDR 0x6ba02477

    Error: timed out while waiting for target halted

    Info : stm32mp15x.cpu0 rev 5, partnum c07, arch f, variant 0, implementor 41

    Info : stm32mp15x.cpu0 cluster 0 core 0 multi core

    target halted in ARM state due to debug-request, current mode: Supervisor

    cpsr: 0x800001d3 pc: 0x000092a0

    MMU: disabled, D-Cache: disabled, I-Cache: disabled

    ap 0 selected, csw 0x10006000

    pc (/32): 0x000092A0

    Info : Deferring arp_examine of stm32mp15x.cpu1

    Info : Use arp_examine command to examine it manually!

    Info : stm32mp15x.cpu1: hardware has 6 breakpoints, 4 watchpoints

    Info : stm32mp15x.cpu1 rev 5, partnum c07, arch f, variant 0, implementor 41

    Info : stm32mp15x.cpu1 cluster 0 core 1 multi core

    target halted in Thumb state due to debug-request, current mode: Supervisor

    cpsr: 0x800001f3 pc: 0x0000060e

    MMU: disabled, D-Cache: disabled, I-Cache: enabled

    Info : Deferring arp_examine of stm32mp15x.cpu2

    Info : Use arp_examine command to examine it manually!

    Info : Deferring arp_examine of stm32mp15x.ap2

    Info : Use arp_examine command to examine it manually!

    Error: Target not examined yet

    embedded:startup.tcl:24: Error:

    in procedure 'stm32mp15x.cpu0' called at file "target/stm32mp15x.cfg", line 185

    in procedure 'ocd_bouncer'

    at file "embedded:startup.tcl", line 24

    Error: Target not examined yet

    embedded:startup.tcl:24: Error:

    in procedure 'stm32mp15x.cpu0' called at file "target/stm32mp15x.cfg", line 185

    in procedure 'ocd_bouncer'

    at file "embedded:startup.tcl", line 24

    Error: Target not examined yet

    Error: Target not examined yet

    Error: Target not examined yet

    Error: Target not examined yet

    ap 0 selected, csw 0x10006000

    Any idea where is this coming from?

    Regards

    Visitor II
    November 6, 2019

    Don't use "run" but go to "Debug" and then look for "ST’s STM32 MPU Debugging" configuration.

    You are going to want to read this: https://www.openstm32.org/Using%2BSTM32-CoPro-MPU%2Bplugin

    Visitor II
    November 6, 2019

    Ok, I ran it through the ST’s STM32 MPU Debugging and it connected to the IP address to the board and now i can see the root@stm32mp1.

    but i added that code. inside the while loop of the main.c

    HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_11);
    	 HAL_Delay(500);
    	HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_11);

    I cannot see any difference in the blinking of the PIN11 which is the blue LED on the board. also, evrytime i change the HAL delay, do i have to start debugging the board again or is it real time?

    Thanks in Advance

    Visitor II
    November 6, 2019

    GPIOA Pin 11 is NOT an LED pin. Please read the document before doing anything: https://www.st.com/content/ccc/resource/technical/document/user_manual/group1/d6/59/df/e0/8f/e7/45/8f/DM00591354/files/DM00591354.pdf/jcr:content/translations/en.DM00591354.pdf

    Also, your code basically double-toggling the pin without delay, effectively making it nothing at all. Add a delay as the first comment says.

    Lastly there is no C debugging tool on earth that automatically update code changes in real time.

    Visitor II
    November 6, 2019

    Ok. Thanks i understand that now. Sorry because i am new to this, just wanted to check if i can change any blinking LED while i am connected to the board. but struggling with that

    Visitor II
    November 6, 2019

    No worries, just try with GPIOH and GPIO_PIN_11, and delete the last HAL_GPIO_TogglePin. You will see an orange LED blinking =)

    Visitor II
    November 6, 2019

    I tried it like that:

    while (1)
     {
     /* USER CODE END WHILE */
    	 HAL_GPIO_TogglePin(GPIOH, GPIO_PIN_11);
    	 	 HAL_Delay(500);
     /* USER CODE BEGIN 3 */
     }
     /* USER CODE END 3 */

    the blinking LED's i have are green for LED2,4,3 and blue for LED8

    Visitor II
    November 6, 2019

    Opps, I meant GPIO_PIN_7. Sorry about that.

    By the way, did you set the GPIO as output?

    Visitor II
    November 6, 2019

    No, how to do that?