10 years, 9 months ago.

Adding pins - pin names on LPC1768 with mbed shield

Hi everybody.

My question may be a little bit "stupid", but is it possible, if you make your own HW with a LPC1768, to add new pins eg. p31,p32..etc) ?

I would like to make my own piece of HW with all I/O pins used and still use the mbed shield to program the board.

Thank you in advance.

Regards

4 Answers

10 years, 9 months ago.

Hi,

There's no reason this shouldn't be possible... What you'll need to do is use an offline toolchain, which you can download on mbed's Github page. (http://github.com/mbedmicro/mbed) you'll then need to install something like GCC-ARM which you can download at: (https://launchpad.net/gcc-arm-embedded). Then, you'll need to modify the following file in the code you downloaded (linked to on github, but modify on your computer: https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/PinNames.h). Then, add your custom pins to the enum typedef in there, for example p30 = P1_12 or whatever you want. If you want the numbers to correspond to the actual pin number on the chip, I suggest you look either at the LPC1768 user manual, or the datasheet.

In order to compile the modified SDK, you need to create a file called 'private_settings.py' inside workspace_tools in the sdk download directory from earlier, in which you should put the contents of 'settings.py' which already exists in that folder, however you need to modify some of the lines of code such as gcc_arm_path to suit the directory to which you installed GCC_ARM. All you need to do then is go to the directory where you downloaded the git repository and run:

python workspace_tools/build.py -t GCC_ARM -m LPC1768

though change the GCC_ARM bit to ARM_STD or whatever is applicable to the toolchain you are using...

In order to compile the code you've written for mbed, export your project from the online mbed compiler and you should be able to compile that using the modified SDK, however you may need to change some of the linker settings to use the modified SDK that you've compiled, rather than the precompiled SDK that is included when you export from the online compiler.

Hope it helps,

Matt

Accepted Answer
10 years, 9 months ago.

While Matthews option is possible, there are what I think are slightly easier solutions. Several options:

First of all, you are aware you can address any pin as P#_#? So pin 13 of port 2 is P2_13?

Option B, simply add a list of defines with a slightly different name then currently used. So instead of p5, p6, etc, name them P5, P6, P7 for example. A simple example for another board is here: http://mbed.org/users/frankvnk/code/Mini-DK/file/6816fa47b39e/Mini_DK.h.

And option C is similar to Matthew's, but just in the online compiler. Throw away your mbed library, import the mbed-src library (http://mbed.org/users/mbed_official/code/mbed-src/). Then go to Vendor/NXP/LPC1768/hal/PinNames.h and change them there.

That's definitely easier

posted by Matthew Else 29 Jul 2013
10 years, 9 months ago.

If you make your own PCB, then almost all of the pins are available, AS IN MBED,

the MBED compiler will work, just fine,

the physical MBED pins (the ones used on the blue & yellow PCB are named the same),

and the others can be named just as easily eg

DigitalOut MyNewLed1(P3_25);
DigitalOut MyNewLed2(P3_26);
DigitalOut MyNewLed3(P0_27);    // Inv
DigitalOut MyNewLed4(P0_28);    // Inv

and if you use LPC1768, then you can use flash Magic, or if you use LPC11U24, you can use built in USB Boot loader,

check out some of my posts on custom PCB,

and exemplary work:

prototype to hardware,

also somewhere there are some good pin-outs available,

If I get a chance I will ad some links.

Ceri

Exalent Work

KL25Z Version

Pinout image

M0 MBED clone

The "Pinout Image" https://mbed.org/users/Lerche/notebook/lpc1768-pin-functions/ has an error that I have reported before... Pin 78 Func 4 is not MAT3.1 but MAT2.1.

posted by Geert Hospers 29 Jul 2013
10 years, 9 months ago.

Uhhh...

All 3 answers are more than usefull! Thank you to all of you for your help and time! I have Keil installed, and CMSIS-DAP, so the problem for offline tools is solved. Now I can moove further, to start drawing the schematics. Thank you once again for your help!