I had some problems getting my ROV on-board controller (which uses a LPC1347) programmed from LPCXpresso.
After doing the research I should have done before I had the PCBs made (doh), I found out I had messed up the SWD programming/debugging connections.
And so, in order to spare anyone else the same trouble, here is a small recap of which wires to connect to what.
Connections from LPC11U24/LPC1347
These are the minimal connections from the MCU to the LPC-Link:
Pin name | LQFP48 pin no. | Connect to |
---|---|---|
#RESET/PIO0_0 | 3 | SWD pin 10 (#RST) |
SWDIO/PIO0_15/AD4/ 25 CT32B1_MAT2 | 39 | SWD pin 2 |
SWCLK/PIO0_10/SCK0/CT16B0_MAT2 | 29 | SWD pin 4 |
Note: It is not necessary to have pull-up resistor on #RESET (or any other pin) unless other parts of the circuit might affect the levels since it is internally pulled up to VDD.
Connections from JTAG/SWD
These are the minimal connections from the LPC-Link to the MCU board.
Pin number | Connect to | LQFP48 pin no. | Comment |
---|---|---|---|
1 | 3.3V on MCU | 8, 44 | |
2 | SWDIO | 39 | |
3 | n/c | Optional GND (see note 1) | |
4 | SWCLK | 29 | |
5 | n/c | Optional GND (see note 1) | |
6 | n/c | Optional SWO (see note 2) | |
7 | n/c | ||
8 | n/c | ||
9 | GND | 5, 41 | |
10 | #RESET | 3 |
Note 1: It is sufficient to connect one of the GND pins (e.g. SWD pin 9) as pins 3, 5 and 9 are all connected on the LPC-Link.
Note 2: SWD pin 6 can be connected to PIO0_9/MOSI0/CT16B0_MAT1/SWO (LQFP pin 28) but this is not required.
Pin numbering
This image shows the pin numbering on the LPC-Link. Pin 1 has been marked in red.
Do yourself a favor and perform a continuity check from the LPC-Link side to your MCU board to make sure which pins go where.
(Image composited from images from http://www.keil.com and http://www.embeddedartists.com.)
Be aware that the 0.1" pins on the right edge of the board do not follow the JTAG pin numbering but have these connections:
- VCC
- SWDIO
- SWCLK
- SWO
- TDI
- #RESET
- EXT. PWR
- GND
The required pins are 1, 2, 3, 6 and 8.
Connection procedure
Sometimes LPCXpresso can't initialize the LPC-Link even though it is connected. I have found that following the following procedure works every time:
- Launch LPCXpresso IDE
- Power up device
- Attach to LPC-Link
- Connect LPC-Link to computer by USB
- Debug firmware from LPCXpresso