This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
lpc1343 [2010/09/08 16:53] ladyada |
lpc1343 [2016/01/28 18:05] (current) |
||
---|---|---|---|
Line 13: | Line 13: | ||
I didn't install UnitTest++ | I didn't install UnitTest++ | ||
+ | Also downloaded the CodeBase | ||
+ | http://www.microbuilder.eu/Projects/LPC1343ReferenceDesign/LPC1343CodeBase.aspx | ||
+ | |||
+ | Followed the Codelite tutorial | ||
+ | http://www.microbuilder.eu/Projects/LPC1343ReferenceDesign/LPC1343CodeLiteTutorial.aspx | ||
+ | |||
+ | Open Main.c in the **root** directory under the Workspace tab | ||
+ | |||
+ | Right-clicked on **LPC1343_CodeBase** and selected **Build** | ||
+ | |||
+ | <file> | ||
+ | ----------Build Started-------- | ||
+ | MESSAGE: Entering directory `C:\Documents and Settings\ladyada\My Documents\Projects\lpc1343\LPC1343_CodeBase _v0.30\build\codelite\/../../' | ||
+ | C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe" -j 2 -f "LPC1343_CodeBase.mk"" | ||
+ | ----------Building project:[ LPC1343_CodeBase - Debug ]---------- | ||
+ | make[1]: Entering directory `C:/Documents and Settings/ladyada/My Documents/Projects/lpc1343/LPC1343_CodeBase _v0.30' | ||
+ | arm-none-eabi-gcc -c -Os -I. -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=cortex-m3 -DTARGET=LPC13xx -fno-builtin -o main.o main.c | ||
+ | arm-none-eabi-gcc -nostartfiles -mthumb -Wl,--gc-sections -T lpc1xxx/memory.ld -o firmware.elf main.o chb.o chb_buf.o chb_drvr.o chb_eeprom.o chb_spi.o mcp24aa.o lm75b.o ILI9325.o drawing.o smallfonts.o consolas9.o consolas11.o consolas16.o ff.o mmc.o adc.o cpu.o cmd.o gpio.o i2c.o pmu.o ssp.o systick.o timer16.o timer32.o uart.o uart_buf.o usbconfig.o usbhid.o stdio.o string.o wdt.o commands.o cdcuser.o usbcore.o usbdesc.o usbhw.o usbuser.o sysinit.o LPC13xx_handlers.o LPC1xxx_startup.o | ||
+ | |||
+ | arm-none-eabi-size firmware.elf | ||
+ | text data bss dec hex filename | ||
+ | 10224 116 602 10942 2abe firmware.elf | ||
+ | |||
+ | arm-none-eabi-objcopy --strip-unneeded -O binary firmware.elf firmware.bin | ||
+ | arm-none-eabi-objcopy --strip-unneeded -O ihex firmware.elf firmware.hex | ||
+ | make[1]: Leaving directory `C:/Documents and Settings/ladyada/My Documents/Projects/lpc1343/LPC1343_CodeBase _v0.30' | ||
+ | Executing Post Build commands ... | ||
+ | succesfully updated crc to: efff1abc | ||
+ | Done | ||
+ | ----------Build Ended---------- | ||
+ | 0 errors, 0 warnings | ||
+ | </file> | ||
+ | |||
+ | That didnt actually work. Went into **projectconfig.h** and commented out **#define CFG_INTERFACE** did a Clean & Build. File is now about 3Kb. LED blinks! Hooray! | ||
+ | |||
+ | Don't make the same mistakes I did, always do a Clean before Build!!! | ||
+ | |||
+ | ====== Adding USB CDC ====== | ||
+ | Now to add some basic printing capability! | ||
+ | |||
+ | <code> | ||
+ | int main (void) | ||
+ | { | ||
+ | // Configure cpu and mandatory peripherals | ||
+ | systemInit(); | ||
+ | |||
+ | while (1) | ||
+ | { | ||
+ | #ifdef CFG_INTERFACE | ||
+ | // Handle any incoming command line input | ||
+ | cmdPoll(); | ||
+ | #else | ||
+ | // Toggle LED @ 1 Hz | ||
+ | systickDelay(1000); | ||
+ | if (gpioGetValue(CFG_LED_PORT, CFG_LED_PIN)) | ||
+ | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON); | ||
+ | else | ||
+ | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF); | ||
+ | |||
+ | // Say Hello to my little friend! | ||
+ | printf("hello World!\n\r"); | ||
+ | |||
+ | #endif | ||
+ | } | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | Do a build and upload the firmware. Connect using a Terminal program at 115.2kbps | ||
+ | |||
+ | {{:lpchello.gif|}} | ||
+ | |||
+ | You'll see a message every second when the LED changes state | ||
+ | |||
+ | ====== Adding analog ====== | ||
+ | |||
+ | You can read from the ADC converter (it can do up to 200ksps) quite easily! | ||
+ | |||
+ | <code> | ||
+ | #include "sysinit.h" | ||
+ | #include "core/adc/adc.h" | ||
+ | |||
+ | int main (void) | ||
+ | { | ||
+ | // Configure cpu and mandatory peripherals | ||
+ | systemInit(); | ||
+ | |||
+ | // initialize the internal ADC | ||
+ | adcInit(); | ||
+ | |||
+ | while (1) | ||
+ | { | ||
+ | #ifdef CFG_INTERFACE | ||
+ | // Handle any incoming command line input | ||
+ | cmdPoll(); | ||
+ | #else | ||
+ | // Toggle LED @ 1 Hz | ||
+ | systickDelay(1000); | ||
+ | if (gpioGetValue(CFG_LED_PORT, CFG_LED_PIN)) | ||
+ | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON); | ||
+ | else | ||
+ | gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF); | ||
+ | |||
+ | // Say Hello to my little friend! | ||
+ | printf("Analog 0: %d\n\r", adcRead(0)); | ||
+ | |||
+ | #endif | ||
+ | } | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | {{:lpcanalogtest.jpg?500|}} | ||
+ | |||
+ | {{:analog0-pot.gif|}} |