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
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.
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.
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
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.
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.
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/
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.
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.
[kostbill – 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.
I was under the impression that normal code would not bother to do that, and that it would happen only when this is configured from the debug configuration that SWD will be used.
If this is not the case, do you happen to know where is this piece of code located? I searched for AFIO_MAPR (this is the register, in which the fields SWJ_CFG[2:0] are controlling the JTAG-SWD configuration) but didn’t find anything related in the libraries.
Theses are the bits:
Bits 26:24 SWJ_CFG[2:0]: Serial wire JTAG configuration
These bits are write-only (when read, the value is undefined). They are used to configure the
SWJ and trace alternate function I/Os. The SWJ (Serial Wire JTAG) supports JTAG or SWD
access to the Cortex® debug port. The default state after reset is SWJ ON without trace.
This allows JTAG or SW mode to be enabled by sending a specific sequence on the JTMS /
JTCK pin.
000: Full SWJ (JTAG-DP + SW-DP): Reset State
001: Full SWJ (JTAG-DP + SW-DP) but without NJTRST
010: JTAG-DP Disabled and SW-DP Enabled
100: JTAG-DP Disabled and SW-DP Disabled
Other combinations: no effect
Pito’s guide was very nice, however Sloeber (or Eclipse) is not very good. It will randomly decide to leave a perspective blank, no matter how many times you restart. Then, out of the sudden it will restore it, and many other things like that.
I also saw what victor was saying and of course he was right, Pito also spotted this some time ago, I saw it on his guide.
Now I am having other problems but hopefully these will be solved as well
.
Thanks everyone for your help.
Bill.
Not seen here at least for last 4 months..


