Beginners hints for LPC-Link2 as an LPC4370 evaluation board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Beginners hints for LPC-Link2 as an LPC4370 evaluation board

5,886 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by OllieK on Fri Jan 17 20:28:42 MST 2014
Today, I was a beginner in LPC4370 programming using
- LPCXpresso IDE
- Two LPC-Link2 boards (OM13054)

I had difficulties to find the simplified instructions and hope that the following will be useful for other newbies.

1. Download LPCXpresso (www.lpcware.com/lpcxpresso/download)
2. Create a user account (www.lpcware.com)
3. Register LPCXpressor
4. Download LPC-Link 2 Configuration tool (www.lpcware.com/content/project/dfu-download-programming-utility-and-security-lpcdfusec-tool)
5. Both LPC-Link2 boards have one jumper connector.  Use one jumper on first board in JP2 (or connect USB power on second board).
6. Start the configuration tool (DFUSec.exe)
7. Select CMSIS-DAP LPC-Link 2 image
8. Enable Auto-Program (there is no program button in the board)
9. Connect USB cable to the first board
10. Wait that the red text in "Start Program" and "Verify Program" turns green in few seconds
11. Disconnect USB cable
12. Add the second jumper on first board in JP1
13. Use one of the small flat cables to connect J7 on first board (debugger) to J2 on the second board (target)
14. Connect USB cable again
15. In LPCXpresso, use the Debug Configurations option (down arrow from the green bug), select the Debugger tab
16. In Debugger Options under Target configuration, select Debug Protocol and cange it to SWD
17. Build your project and start debugger

Good luck with your new high performance board.  8-)
Labels (1)
0 Kudos
44 Replies

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Mar 19 00:40:02 MST 2015
What jumper configurations do you have on the LPC-Link2 you are using as the target board and the one you are using as the debug probe?

And how are you powering the target board? To start with it will make life simpler if you don't power using USB connected to the PC running the debugger (i.e. power from a separate USB power supply, or else from the debug probe by fitting JP2).

Also, you might want to take a look using the LPCOpen package that is available for the LPC-Link2 board now - either from the LPCXpresso Examples subdirectory or else from:

http://www.lpcware.com/lpcopen
http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc43xx-packages

Regards,
LPCXpresso Support
0 Kudos

2,574 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by venableonline on Wed Mar 18 12:48:51 MST 2015
I am glad Ollie's experience was so smooth. I tried to follow his step by step and get the following error when trying to debug..

Flash driver "Terminate" timeout (500 ms)  PC: 10000000
  Flash driver "Terminate" timeout (500 ms)  PC: 10000000
  15: Target error from Commit Flash write
  Flash erase or write operation aborted.

The project I am using is the example LPC4370_LEDblinky

Thanks.
_______________________________________________________________________

I swapped the two boards, and everything worked fine.  After going back a forth a few times, I found the case where the target can not be programmed is when it has already been configured with the JTAG firmware.
So the question is why, and what must I not do in the firmware that will prevent programming in the future?
How do I erase the flash where the JTAG firmware resides?
Target works fine if I configure it with the the CMSIS-DAP firmware.

It is unfortunate that the blinking example looks just like the idle redlink connection.

Cheers.
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tptosh on Tue Aug 26 06:26:17 MST 2014

i have found the foregoing information and threads to be very confusing with regard
to jumper settings

It is very simple to use two LPC-Link2 boards to get the "blinky program" to blink.

1) do not connect any jumpers whatsoever to anything anywhere, all jumpers are off on both boards
2) connect jtag cable from the jtag-lpclink2-J7 to the target-lpclink2-J2
3) use a dumb usb power jack to power up the target board first
4) connect the usb cable from the jtag-lpclink2 board to your lpcxpresso computer
5) build blinky program
6) run debug

if debug popup asks for a configuration,
click "c/c++ nxp mcu app" and it should auto-populate the form with blinky

you should see the redline server downloaded and be able to run at this point

please note that the poorly documented JP1 jumper selects the boot from the usb (JP1 disconnected)
or boot from on-board flash (JP1 connected).  Because lpcxpresso by default downloads the
redlink via usb when JP1 is disconnected, you want to keep JP1 disconnected on the jtage-LPCLINK2
that is connected to your computer running lpcxpresso

