STM32W and JTAGkey-2 problem

Hi everyone!

I am trying to use openOCD Server with the JTAGkey-2 dongle and a STM32W board.

I used the two cfg Files interface/jtagkey2.cfg and target/stm32.cfg. Because there is no reference manual

avaiable for the stm32w i do not know the right TAP ID’s.

When I let openOCD auto probe the TAP ID’s it shows me the IDCODE for the CPU which is equal to the one in the stm32.cfg. Another TAP ID is shown and I assume that this one is the boundary scan TAP.

When I change the the boudary scan ID in the stm32.cfg and try to start debugging with the command

openocd.exe -f /interface/jtagkey2.cfg -f /target/stm32.cfg I get the following error.

Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : JTAG tap: stm32.bs tap/device found: 0x169a862b (mfg: 0x315, part: 0x69a8, ver: 0x1)
Error: stm32.bs: IR capture error; saw 0x1e not 0x01

When I play arround with the -irlen of both TAP’s I found a configuration that won’t give me an error.

For the CPU TAP I took a length of 5 and for the other TAP a length of 1.

With that config I got the following output when I start the openOCD server.

C:\>openocd_ftdi -f /interface/jtagkey2.cfg -f /target/stm32.cfg
Open On-Chip Debugger 0.4.0 (2010-08-19-23:33)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.berlios.de/doc/doxygen/bugs.html
100 kHz
jtag_nsrst_delay: 100
jtag_ntrst_delay: 100
Info : device: 6 "2232H"
Info : deviceID: 67358712
Info : SerialNumber: 53SN4LCSA
Info : Description: Amontec JTAGkey-2 A
Info : max TCK change to: 30000 kHz
Info : clock speed 100 kHz
Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : JTAG tap: stm32.bs tap/device found: 0x169a862b (mfg: 0x315, part: 0x69a8, ver: 0x1)
Info : stm32.cpu: hardware has 0 breakpoints, 0 watchpoints

This config is strange because the stm32w has a cortex m3 core and in the documentation of them it is written that the IR length of the CPU TAP is 4 and not 5, but this is the only configuration that didn’t give me errors.

Strange is also that I get no hardware brakpoints and watchpoints.

When I now connect to the running openocd server over telnet and call a “reset init” command, i got a time out error.

Also when I call “mdb 0 1024” for example I only got 00 00 00 lines, it seems that the memory is abolutly empty.

When I try to write something into memory over “mwb” and then read this byte I still get 00 00 00 output.

It seems that the openOCD server and the JTAGkey-2 got a pseudo connection :frowning:

I hope that anyone out there already played around with openOCD and a stm32w board or someone have an idea whats going wrong here.

Thank you for your answers!

Heureka, I solved the problem!

Just to solve anyone else time, here the solution.

As I already wrote, ST has not documented the correct properties for the boundary scan tap.

The only thing that I knew were the properties CPU TAP ID and the associated properties IR length, IR mask and IR capture for the ARM cotex m3 from their documentation.

Happily the boards are distributed together with a Jlink-lite dongle. I installed the SEGGER software from http://www.segger.com/cms/jlink-software.html to try another tool chain idea with Atollic TrueStudio and the Jlink GDB.

After I installed everything I played a bit around with all the SEGGER tools. After I started the J-Link GDB Server I tried to find informations with the J-Link Commander tool. This tool made my day and was an eye opener.

I got now the correct answers for the TAP ID’s and there IR length. With the known IR length value you can easily calculate the IR Mask values which are for both TAP’s the same (because they have the same length of 4).

The IR capture value is 0xF.

Because of the ARM Cortex M3 documentation I also knew the IR capture value for the CPU TAP which has a value of 0x1. The only thing that was missed to get everything worked was the IR Capture value for the SB TAP.

The key to hapiness brought the information IRPrint from the J-Link commander output which was 0x00E1.

The first TAP in our chain had a value 0x1 and I speculated that the IR caputre value for the SB TAP has to be

0xE0 and boom, everything worked :smiley:

When I now start the openocd server, I can see the hardware breakpoints and the watchpoints.

When I now try to debug over telnet I don’t run into the ugly halt time-out errors like before, I have some nice feedbacks from JTAG and the firmware really halt, resume and so on.

The /target/stm32.cfg file was a good basic for me and most of it can stay as it is. The following settings are the things you have to change to get the stm32w108 to run.

set _CPUTAPID 0x3ba00477
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID

set _BSTAPID5 0x06418041
jtag newtap $_CHIPNAME bs -irlen 4 -ircapture 0x0e -irmask 0xf  -expected-id $_BSTAPID1

set  _WORKAREASIZE 0x4000
_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0

For a bit more details about IR Mask, IR Capture and IR Length take a look to this link

http://www.imxdev.org/wiki/index.php?ti … _JTAG_BSDL

Have fun!

I am happy you have solved your trouble regarding your ST STM32W108 ARM CORTEX-M3 device using the Amontec JTAGkey-2 and openocd.

The STM32W108 boundary scan TAP has to be configured like followed

jtag newtap $_CHIPNAME bs -irlen 4 -ircapture 0x0e -irmask 0xf -expected-id 0x06418041

Please do not forget to create a patch or to give this info to the openocd community.

Thanks.

Laurent

I’m trying to use the STM32W108 that comes in the STM32W108B-KEXT evaluation kit. I tried to use the information in your post, but was not able to get it to work. Additionally, it seems that the boundary scan TAP that it detects is not 0x06518041. Instead it detects:

Info : JTAG tap: stm32w108.bs tap/device found: 0x169a862b (mfg: 0x315, part: 0x69a8, ver: 0x1)

Do you have a complete working target file for the stm32w that you would be willing to share? It would be nice if this could be added to the OpenOCD project, but as of yet no patch has been submitted and I haven’t been able to find other people who have reported success with this combination.

I have the same problem as hazelnusse (post above). But I do my own RF device (on my own board). Everythings goes ok, but I’don’t have a correct config file to openocd.

My device is slightly different (version 0x2)

Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)

Info : JTAG tap: stm32.bs tap/device found: 0x269a862b (mfg: 0x315, part: 0x69a8, ver: 0x2)

Could you share with your working config OpenOCD device file?

Thank You in advice.

Best regards. Mick