STM32 and the Segger/IAR J-Link

segger_j_link I finally got a day to play with some of my new toys. These are the IAR STM32-SK and the IAR J-Link debugger.The IAR J-Link is a re-badges Segger unit and I believe they are identical. I was quite excited about having a real debugger to use. – especially as programming the STM32 through the bootloader is a bit of a fiddle. Things didn’t turn out quite as I had hoped…

The development kit came with a 32k code-limited version of the IAR compiler. After a good few hours playing with this, I have decided to abandon it. The 32k code limit will be too restrictive for a micromouse. While is is way more than enough with an 8 bit micro, the ARM is a 32 bit device and so instructions take up a corresponding extra amount of flash. Not four times as much but enough to make it a bit of a squeeze. Besides, the full compiler would require me to sign over most of my organs and a share of the house to own. What is more, IAR seem to have stopped developing their IDE in the last century and it is not very slick.

Then came the decision about what tools to use. There seems to be two choices if I don’t want to assemble a set of disparate bits an pieces from the open source bucket. Don’t get me wrong, they are probably just fantastic but I am not keen on spending lots of time working out how to build a toolset when it is going to take quite long enough learning to drive the STM32.

There seems to be two choices. First, there is the Raisonance Ride 7 environment which can be downloaded for nothing and has a complete GNU tool set – also free. The IDE is quite nice to use and does everything I would expect at this stage. Compiling is easy and there is a simulator available as a target which runs quite nicely. The problem is getting the code into the chip. So far, I have been using the serial bootloader built in to the processor. This is very handy but the ST Flash Loader Demonstrator is a very clunky piece of software that I soon became tired with. The real drawback with the Raisonance tools is that you can’t use the IAR J-link to either program or debug the chip. For that you will need the Raisonance R-Link. It is not too expensive at £53 or so and, apparently, works well with the tools. However, unless you want to start spending proper money, it will only allow on-chip debugging of 32k of code. I can’t decide if that will be a real limitation. While the mouse software will grow beyond 32k, it should be possible to do a restricted build to deal with particular problems that might need the debugger. Up to now, I have not used on-chip debugging as the ICD2 kept destroying processors.

The other choice is the Rowley Crossworks toolset. A 30 day demo is available which is unrestricted apart from the time limit. This is a proper commercial environment, using the GNU tools. A personal, non-profit version is available for about £88. Crossworks can talk to the J-Link and is not limited in either programming or debugging. So I got an evaluation licence to give it a try. I wasted almost an entire day with errors, faults and inconsistent behaviour of the J-Link. I was about ready to give up when I came across mention on the Segger site about the processor reset and the JTAG reset line. You can look it up here.

Essentially, it says do not connect RST and TRST. I really don’t know why this caught my eye but I then checked the development boards that I have. Both are made for IAR by Olimex and both have a jumper connecting RST to TRST. A couple of minutes work with the soldering iron and some solder wick and the jumper was cleared. Suddenly everything seemed to work just fine. It needs a lot more testing yet but this seemed to cure all the issues I was having with the J-Link. Below are pictures of each of the boards with the location of the jumper highlighted.

IAR STM32-SK
IMG_3025 Img_3026_highlighted
This board has the jumper on the underside

Olimex STM32-P103
Img_3027_highlighted IMG_3028
On this board, the jumper is on top.

This entry was posted in STM32 and tagged , , , , . Bookmark the permalink.

3 Responses to STM32 and the Segger/IAR J-Link

  1. Lavanya says:

    Hi! Could you guide me about how to schedule the differnt processes of floodfill/ finding next cell/ updating walls and moving. I’m a novice building my first micromouse. Btw, I’m using C and ATMega16, and AVR Studio 4 and PonyProg to upload the program Suggestion: If you are using a readymade board, you can also check out the one at triindia.co.in

  2. peteh says:

    If you haven’t already, your best option is to look at the forum (link at the top of the page) and ask in there.

  3. Pranjal Chaubey says:

    Dear Lavanya,
    The processor that Peter is going to use is far more powerful than the ATMega series that TRI offers. Also, they dont supply outside the country, yet.

Leave a Reply