[Wiki]7.Setting up Pokitto for Hardware debugging


#1

What is “hardware debugging”?

“Debugging” means getting rid of “bugs” - program errors. The main idea of debugging is that by using a program called a “debugger” you can stop the running of the program and look closely at what is happening in the code. It makes finding errors a lot easier.

Hardware debugging with physical devices such as Pokitto means that a “hardware debugger” is connected to Pokitto. This hardware debugger, such as Segger J-Link (of which you can get a very cheap and legal version here) connects with a 10-pin cable to the “SWD” connector on Pokitto. Hardware debugging is not difficult, but it is also not easy to explain to someone with little or no experience of programming. Therefore, if this feels difficult to understand, do not worry. Learn to program easier things first and then come back to this. We will be helping users who are interested in hardware debugging here on the Pokitto forums.

Stuff you need for hardware debugging

1. Hardware debugger. I recommend the Segger J-Link, just because the software support is so great. At 19,95$ from Adafruit, there is no good reason to use anything else.You can easily manage with the EDU version of J-Link as it has no real limitations - the only limitation is that EDU is not intended for commercial use.

2. 10-pin SWD cable, 1.27mm (0.05") pin pitch, 2 rows by 5 pins IDC cable. cable sold by Adafruit

3. 10-pin SWD header connector. Can be of boxed (plastic collar around header) or plain type (no plastic collar around pins). Note that the “notch” in the collar has to be the same direction as the “notch” indicated by the graphics on the Pokitto PCB! (SWD header sold by Adafruit)

4. Hardware-debugging capable IDE, such as EmBitz Hardware debugging requires, that the development environment supports hardware debugging. Therefore, you can not do hardware debugging with the mbed online IDE. I recommend you use EmBitz at first and then move on to more sophisticated tools.

Segger J-Link EDU Mini sold by Adafruit at just under 20$!

Location of SWD connector pads on bottom side of Pokitto. Note the “gap” on the outline drawn on the PCB - it shows you which way around the cable is inserted for SWD debugging

10-pin “SWD cable” also sold by Adafruit (you can easily find on Ebay also)

10-pin “SWD connector” sold by Adafruit. Very common, easy to find elsewhere also

Preparations for Hardware debugging

1. Solder the 10-Pin connector on the Pokitto PCB Soldering the 10 pin header on the PCB is actually quite easy. Just put the connector on the pads (check that the notch is in the right direction). Gently warm up each leg and pad with the tip of the solder iron and bring some solder to the joint. A thin solder wire makes this easier. You can use a bit of tape on the other side to keep the header in place while you do the first solders on the other side. In any case - it’s easy.

2. Get the LPC11U6X.svd file for your project The extension “.svd” stands for System View Description file. A SVD file describes the internal structure of the microcontroller / processor to the Debugger program. It describes the registers and ports, their names and what kind of values they can hold.

LPC11U6x.svd (831.2 KB)

3. Put the correct settings into the Debug settings of your project To find the debugging settings go to **Debug->Interfaces". First put the SVD file you downloaded to the “Device file” box.

Debug settings are under “Debug->Interfaces”

The LPC11U6X.svd SVD file goes into the box shown.

4. Put correct GDB server settings for the Debug interface GDB Server is the program that actually does the communication between your computer (=GDB client program run by the EmBitz IDE) and the LPC11U68 chip. GDB Server is the “translator” that talks to the chip. It opens up a localhost port at 2331. The GDB client connects to that port. The GDB server then physically controls the LPC11U68 chip of Pokitto through the J-Link adapter (or other HW adapter that you are using).

Important! to set the target device, select Device family as NXP. Then click **Settings >>" button. In the pop-up window, select “LPC11U37” as target (this is because LPC11U68 is so new, its not on the list!) LPC11U37 and LPC11U68 are so closely related, the settings are the same. Finally, you can rename the target to “LPC11U68” just by typing in the box.

Correct J-Link GDB Server settings for debugging. J-Link directory may be different, depending on how new your J-Link software version is

First select “LPC11U37” as target…

…and then you can rename it LPC11U68. It will work, don’t worry!

Hardware debugging setup is DONE!

This article will get a followup in the form of a hardware debugging tutorial at a later time!


#2

I normally use the black magic probe open source debugger. Based on what lady ada said about the j-link, bmp is a bit easier to use. It’s also less expensive if harder to set up: you can download and flash it to an STM32F103 “pill” board based on open source hardware designs that sell for US$4 or 5 to make your own. At this time, it doesn’t appear to have support for the lpc11u68, though it does have support for the u1x and u2x chips. Since it’s open source, getting that added may be very easy. I’ll certainly be looking into it once I can sit at a desk again.


#3

I’d love to hear about alternatives.

I will be concentrating on the J-Link first because according to my experience its bomb-proof with the LPC11U68

But I have also used:

  • a LPC11U35-based CMSIS-DAP
  • the LPCXpresso11U68 board (it has a built-in debugger)

Furthermore, I am 100% sure I can get debugging Pokitto with a Pokitto to work by porting the LPC11U35 code to the LPC11U68. Alas, I have no time to work on it at the moment, but I know enough about both chips to say I will get it working.

Once the Pokitto community starts using HW debuggers, productivity will explode through the roof. The difference in speed & accuracy of working is phenomenal.


#4

Sorry, i just skipped over the entire post since it contains close ups of the Pokitto. Mine did not arrive yet so Spoilers!


#5

Only one to be fair.


#6

Is there any benefit in more expensive “SEGGER J-Link EDU” against “SEGGER J-Link EDU Mini”? I mean, it is over 3x the cost so where is the catch?


#7

From a functional point of view there is no difference AFAIK.


#8

From specifications it’s only a matter of download speed. 200kb/s vs 1Mb/s .
Don’t know if it’s perceivable on small controller like pokitto. Anyone direct try both?


#9

Ordered Segger J-Link EDU Mini from Adafruit :slight_smile: Thought, as I was using the cheapest delivery it will not arrive to Finland any time soon.


#10

Can you confirm ship cost are near equals the cost of the debugger?


#11

where do you live? dont forget DHL package over 20-25 euro’s(that includes the shipping cost) will also add your country tax
if at all possible buy from a local supplier (or ebay)

i tell you this i had payed about 80euro’s for a 20euro part due to DHL express

@HomineLudens your acount says your from italy so look at this one or something:
http://www.robot-domestici.it/joomla/component/virtuemart/prodotti-al-prezzo-di-costo/50256-development-boards-g-arm-development-g-segger-j-link-edu-mini-jtagswd-debugger/25779-segger-j-link-edu-mini-jtagswd-debugger?keyword=Segger+J-Link+EDU

for anyone else check out this page to find the right retailer:
https://www.adafruit.com/distributors


#12

Thanks for the suggestions @adekto .

It seems to have a minimum order of 30$ + Ship Cost.


#13

my bad i cant read italian, but some other sites from germany for example will also ship to you so keep looking. inside eu your not paying any extra taxes


#14

If no one can find any at a reasonable price, I can look into a bulk order (if there are several people interested). Edit: i mean to reduce shipping costs


#15

i dont think you can easly get a lower price then what the local retail are offering.
also the need for hardware debugging is prety low in the community especialy with soldering the smd connector :confounded:


#16

OOPS! I’ve forgotten to mention: the debug pins are exposed in the Pokitto PEX header. You do not need to solder the debug header if you do not want to.

About the price: yes, if there is an Adafruit distributor inside EU then its probably wisest to buy from them.

But, equally, I can ask Daniel to buy a bunch (inside US no tax no big shipping fees) and stick them in the next shipment of Pokitto PCBs

EDIT: Forgot to mention: even though the Debug deader on the PCB is a surface-mount component, it is very easy to solder, because big pads and the legs are completely visible. Its not any harder than a normal through-hole component


#17

Mine was total €34.94 / $38.95 with the cable and the connector and with delivery (15 e). What I have read one does not need to pay tax if the total sum is under 45 eur.


#18

All in all, a hardware debugger is a really good investment. It will take your skill to the next level.

EDIT: I am again stuck here packing Pokittos on a saturday night. I’m like Cinderella.


#19

Keep it up Cinders, eventually you’ll make it to the ball :P.


#20

Could you add an image showing the SWD header properly soldered on to the pokitto?