Skip to main content
Patrick Morwald
Associate III
July 11, 2017
Question

Can i set a LED output register on DISCOVERY board with SWD.

  • July 11, 2017
  • 4 replies
  • 1156 views
Posted on July 11, 2017 at 16:09

Hi,

i wondered if i can use the &sharpSWD in &sharpST-Link on the STM32F407G-DISCO1 Board to set individual IO registers during runtime?

According to

https://www.arm.com/products/processors/serial-wire-debug.php

it can be used as AMBA bus master to manipulate IO registers...

So consider the simple test case: I want to switch on the red onboard LED (PD14) on the DISCOVERY board with SWD during runtime. How do i do it? What client software would you recommend? 

I tried SW4STM32 but couldnt write the IO registers during runtime, no idea why it did not work.

I also used ST-LINK CLI and read memory address 0x40020C00 - 0x40020FFF (GPIO D memory area) but i only got zeros....

Am i using the SWD in the wrong way? Please help!

Patrick

#swd #stm32f4 #st-link
This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
July 11, 2017
Posted on July 11, 2017 at 16:54

>>

I also used ST-LINK CLI and read memory address 0x40020C00 - 0x40020FFF (GPIO D memory area) but i only got zeros....

Did you enable the clock first?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Patrick Morwald
Associate III
July 11, 2017
Posted on July 11, 2017 at 17:01

The peripheral clock is activated. I am running an application on the device where it gets activated right on startup.

Patrick Morwald
Associate III
July 11, 2017
Posted on July 11, 2017 at 17:00

Hi,

i wanted to update: I can manipulate the IO registers now through sw4stm32 with the plugin 'EmbSys Registers'. 

However, how do i do it with ST-LINK CLI? Is it even possible to read out peripheral register addresses with this tool? 

Please clarify!

Patrick

Patrick Morwald
Associate III
July 12, 2017
Posted on July 12, 2017 at 10:12

Hi,

update again: I can manipulate the IO register successfully with ST-LINK GUI. That means i can toggle an LED via register write now, but still i get a write error message popup in the GUI.

However, it doesnt work in the command line tool. I always get a write error:

C:\Users\pm>ST-LINK_CLI -w32 0x40020C18 0x00004000

STM32 ST-LINK CLI v3.0.0.0

STM32 ST-LINK Command Line Interface

ST-LINK SN : 066EFF575450707267193852

ST-LINK Firmware version : V2J28M18

Connected via SWD.

SWD Frequency = 4000K.

Target voltage = 2.9 V.

Connection mode : Normal.

Device ID:0x413

Device flash Size : 1024 Kbytes

Device family :STM32F405xx/F407xx/F415xx/F417xx

Writing 0x00004000 at 0x40020C18... Error!

Can anyone say what i am doing wrong in the command line tool? Please help!

Patrick

Tesla DeLorean
Guru
July 12, 2017
Posted on July 12, 2017 at 17:51

>>

Can anyone say what i am doing wrong in the command line tool? Please help!

Looks like a limitation in the software, this is a user forum, help depends on others working in a similar area. If you are a commercial client, push in via the sales and FAE contacts.

I've flagged this post for attention.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Technical Moderator
July 13, 2017
Posted on July 13, 2017 at 13:38

Hello,

I raised this issue internally to the ST-Link responsible and it's under investigation.

I will come back to you as soon as I have needed details.

With Regards

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks