Site Information

 Loading... Please wait...

NXP LPC17xx ARM Cortex-M3 Microcontroller - Programming Tips & Tricks

NXP LPC17xx Series - Programming Tips & Tricksby Wilfried Voss

We at Copperhill Technologies have developed a series of embedded solutions for the CAN and SAE J1939 industry, which are all based on either the NXP LPC1754 or NXP LPC1768 processors, depending on the application requirements.

I personally consider embedded programming one of the most intriguing and creative tasks in the world of technology with hardware design claiming a close second place. All this remains true as long as things go smooth and all your software libraries do what you expect them to do. This is also a scenario where the Internet is of great help, meaning if you need help with programming, for instance, the UART of an ARM Cortex-M3 microcontroller, you will find tons of code that all look very similar (because they have been copied numerous times, sometimes even illegally by ignoring the manufacturer’s copyright message).

However, there can be a problem with freely available but unproven source code. Most of the code examples I found through the Internet did, in the least, not meet my very personal standards of readable code. It is a sad fact that many embedded programmers post their code in a very poor condition, where lack of comments is the least shortcoming. As a first step, I usually take the code I found and reformat it for readability without changing any functionality.

Things become worse when the code works only under certain conditions, and that was true, for instance, in the case of programming the UART, where the original KEIL code works only up to 115,200 baud. I started some research on the issue and found a working solution, which I will, among many other programming samples, post on this section of our website. This "little" problem and many other "researches" inspired me to share my knowledge and support fellow programmers with working sample code.

Note: This is a work in progress, and posts will be added frequently.

Misc. Posts


Table of Contents

Introduction 

Application Samples

  • LPC1768 - IAP Flash Programming - In Preparation...
  • LPC1768 - Timer Implementation - In Preparation...
  • LPC1768 - General I/O Control (GPIO) - In Preparation...
  • LPC1768 - UART Programming - In Preparation...
  • LPC1768 - CAN Bus Port Programming - In Preparation...
  • LPC1768 - SD Card Access - In Preparation...
  • LPC1768 - Real-Time Clock Programming - In Preparation...

LPC17xx - More helpful information on the web

Note: Please use the following resources to gain more detailed information on the individual topics, but please be aware that the code examples are tailored for use with the KEIL IDE. If you use the KEIL compiler, you are fine. However, we at Copperhill Technologies promote the use of the MCUXpresso IDE, which, after all, is free-of-charge. We are in the ongoing process of providing code sample for the MCUXpresso IDE, and they are listed in the previous paragraph (Application Samples).


The Definitive Guide to ARM Cortex-M3 and Cortex-M4 Processors

The Definitive Guide to ARM Cortex-M3 and Cortex-M4 Processors by Joseph Yiu

This new edition has been fully revised and updated to include extensive information on the ARM Cortex-M4 processor, providing a complete up-to-date guide to both Cortex-M3 and Cortex-M4 processors, and which enables migration from various processor architectures to the exciting world of the Cortex-M3 and M4.

This book presents the background of the ARM architecture and outlines the features of the processors such as the instruction set, interrupt-handling and also demonstrates how to program and utilize the advanced features available such as the Memory Protection Unit (MPU).

Chapters on getting started with IAR, Keil, gcc and CooCox CoIDE tools help beginners develop program codes. Coverage also includes the important areas of software development such as using the low power features, handling information input/output, mixed language projects with assembly and C, and other advanced topics.

  • Two new chapters on DSP features and CMSIS-DSP software libraries, covering DSP fundamentals and how to write DSP software for the Cortex-M4 processor, including examples of using the CMSIS-DSP library, as well as useful information about the DSP capability of the Cortex-M4 processor
  • A new chapter on the Cortex-M4 floating point unit and how to use it
  • A new chapter on using embedded OS (based on CMSIS-RTOS), as well as details of processor features to support OS operations
  • Various debugging techniques as well as a troubleshooting guide in the appendix
  • topics on software porting from other architectures
  • A full range of easy-to-understand examples, diagrams and quick reference appendices

More Information...