as others have mentioned,
it is important to not connect the target board to a computer so that it does not
tru to usb-boot your target, … it is better to just use a dumb charger cable connected
to a simple usb-charger, not a computer.

after your code is downloaded to the target,
disconnect the jtag cables, and by connecting
JP1 will allow the target to independently boot upon power up
using your downloaded code
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nmz787 on Wed Apr 30 01:29:46 MST 2014
ok, finally figured out that the GPIO port numbers and bit numbers and pin numbers don't correspond or have sane naming schemes. Also there is no master look up table, as far as I can tell. At least not one that specifically mentions needing to use different address/bit values for the same pin, for different parts of the pin setup.

#define nop()asm volatile ("nop")

#define SETTINGS_GPIO_OUT   (PUP_DISABLE | PDN_DISABLE | SLEWRATE_SLOW | FILTER_DISABLE)//SLEWRATE_SLOW | FILTER_ENABLE)
#define SETTINGS_GPIO_IN    (PUP_DISABLE | PDN_DISABLE | SLEWRATE_SLOW | INBUF_ENABLE | FILTER_DISABLE)

//some correlation can be drawn from pg 232 of UM10503.pdf
int main(void) {
//these next two are working for setting up the LED
//BOOT0_LED with pull down enabled and pull up disabled (MD_PDN = 0x3<<3)
scu_pinmux(0x1, 1, MD_PDN, FUNC0); // P1_1,FUNC0 => GPIO0[8] 
GPIO_SetDir(0,1<<8, 1);


//these pins are on J9, pins 10 and 4 respectively (the odd pins are ground)
scu_pinmux(0x1,  10, SETTINGS_GPIO_IN, FUNC0); //GPIO1[3],  P1_10 //set its mode to enable the input buffer, so we can use as input
scu_pinmux(0x1, 7, SETTINGS_GPIO_OUT, FUNC0); //GPIO1[0],  P1_7  //FUNC0 is normal GPIO setting for these pins

GPIO_SetDir(1,1<<3, 0);  //GPIO1[3],  P1_10 ... INPUT == 0
GPIO_SetDir(1,1<<0, 1);  //GPIO1[0],  P1_7 ... OUTPUT == 1
//Clear LED
GPIO_ClearValue(0,1<<8);
while(1) {
//wait while an applied clock signal is low, move on when it goes high
    while((GPIO_ReadValue(1) & (1<<3))==0){ nop(); }
    GPIO_SetValue(1,1<<0);
    GPIO_SetValue(0,1<<8);
//wait while an applied clock signal is high, move on when it goes low
    while((GPIO_ReadValue(1) & (1<<3))){ nop(); }
    GPIO_ClearValue(1,1<<0);
    GPIO_ClearValue(0,1<<8);
}
}



Now the problem is that the system doesn't seem to respond to input clock signals faster than 1MHz....
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nmz787 on Tue Apr 29 14:13:07 MST 2014
P.S.
I got some ideas from these two files and their respective headers (grepping for the #defines etc):
https://github.com/embeddedartists/labtool/blob/master/fw/program/source/main.c
https://github.com/libopencm3/libopencm3-examples/pull/59/files
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nmz787 on Tue Apr 29 01:45:35 MST 2014
Could you post the example code showing JP9 pins working as input and outputs?

I have been trying for days to get the pins to toggle on my oscilloscope and trigger using a signal generator, but have had NO LUCK adapting the BLINKY demo to use GPIO1_0 for output. I've tried:

#define SETTINGS_GPIO_OUT   (PUP_DISABLE | PDN_DISABLE | SLEWRATE_SLOW |                 FILTER_ENABLE)
scu_pinmux(0x1,  7, SETTINGS_GPIO_OUT, FUNC0); //GPIO1[0],  GPIO1_0
GPIO_SetDir(1,1<<7, 1);

scu_pinmux(0x1, 1, MD_PDN, FUNC0); // P1_1,FUNC0 => GPIO0[8]
LPC_GPIO_PORT->DIR[0] |= (1UL << 8);
    while(1) {
    systick_delay(500);
    GPIO_SetValue(1,1<<7);
    GPIO_SetValue(1,1<<0);
    GPIO_SetValue(0,1<<8);
    systick_delay(500);
    GPIO_ClearValue(1,1<<7);
    GPIO_ClearValue(1,1<<0);
    GPIO_ClearValue(0,1<<8);
    }


and a few other modifications of that (substituting MODEs, changing the bit numbers, thinking if GPIO0_1 AKA P1_1 is bit 8, maybe GPIO1_0 AKA P1_7 is bit 14... i.e. 8-1=7 so 7+7 = 14)

Please help! This is driving me crazy! The LED keeps blinking, but my oscilloscope doesn't respond!

P.S. I also noticed that pin 2 of J9 doesn't seem to have power to it... at least my scope level doesn't show a higher than ground reading.
Using this schematic:
http://www.embeddedartists.com/sites/default/files/support/xpr/link2/LPC-Link-II_Rev_C.pdf
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Apr 23 07:03:54 MST 2014
You need to make sure that you have the right connectors connected on the probe and debug Link2s.

And that you have built your code to run from the memory on the target Link2. To run from SPIFI, you will need to ensure that you have correctly set the memory configuration of your project as well as fitted the right jumper.

Please ensure that you have read:

http://www.lpcware.com/content/faq/lpcxpresso/using-lpclink2-as-lpc4370-eval

and more generally the other LPC43 related FAQs, starting with:

http://www.lpcware.com/content/faq/lpcxpresso/lpc18-lpc43-support

Regards,
LPCXpresso Support



0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by saketa_nath on Mon Apr 21 05:45:17 MST 2014
Hi,

Please find below steps from attached picture

Setup Case A)

