Sample code for LPC1768 Xpresso

17 replies [Last post]
clement738
Offline
Joined: 2010-09-15
Posts: 7

Is there any sample code for CAN, I2C, SPI, etc for LPCXpresso 1768? I only found the UART, ADC, and blinky in the examples given. Where can I download the sample code for LPCXpresso 1768?

0
Your rating: None

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
renan
Offline
Joined: 2009-12-11
Posts: 151

There are some examples for the RDB1768 here http://support.code-red-tech.com/CodeRedWiki/NewExampleProjects
But they do not contain CAN or I2C.

Renan

clement738
Offline
Joined: 2010-09-15
Posts: 7

What is the difference between RDB1768 and Xpresso1768?

CodeRedSupport
Offline
Joined: 2009-12-06
Posts: 4268

The RDB1768 is Code Red's own development board. It features a NXP LPC1768, 10/100 Mbps Ethernet, Host/Device USB, 16-bit stereo audio, serial port, color LCD and pads for all IO pins including GPIO and CAN, making it ideal for evaluating all of the features of the LPC1700. It also features its own built in debug probe and is fully compatible with the LPCXpresso IDE.

More information at:

http://www.code-red-tech.com/lpc1768-development-kit.php

Compared to an LPCXpresso1768 board, it basically provides the ability to do more "out of the box" without needing to add you own hardware / connectors. It is broadly comparable to using an LPCXpresso1768 board mounted on an LPCXpresso baseboard:

http://www.embeddedartists.com/products/lpcxpresso/xpr_base.php?PHPSESSID=s3kofjr450sr72lc7i362room1

With reference to example code for the LPC1768, in addition to the RDB1768 examples that Renan pointed you at, NXP have the following available from their website:

Sample Code Bundle for LPC17xx Peripherals
http://ics.nxp.com/support/documents/microcontrollers/zip/code.bundle.lpc17xx.keil.zip

LPC17xx CMSIS-Compliant Standard Peripheral Firmware Driver Library
http://ics.nxp.com/support/documents/microcontrollers/zip/lpc17xx.cmsis.driver.library.zip

Although these do not ship with LPCXpresso project files, generally it is fairly easy to create a new project within LPCXpresso IDE, then copy the required source files across.

For a list of all LPC17 related docs/software from NXP, see:
http://ics.nxp.com/support/documents/microcontrollers/?search=LPC17

Regards,
CodeRedSupport

renan
Offline
Joined: 2009-12-11
Posts: 151

CodeRedSupport wrote:

With reference to example code for the LPC1768, in addition to the RDB1768 examples that Renan pointed you at, NXP have the following available from their website:

Sample Code Bundle for LPC17xx Peripherals
http://ics.nxp.com/support/documents/microcontrollers/zip/code.bundle.lpc17xx.keil.zip

LPC17xx CMSIS-Compliant Standard Peripheral Firmware Driver Library
http://ics.nxp.com/support/documents/microcontrollers/zip/lpc17xx.cmsis.driver.library.zip

You are right, I forgot those examples... Shock

Renan

CodeRedSupport
Offline
Joined: 2009-12-06
Posts: 4268

I've now posted some notes on porting example code from other toolchains into the LPCXpresso IDE, which you might find useful:

http://support.code-red-tech.com/CodeRedWiki/PortingCodeOtherToolchains

Regards,
CodeRedSupport

renan
Offline
Joined: 2009-12-11
Posts: 151

It is not only the NXP example code targeted at other toolchains that use a old CMSIS version. If you look at the FreeRTOS example in FreeRTOS for RDB1768, you will see that the CMSIS used there is also old.
It is not that hard to upgrade to the latest CMSIS version, but it is a lot of paste LPC_... hehe:D

Renan

clement738
Offline
Joined: 2010-09-15
Posts: 7

Rather than providing sample codes to peripherals, why Code Red dont provide a library of functions supporting periperals? For example, to use I2C, just include and then you can use all the functions for I2C, and then you have spi.h, ....

It will make our development time much faster and not finding codes and examples, cut and paste everywhere... Smile

renan
Offline
Joined: 2009-12-11
Posts: 151

clement738 wrote:
why Code Red dont provide a library of functions supporting periperals?

I think this is what you want:

CodeRedSupport wrote:
LPC17xx CMSIS-Compliant Standard Peripheral Firmware Driver Library
http://ics.nxp.com/support/documents/microcontrollers/zip/lpc17xx.cmsis.driver.library.zip

Renan

thinkchip
Offline
Joined: 2010-03-19
Posts: 47

thanks !!! Renan, is a goog start!!

rtos
Offline
Joined: 2010-01-29
Posts: 100

renan,
How do you load and compile these projects in LPCXpresso?

http://ics.nxp.com/support/documents...er.library.zip

renan
Offline
Joined: 2009-12-11
Posts: 151

I don't. I just use parts that are from my interest. I create a project in lpcxpresso and then I copy and adapt what I need.

Renan

fpg
Offline
Joined: 2011-01-27
Posts: 36

CodeRedSupport wrote:
I've now posted some notes on porting example code from other toolchains into the LPCXpresso IDE, which you might find useful:

http://support.code-red-tech.com/CodeRedWiki/PortingCodeOtherToolchains

Regards,
CodeRedSupport

Have someone done this process successfully? It would be great if I knew some details in advance... This article is very well written, but it is very general. I only want to use CMSIS driver lib for a start, and not get lost in every detail right now.

We are talking about a given library that needs to be ported, so I guess it does not mean any problem to put down some facts.

In the case of CMSIS driver library for lpc17xx with LPCXpresso IDE:
- do I need to write a linker script? If so, in what way should it differ from the default one?
- are any changes required due to another version of C?

It seems to me, that the regular response is to copy and paste source code from this library, however, using the real library would be a more elegant solution.

CodeRedSupport
Offline
Joined: 2009-12-06
Posts: 4268

Why can't you just use the version that is shipped with the product?

From the Quickstart panel:
Import Example Projects
Browse to Examples\NXP\LPC1000\LPC17xx
Select the CMSIS zip file
OK
This will import the CMSIS library for LPC17xx

To use it, (again from the Quickstart panel)
New Project->NXP LPC1700 Projects->Simple C
Answer a few questions, and ensure the Use CMSIS option is checked

You will then have a simple project that can use CMSIS

fpg
Offline
Joined: 2011-01-27
Posts: 36

Sorry, I thought that your reply that I quoted was about CMSIS driver library for LPC17xx and that can not be built in LPCXPresso IDE as a whole library.

I get the same errors which rtos wrote here:
http://knowledgebase.nxp.trimm.net/showpost.php?p=4576&postcount=10

CodeRedSupport
Offline
Joined: 2009-12-06
Posts: 4268

Can you tell us *exactly* what you are trying to do? CMSIS is supplied as a library project, and builds without you having to make any changes whatsoever.

fpg
Offline
Joined: 2011-01-27
Posts: 36

CodeRedSupport wrote:
CMSIS is supplied as a library project, and builds without you having to make any changes whatsoever.

Yes, CMSIS is, but not CMSIS driver library.
I would like to build that as a library project. How do I do that?

terrorgen
Offline
Joined: 2011-02-13
Posts: 2

It's going to be easier on the user side if there is a ready-made peripherals library for lpcxpresso...

feedback