Beginner in programming ARM chips

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

Beginner in programming ARM chips

1,421 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amlwwalker on Wed Jun 26 10:34:36 MST 2013

Hi,


I hope that someone can help me here.


I have bought these two items in an attempt to begin programming and learning about ARM microcontrollers:


<a href="https://www.olimex.com/Products/ARM/JTAG/ARM-USB-TINY-H/">https://www.olimex.com/Products/ARM/JTAG/ARM-USB-TINY-H/</a>


<a href="https://www.olimex.com/Products/Modules/LCD/MOD-LCD4.3''/">https://www.olimex.com/Products/Modules/LCD/MOD-LCD4.3''/</a>


I have programmed 8 bit AVRs for about three years as a hobby I am just trying to get the too chain working at this point for ARM, that is open source.


Unfortunately, the example that comes with the board above only works in IAR IDE which, from research is about £2000. I downloaded the trial version to see if I could get the example building but I dont have £2000 available...


When programming AVR's I have used Eclipse so I would like to use this again.


I downloaded


winARM and put it in C drive, so there is:


C:\WinARM


I have Eclipse, and when I start a new project I can see: ARM Windows GCC (GNUARM, WinARM) - so I select this one


I start a new project, and in Project Proeprties I choose cortex M3 Processor. I have set optimization to -Os, and have unticked Thumb (-mthumb)


However I cant find anywhere a very simple - preferably uart/serial example for this chip that I can try. I have downloaded keil, OpenOCD from Olimex, IAR, yaggarto and I have not had any success.


Please can someone help me by giving me a very very simple example that should work on this board so that I atleast have something I can start with - I said uart example before because I know that the uart works from the example that was preprogrammed.


I have installed the drivers for the JTAG above, but I am not sure how to setup eclipse to use the JTAG, any instruction on this would also be really helpful...


Im tearing my hair out here...I have spoken with Olimex and they said that they cant write an example that uses openOCD because their example is heavily reliant on IAR code - which I thought was strange considering they have a tutorial on their website for openOCD setup with other boards of theirs.


If you were wanting to make my life as easy as possible a zip with eclipse preconfigured would be amazing. 


 


What I understand is:


I need Eclipse - Done.


I need WinARM - Done.


I need to configure Eclipse to use WinARM - not sure if I have done that properly - not sure how to check


I need a very simple example that will do something on this board - not done


I need to verfiy that the JTAG works - I dont mind if I do this from command line or from Eclipse, Im just not sure how to test it.


 


THanks again everyone. I would greatly appreciate some help with this. At the moment I feel like I just spent 70 euros on a paper weight.


 


Alex

Labels (1)
0 Kudos
10 Replies

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amlwwalker on Mon Aug 12 12:03:48 MST 2013

Quote:

Note that there are two distinct LPC17 families. The original LPC17xx parts are the LPC175x/LPC176x. These have a number of differences from the later LPC177x/LPC178x. Within LPCXpresso LPC17xx generally refers to the LPC175x/LPC176x parts, with LPC177x_8x referring to the later. You want to make sure that the code you have copied from the external website that you have found actually matches the part you are using. If in doubt, consult the user manual!

LPC175x_6x: http://www.lpcware.com/node/11538/129
LPC177x_8x : http://www.lpcware.com/node/11538/77

I suspect that the errors you are seeing of the form "stray '\342'" are down to the text you have copy and pasted from the external webpages having characters in it outside of the 7-bit set that the compiler is not accepting. You'll need to delete such characters from your source file.



This has made me look again.
I'm going through the makefile I have and Im noticing things that I hadn't noticed before...

There are a few lines that I dont think are correct for use with the LPC1788. Please can people comment:

CHIP_FAMILY ?= 11xx
However in another file, there is:
CHIP_FAMILY = 17xx_40xx
CHIP = CHIP_LPC175X_6X

It all compiles fine just I think for the wrong chip. Maybe thats why Im not getting anything?
0 Kudos

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Aug 07 00:07:45 MST 2013

Quote: amlwwalker

make all
Building file: ../src/main.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC177x_8x -I"C:\Users\A Walker\Documents\LPCXpresso_5.2.6_2137\workspace\CMSISv2p00_LPC177x_8x\inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -MMD -MP -MF"src/main.d" -MT"src/main.d" -o "src/main.o" "../src/main.c"
../src/main.c: In function 'Delay':
../src/main.c:34:1: error: stray '\342' in program
../src/main.c:34:1: error: stray '\200' in program
../src/main.c:34:1: error: stray '\223' in program
../src/main.c:34:21: error: expected ')' before 'curTicks'
../src/main.c:30:10: warning: variable 'curTicks' set but not used [-Wunused-but-set-variable]
../src/main.c: In function 'LED_Config':
../src/main.c:42:10: error: 'LPC_GPIO_TypeDef' has no member named 'FIODIR'
../src/main.c: In function 'LED_On':
../src/main.c:50:10: error: 'LPC_GPIO_TypeDef' has no member named 'FIOPIN'
../src/main.c: In function 'LED_Off':
../src/main.c:58:10: error: 'LPC_GPIO_TypeDef' has no member named 'FIOPIN'
make: *** [src/main.o] Error 1