1) JP1 is closed and JP2 is open in first board.
2) Connected USB cable to first board(debugger).
3) Both JP1 and JP2 are open in second board (target).
4) Connected separate USB cable to second board (target).
5) Connected J2 on first board (debugger) to J7 on the second board (target) using flat cable.
6) Build all project.
7) Debug the firmware.

Setup Case B)

1) JP1 closed and JP2  open in first board.
2) Connected USB cable to first board(debugger).
3) JP1 open and JP2 closed in second board (target).
4) Connected J2 on first board (debugger) to J7 on the second board (target) using flat cable.
5) Build all project.
6) Debug the firmware.
With the above steps in both the cases, I get an error "no target found"
With the below sequence I get an exception because of Cortex M4 executing from SRAM instead of spiflash.
1) JP2 closed on debug board and plugged USB cable to program debug board using link2 config tool
2)disconnect usb cable from debug board
3)Close jp1 of debug board
4)connector jp7 of debug board to jp2 of target board
5)Power up debug board using USB cable.
6)Build firmware and click debug button on lpc expresso.

Now jumper settings are jp1 and jp2 closed on debug board and both are open for target board. I suspect the cortex on target is booting from sram rather than flash as jp1 is opened. Can you please tell me if am missing anysteps in debugging the firmwre on target board.






Please help me out in resolving this.
Regards
Saketa nath
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Mon Apr 21 02:30:27 MST 2014
Did you read our posting here?
http://www.lpcware.com/content/forum/beginners-hints-lpc-link2-lpc4370-evaluation-board#comment-1134...
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by saketa_nath on Mon Apr 21 02:25:07 MST 2014
Hi Olliek,
Iam a new bie to lpc and followed your steps listed above to download the image into lpc4370 target board. However when i clicked debug command from lpc expresso, i see that program execution on target starts from sram location 0x104000000 rather than from spiflash. Please find below the sequence followed.
1) JP2 closed on debug board and plugged USB cable to program debug board using link2 config tool
2)disconnect usb cable from debug board
3)Close jp1 of debug board
4)connector jp7 of debug board to jp2 of target board
5)Power up debug board using USB cable.
6)Build firmware and click debug button on lpc expresso.

Now jumper settings are jp1 and jp2 closed on debug board and both are open for target board. I suspect the cortex on target is booting from sram rather than flash as jp1 is opened. Can you please tell me if am missing anysteps in debugging the firmwre on target board.

BTW both are link2 lpc boards
Thanks in Advance
Saketa nath
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Jineshwar on Sun Apr 20 23:49:37 MST 2014
Hi ,

    I have followed below mentioned steps to program LPC4370  using LPCXpresso IDE & Two LPC-Link2 boards.

