JLink debugging blue pill using the Sloeber IDE

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
kostbill
Posts: 51
Joined: Mon Aug 07, 2017 7:56 am

JLink debugging blue pill using the Sloeber IDE

Post by kostbill » Fri Aug 11, 2017 7:26 am

Hello.

For the last couple of days I have been trying to find information about debugging the BluePill with JLINK but didn't manage to anything that can help me.

I am programming the BluePill, using windows, arduino IDE for compiling and uploading the code, Sloeber for development.
I also tried to use a plugin for eclipse for STM32 but didn't make it, but now I think I know how to make it work.

I don't really mind if it is one wire debugging or the full JTAG debugging, although I would prefer the latter, I can see that the BluePill exposes all the JTAG pins on the board.

Has anyone make it work?

Thanks,
Bill

User avatar
RogerClark
Posts: 6724
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: JLink debugging blue pill using the Sloeber IDE

Post by RogerClark » Fri Aug 11, 2017 8:08 am

The BluePill only exposes SWDIO and SWCLK rather than the entire JTAG pins. This is is because the STM32 only has an SWD interface, not the fill JTAG

I only use GDB on the command line, so can't give any guidance about integration with JLink and Sloeber

You should also post your question to the Sleober forum

Edit
I have changed this thread title to make it clear this is a Sloeber question.

kostbill
Posts: 51
Joined: Mon Aug 07, 2017 7:56 am

Re: JLink debugging blue pill using the Sloeber IDE

Post by kostbill » Fri Aug 11, 2017 9:58 am

Hi,

Correct me if I am wrong, but by looking at the pinout from here: http://wiki.stm32duino.com/images/a/ae/ ... pinout.gif, I can see the following:
PA15 -> JTDI
PB3 -> JTDO
PB4 -> JTRST
and then we have the JTMS and JTCK from the 4 pin connector on the smaller side.

Am I missing something? Is the board configuration somehow not allowing these pins to be used for JTAG?


I am sorry, I forgot again to include the Sloeber in the title.

Thanks,
Bill.

User avatar
RogerClark
Posts: 6724
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: JLink debugging blue pill using the Sloeber IDE

Post by RogerClark » Fri Aug 11, 2017 10:04 am

Initially try to use JFlash to connect rather than Sloeber.

On other devices I use TMS and TCK connections from JLink

If you are using the BluePill it has separate pins for SWD broken out at the end of the board

Also, in most upload modes, the sketch gets configured to use the SWD pins as GPIO.

Search the forum about enabling SWD or configure your IDE to have the same settings as the STLink upload, as that has the SWD pins enabled

kostbill
Posts: 51
Joined: Mon Aug 07, 2017 7:56 am

Re: JLink debugging blue pill using the Sloeber IDE

Post by kostbill » Fri Aug 11, 2017 11:38 am

Yes you are probably right, I will use the JFlash utility just to see if it can communicate with the JLink and if it is able to see the BluePill.

About the JTAG, the full JTAG pins are on the BluePill and from what I can read on the datasheet, the reset state provides the JTAG functionality on the pins during reset.
So, I am thinking that since in order to configure the JTAG mode to SWD mode, it takes some effort, perhaps I could avoid it and just use the already configured JTAG. Unless I am mistaken and this is not possible.

If I manage to make it work, I will post some pictures, for anyone that might be interested.

Thanks,
Bill.

victor_pv
Posts: 1607
Joined: Mon Apr 27, 2015 12:12 pm

Re: JLink debugging blue pill using the Sloeber IDE

Post by victor_pv » Fri Aug 11, 2017 3:03 pm