Note that there are two distinct LPC17 families. The original LPC17xx parts are the LPC175x/LPC176x. These have a number of differences from the later LPC177x/LPC178x. Within LPCXpresso LPC17xx generally refers to the LPC175x/LPC176x parts, with LPC177x_8x referring to the later. You want to make sure that the code you have copied from the external website that you have found actually matches the part you are using. If in doubt, consult the user manual!

LPC175x_6x: http://www.lpcware.com/node/11538/129
LPC177x_8x : http://www.lpcware.com/node/11538/77

I suspect that the errors you are seeing of the form "stray '\342'" are down to the text you have copy and pasted from the external webpages having characters in it outside of the 7-bit set that the compiler is not accepting. You'll need to delete such characters from your source file.

Regards,
LPCXpresso Support
0 Kudos

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by -0o- on Tue Aug 06 12:27:38 MST 2013
Here.. hope this helps
download the attached chm file..
at the main page click on the LPC1000 Software Development Toolchain
and follow instructions..
I have mine set up + segger J-link...


0 Kudos

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amlwwalker on Sat Aug 03 03:48:30 MST 2013
Thanks guys for your respones.
I can feel myself getting close.....

This is my setup. I have imported CMSISv2p00_LPC177x_8x into the workspace, I have started a new project linking to that project.

I followed the blink led tutorial over at http://www.zembedded.com/in-depth-led-blink-with-nxp-lpc17xx/ which has got me close to something that should blink the led.

I have attached a picture of my workspace (files.png), the code in main is below and I have attached a snippet of the schematic to make sure I haven't made an error in the pin number as a double check (ledschem.png).

I am getting some errors though that I think are to do with the code at the above site not quite being right for my chip.

Please could someone comment. Thanks:

//#ifdef __USE_CMSIS
//#include "LPC177x_8x.h"
//#endif
#include "LPC177x_8x.h"

volatile uint32_t msTicks;

void SysTick_Handler(void)

{

msTicks++;

}

__INLINE static void Delay (uint32_t dlyTicks)

{

uint32_t curTicks;

curTicks = msTicks;

while ((msTicks – curTicks) < dlyTicks);

}

__INLINE static void LED_Config(void)

{

LPC_GPIO1->FIODIR = 0xB0000000; /* LEDs PORT1 are Output */

}

__INLINE static void LED_On (uint32_t led)

{

LPC_GPIO1->FIOPIN |= (led); /* Turn On LED */

}

__INLINE static void LED_Off (uint32_t led)

{

LPC_GPIO1->FIOPIN &= ~(led); /* Turn Off LED */

}

int main (void)
{

if (SysTick_Config(SystemCoreClock / 1000)) /* Setup SysTick Timer for 1 msec interrupts */

{

while (1); /* Capture error */

}

LED_Config();

while(1)
       {

         LED_On ((1<<18)); /* Turn on the LED. */

         Delay (100); /* delay 100 msec */

         LED_Off ((1<<18)); /* Turn off the LED. */

         Delay (100); /* delay 100 msec */

       }

}



errors:

Quote:

make all
Building file: ../src/main.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC177x_8x -I"C:\Users\A Walker\Documents\LPCXpresso_5.2.6_2137\workspace\CMSISv2p00_LPC177x_8x\inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -MMD -MP -MF"src/main.d" -MT"src/main.d" -o "src/main.o" "../src/main.c"
../src/main.c: In function 'Delay':
../src/main.c:34:1: error: stray '\342' in program
../src/main.c:34:1: error: stray '\200' in program
../src/main.c:34:1: error: stray '\223' in program
../src/main.c:34:21: error: expected ')' before 'curTicks'
../src/main.c:30:10: warning: variable 'curTicks' set but not used [-Wunused-but-set-variable]
../src/main.c: In function 'LED_Config':
../src/main.c:42:10: error: 'LPC_GPIO_TypeDef' has no member named 'FIODIR'
../src/main.c: In function 'LED_On':
../src/main.c:50:10: error: 'LPC_GPIO_TypeDef' has no member named 'FIOPIN'
../src/main.c: In function 'LED_Off':
../src/main.c:58:10: error: 'LPC_GPIO_TypeDef' has no member named 'FIOPIN'
make: *** [src/main.o] Error 1