1. Download LPCXpresso (www.lpcware.com/lpcxpresso/download)
2. Create a user account (www.lpcware.com)
3. Register LPCXpressor
4. Download LPC-Link 2 Configuration tool (www.lpcware.com/content/project/dfu-download-programming-utility-and-security-lpcdfusec-tool)
5. Both LPC-Link2 boards have one jumper connector. Use one jumper on first board in JP2 (or connect USB power on second board).
6. Start the configuration tool (DFUSec.exe)
7. Select CMSIS-DAP LPC-Link 2 image
8. Enable Auto-Program (there is no program button in the board)
9. Connect USB cable to the first board
10. Wait that the red text in "Start Program" and "Verify Program" turns green in few seconds
11. Disconnect USB cable
12. Add the second jumper on first board in JP1
13. Use one of the small flat cables to connect J7 on first board (debugger) to J2 on the second board (target)
14. Connect USB cable again
15. In LPCXpresso, use the Debug Configurations option (down arrow from the green bug), select the Debugger tab
16. In Debugger Options under Target configuration, select Debug Protocol and cange it to SWD
17. Build your project and start debugger
-------------------
    I'm getting error msg - ( “error timeout redlinkserver needs to be restarted” ),
   Can you please let me know how can I program the spiflash of target using link2 debugger and hence I could debug the code   with lpc expresso?

Thanks & Regards
Jineshwar Nyamagoud
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by OllieK on Mon Jan 27 12:02:02 MST 2014
Unfortunately, I had erased many "failed" workspaces.  Here are the log files from the past 4 workspaces.
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Mon Jan 27 01:07:00 MST 2014
I am sorry for the problems you are experiencing. These are not common problems, and so seems peculiar to your environment or setup.

Unfortunately, you have not given us any information that we can use to help you. You say that there have been "lots of errors", but you have not mentioned a single one. All errors are stored in the log file. Perhaps you can send us that?
The log file can be found in
[your workspace]/.metadata/.log

As far as the "Terminate Disconnect" button is concerned, it is only available when there are active debug sessions that were started in this run of the IDE. It does not know about and cannot terminate sessions from a previous run of the IDE. The button being enabled when you first start the iDE, but reports "the chosen operation is not available" is a known issue with Eclipse, and a is due to a complex technical issue that I won't bore you with now.

Regarding "printf" not working; are you using the correct library type?
[list]
  [*]http://www.lpcware.com/content/faq/lpcxpresso/semihosting
  [*]http://www.lpcware.com/content/faq/lpcxpresso/library-variants
  [*]http://www.lpcware.com/content/faq/lpcxpresso/redlib-and-newlib
  [*]
[/list]

Best Regards
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by OllieK on Sun Jan 26 19:17:31 MST 2014
Nmz,

The JTAG debugger is not a problem any more.  With the help of dfu-util I have learned to monitor the status of the DFU connection.  It is still bothering me that I have to disconnect the LPC Link2 USB cable quite often to restore the connection.  The red boot button is not doing that.

The main reason for my frustration is that I have not been able to create repeatable results.  For example, I got the printf function working for awhile for a simple Hello World verification.  Then suddenly, I was not able even to get the linker to work for the semihosting.

There has been so many error messages where I don't understand the connection between my actions and the info in the error messages.  For example, more often than not, the LPCXpresso starts with the "Terminate/Disconnect all" icon red (see the screenshot).  When I do click on that icon, I do get this almost meaningless error message "The chosen operation is not enabled" (see the screenshot).  Obviously it is still enabled, because the icon turns gray.

In the other error messages, the "Help on this error..." button is useless.  There has not been a single case, where that button has given any help.

I guess that in most cases, I am the sole source for the troubles.  But I still feel that the LCPXpresso is immature at the moment to guide me in correcting those errors.  Normally, I don't like to read manuals or blogs.  In this case, I have done that but the outcome has not been encouraging.