I have been using the JLink for a while now.
For SWD mode you only need PA13 and PA14, then a GND and 3v3 connections. In that case you need to set the probe to use SWD mode.
If you set the jlink to JTAG mode, then you need the other pins, but you need to make sure the stm32duino core is set to configure all the JTAG pins for debug. I believe by default the core only sets the SWD pins for debug (PA13 and PA14). There is a function somewhere (sorry can't remember) that configures pins for JTAG, SWD or not for debugging, and that has been changed at different times, but I think the latest agreement was to leave it in SWD mode. A search in the forum should bring you some threads talking about the name of the function.

I normally use Ozone for debugging rather than the eclipse debugger, but have used that successfully too.
The trick is to make sure that if you want to use JTAG, then the core needs to set all the concerned pins to debug output. Start with SWD mode and see if you can get a connection. The JLINK allows different SWD speeds, any should normally work, but in case of problems start with 4Mhz, and if it works raise it to 20Mhz.

Unless you are doing more advanced things like tracing, I don't think the JTAG mode has many benefits over SWD, and SWD uses less pins, so most people prefer to be able to use the other pins for normal functions.

User avatar
Pito
Posts: 1502
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: JLink debugging blue pill using the Sloeber IDE

Post by Pito » Fri Aug 11, 2017 4:51 pm

In order to debug with J-link in Sloeber you have to have gnu gdb eclipse plugin installed. You also want to install the F103 pack (with peripheral's regs for debugger).
J-link works via SWD, plus Reset and Vcc need to be wired as well.
I've been using it with Blue F103ZET and Black F407ZET (it has got the 20pin jtag header) and it works fine.
Short guide: viewtopic.php?f=41&t=655&start=40#p25805
https://gnu-mcu-eclipse.github.io/debug/jlink/
Pukao Hats Cleaning Services Ltd.

kostbill
Posts: 51
Joined: Mon Aug 07, 2017 7:56 am

Re: JLink debugging blue pill using the Sloeber IDE

Post by kostbill » Sat Aug 12, 2017 10:51 am

Hi,

I am having problems. This is the state of things now:

1. JTAG is the default state of the processor during Reset. Jlink software can talk to the STM32 processor on the BluePill using JTAG with all the connections, including the Vreference. So I don't have to do anything for the SWD.

2. On Sloeber (not the eclipse plugin, the full IDE): I have Sloeber two times in my PC. On the first folder, when I try to install the Jlink plugin, it tells me that it cannot go on with this installation. On the second Sloeber folder, I installed it and I can see the SEGGER configuration and change it according to very informative Pito guide, but it pops up a failure message about: "gdb --version" (or something like that, I will run again later and give the full message).

Of course, Sloeber doesn't generate a correct bin file for me, so, even if I can make it debug, I doubt that the binary file will be of use. So I have to make Sloeber work normally for start, and then go on from there.

3. On eclipse with the Sloeber plugin I am unable to make it compile, I am seeing that I am having many of the same problems Pito had, but everything I tried is not working. However the eclipse environment has the Jlink in it's debug configurations.

I am planning to take all of Pito's posts on the subject and read them line by line, carefully until I reach a result.

4. One more thing is that Eclipse and the plugins, are installed in a bunch of different places, so, when I delete the Eclipse directory and create it again, it is using the old configuration, I don't know where I should delete it from.

5. Pito, which Arduino version are you working with and what eclipse are you having the Sloeber plugin on?
I am working with 1.8.3 (latest) and eclipse oxygen.

User avatar
Pito
Posts: 1502
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: JLink debugging blue pill using the Sloeber IDE

Post by Pito » Sat Aug 12, 2017 11:27 am

5. Pito, which Arduino version are you working with and what eclipse are you having the Sloeber plugin on?
I am working with 1.8.3 (latest) and eclipse oxygen.
Arduino IDE version is not important with Sloeber (mine is 1.6.13), it has no relation to Sloeber.

I did install Sloeber in April this year, I think it is Neon based. I have not touched it since then (except the procedures in my guide).
My plugin is version 4.0.1.201704210115.

Mind the "Sloeber" is an integrated finetuned installation package (about 150MB) containing the proper version of Eclipse with the proper version of Jantje's Arduino plugin which downloads the proper versions of other components required (my Sloeber folder here includes sam-1.6.11, avr-1.6.18, avr-gcc-4.9.2, gcc-arm-none-eabi-4.8.3-2014q1 - those are most probably downloaded during the installation).

My Sloeber installation here (folder "Sloeber") exclusive my working space is 1.06GB large.

There is not such thing like "Sloeber" without the arduino plugin...
I have not tried with vanilla Eclipse and Jantje's arduino plugin.

Anyhow, it takes some time to get familiar with the stuff :).
Do follow my guide carefully..
It works fine.
Pukao Hats Cleaning Services Ltd.

victor_pv
Posts: 1607
Joined: Mon Apr 27, 2015 12:12 pm

Re: JLink debugging blue pill using the Sloeber IDE

Post by victor_pv » Sat Aug 12, 2017 2:26 pm

kostbill wrote:
Sat Aug 12, 2017 10:51 am
1. JTAG is the default state of the processor during Reset. Jlink software can talk to the STM32 processor on the BluePill using JTAG with all the connections, including the Vreference. So I don't have to do anything for the SWD.
Like I mentioned before, the stm32duino core includes a function to select which pins are used for debugging and which for normal GPIO. Doesn't matter what the reset state is, as soon as you load any sketch and the sketch starts running, if may disables all the debug pins, or disable several of them and leave only SWD.

Post Reply