The only thing then to do is get it working with my JTAG, but one step at a time......

Thanks again guys
0 Kudos

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by studyembedded on Thu Aug 01 22:49:33 MST 2013
For basic tutorials check http://www.zembedded.com/category/arm-2/?viewall ...best of luck!
0 Kudos

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amlwwalker on Mon Jul 29 05:36:32 MST 2013
Ok thanks Wouter,
what does that allow me to do?
Will that give me the ability to link to those includes or something?
Any chance you have a simple (led blinky) c file you could give me, I know there is an led available on port 0 pin 18.

Also do you know how to get it to create a .hex file?

Thanks
A
0 Kudos

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Wouter on Mon Jul 29 01:38:36 MST 2013
On LPCXpresso:

You probably want to include the LPC177x_8x CMSIS project:
- Click the File menu, choose "Import".
- Choose "Existing Projects into Workspace"
- Select radiobutton "Select archive file", browse to: [LPCXpresso install dir]\lpcxpresso\Examples\NXP\LPC1000\LPC177x_8x\CMSISv2p00_LPC177x_8x.zip
- Finish

Your new project can be created like this:
- File->New->Project
- C/C++->LPCXpresso C Project
- LPC177x_8x->C Project
- Hit next until Finish appears, make sure the CMSIS library is selected in the last step.
0 Kudos

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amlwwalker on Sun Jul 28 09:16:48 MST 2013
Hi guys, thanks for your responses.
As far as I can tell I have installed the ocd-h jtag from Olimex fine. Im not sure how I can test it, but it seems to appear correctly in the DM.

I have downloaded and installed LPCXpresso and am more than willing to give it a shot.
Its installed I have started a new Executable Project in C using the Code Red MCU Tools, as opposed to the other option, MinGW GCC.
I set the device as LPC1788 and create a file called main.c
Now, my trouble comes at the point where I want a super basic example for this chip to see if I can flash it with something - just led blinking, nothing more. I dont even think I would need any includes for that - although I would like one so that I can use the macro names for the pins.
Lastly, it doesnt create a .hex file - which I think I need to flash the chip? Im using the olimex ocd -h jtag and Im not sure how to connect this in with Xpresso.

Then how to connect it up with the librares in LPCopen so that I can use the serial, lcd etc - as I see how it works, I'll be able to work my way through things and wont be at such a loss.

BTW - I dont know if you've seen my other thread, but if you were to help me, and the easiest way for you to see my setup was to RDP in then I would be happy with that and would be willing to pay beer tokens for the time you have taken.
Thanks
A

Edit: Just spotted the file: NXP/LPC17xx/LPC17xx.h - looks like this is the include for GPIO? There's also uart etc in there.

Could someone write me a very simple main.c that uses these includes to flash an led and maybe send a stream of characters to the serial port? - Beer tokens also available here!
0 Kudos

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by khmtambi on Tue Jul 23 05:48:10 MST 2013
why dont you use keil MDK ARM compiler? its pretty much easy. plus there are plenty of examples arranged in an order. if you were starter you should have gone through some research before buying actual board. i am a new too. but fortunately i bought a board that has pin configuration mostly related to keil MCB1700 board are examples are a huge bundle.

if you shift from your IDE to keil MDK i might help you.
0 Kudos

1,095 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by -0o- on Wed Jul 17 15:27:02 MST 2013
first of all this is an LPC EXPRESSO forum
you can only discuss topics related to the NXP expresso.. well I guess.

I really wish I could help Alex,
but unfortunately, I have been on the same rout but to no avail
these olimex jtag products are extremely tricky and frustration...
only one olimex jtag but there seems to be about a billion of solutions on how to get it working. even their own site don't provide any explaining on getting their products to work
instead they refer customers to other sites to follow some instructions....
it's ridiculous
i have an OLIMEX - OCD H version
i went on for months trying to get it to work
i also did eclipse, winarm, code sourcery, yagarto etc etc... you name it...
then i finally tried Rowley's crosswork compiler which comes with all the arm jtag installed
within so all you have to do is install the olimex jtag in device manager
and then the compiler will automatically detect it.
i have wasted countless time with these gnu/open source stuff.
downside is that rowleys CW costs 160$
also getting the jtag to work wont be the only problem
you will also require
an example project which includes a makefile and a linker script.

i honestly do like gnu tools but it would be best that i give up everything and start from ground up like you did; with the AVR. I will focus more on the stm8s

here is how i got the OCD - H  installed
download .zip Olimex OpenOCD JTAG
https://www.olimex.com/Products/ARM/JTAG/ARM-USB-OCD-H/
for the instruction below

https://www.olimex.com/Products/ARM/JTAG/_resources/Installing-OpenOcd-Rev.G-drivers-for-Windows-7.p...





0 Kudos