It is possible, that I will try LCPXpresso in future after some new versions will be available.  I will do my tracking through the projects tab (http://www.lpcware.com/projects_list_page?order=created&sort=desc&tid=All) to see if there will be any concrete use cases for the LPCXpresso/LPCL2 combination.  At the moment there is only one entry for that purpose and it is a quite high level H/W and S/W description for "what" bot not enough details for "how".

If you compare this situation for the other IDEs and Arduino or STM32F4 boards, you can see a huge difference.  The community and vendor support is better for the other platforms - at the moment.

I had quite high expectations for NXP, when the IDE and board came from the same company.
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nmz787 on Sun Jan 26 17:54:32 MST 2014
Ollie, what's the trouble? It seemed like you found the right USB port to use, which provided only 1 entry with dfu-util. Using that USB port, doesn't the RedLink firmware upload into the board when you build and try to start a debug session? Have you ensured there are no old debug sessions lingering in the 'debug view'?
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by OllieK on Sun Jan 26 10:15:59 MST 2014
I have been trying to get this LPC Link2 working with LPCXpresso for some time.  Even when trying to do things in the vanila way without any manual settings, I am getting many error messages.  The most frustrating thing is that I have not been able to get the past examples to work again.  Now I am in a stage, that I cannot even get the debugger to start in the main() - the program counter stays in some random address and after restart goes to zero.

To avoid any further fustrations, I will take an undefinite pause of using LPC Link2 in my projects.
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Sat Jan 25 02:30:13 MST 2014
We would be very interested in any problems you are finding with the Debugger. Please open a different thread to report these.
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by OllieK on Fri Jan 24 19:28:54 MST 2014
Nmz,

I did start with Arduino (Uno and Due) with Arduino IDE as development platform and LabVIEW as PC level analytical tool.  The low quality of the available libraries and lack of built-in SWD/JTAG debugger were the main reasons to leave that platform.  I did learn the  84MHz SAM3X8E quite well, when I did create my own versions of timer and I2C libraries.

Next I did start to use the STM32F4xx discovery boards (401C and 429I). For IDE I got
[list]
  [*]EmBlocks
  [*]IAR Embedded Workbench (32 KB limit)
  [*]Keil uVision5 (32 KB limit)
  [*]emIDE
  [*]some others for short time evaluations
[/list]

If I had not seen the LPC Link2 or Bambino boards, I would have stayed with STM32F4xx using EmBlocks IDE.  There, I had been concentrated on SPI communication and timer wheel development.  I did realize that the I2C didn't provide the high performance I was looking for.  Since then, I have replace all my I2C based sensors with SPI models.  Originally, I was planning to go with a genuine RTOS, but did realize that in my application, I am getting better performance with timing wheel.

I am not yet comfortable with the debugger quality in LPCXpresso.  The resolution for JTAG related problem, open the door to see quite many (perhaps too many) other unexplained error messages that are completly stopping me.  I will try to solve those by myself.  If failing, I will start a new thread for the specific issue(s). In worst case, I will return back to STM32F4xx.

Take care my friend  8-)
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nmz787 on Fri Jan 24 14:33:41 MST 2014
Ollie, thanks for the kind words! I'm learning all this on my own pretty much, so we're in quite similar situations!

What is the other IDE you're trying? I've got Keil MDK lite, but the LabTool code compiles into a file that's larger than the 32kb flash limit of the free 'lite' version... so I haven't had any plans to use it, though I want to try and port the LabTool code over to compilation in LPCXpresso (I think this shouldn't be more than a few config files being modified).

See my post on USB here, no responses from Support there... I have a feeling they want to be paid for supporting these more advanced issues.
http://www.lpcware.com/content/forum/how-do-i-get-started-usb-lpc4370-lpc-link-v2
0 Kudos

2,575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by OllieK on Thu Jan 23 17:54:00 MST 2014
nmz787,

Thanks for all your professional and kind help you have given to this newbie.  I hope that I can return the service to you or somebody else in future. 

I did notice that you have still some unanswered questions related to high speed analog data acquisition.  It is sad that the forum has given so little response for the issues you mentioned.  At the same time it is very exiting to get such a kind of high performance functionality with so low cost using LCP4370.  It can open doors for nice business opportunities - good luck to you.

That USB functionality in PC is still bothering me.  I have had similar problems with some consumer products - especially with EOS Utility for Canon 20D and 5D3.   But in general things are working surprisingly well.  Following is a short summary between the two MCU IDEs.  What could be the explanation between these differences?

USB port                       LPCXpresso                      Another IDE
USB2 in PC                       Works                            Works
USB2 in Dell keyboard            Fails (2 DFU)                    Works
USB3 in PC                       Fails (0 DFU)                    Works
USB3 in Dell monitor             Fails (0 DFU)                    Fails
0 Kudos