# I want to start ARM with lpc1768 cortex M3

Status
Not open for further replies.

#### very question

hello friends
I want to start ARM with lpc1768 , help me
1-what do you suggest me in order to start learning ARM??
2-which compiler is better? (IAR or Keil)
3-I saw many libraries like CMSIS , what is CMSIS library ??

Last edited:

#### very question

nobody help me!!!

#### doraemon

##### Super Moderator
Staff member
Hello!

1. If you want something cheap, you may want to try Texas Instruments ARM launchpad.
The boards costs about 5 Euros.
2. There is no reply to your question. There are people who prefer Keil, some who prefer
IAR, etc. On top of that, most of people's replies are not based on experience with 2 or more
systems, but on the only compiler they have installed on their PC.
3. CMSIS: Why this question? Did you try google first?

Dora.

very question

### very question

Points: 2

#### alexxx

2-which compiler is better? (IAR or Keil)
I have used both. IAR has better editor and world class compiler. Keil is more suited on ARM though, and has a much better debugger, ideal for new starters. Most of the references you will find in the web will be on Keil. IAR on the other hand, has the advantage of all in one. This means that if someday you switch to another MCU, IAR will propably support it. As far as I know Keil supports only 8051 and ARM cores.

very question

### very question

Points: 2

#### bigdogguru

1. If you want something cheap, you may want to try Texas Instruments ARM launchpad.
The boards costs about 5 Euros.

Actually, I believe TI has recently raised their price on their Stellaris Launchpad.

I bought two units when they were first released at $5 USD per unit, now they are listed at$12.99 USD per unit.

Although, at \$12.99 I would still consider the Stellaris Launchpad an economical option.

@very question

I own license for and use both KEIL and IAR. I prefer KEIL as it has become an industry standard partially due to the fact ARM, Ltd. has a financial interest in KEIL.

CMSIS is a standardized library of routines for the Cortex-Mx series of ARMs and portable regardless of the devices manufacturer.

BigDog

very question

### very question

Points: 2

#### Jigar 4 Electronics

##### Full Member level 5
hello friends
I want to start ARM with lpc1768 , help me
1-what do you suggest me in order to start learning ARM??

If you're new to ARM then, the books - "Arm - System-on-chip architecture, Steve Furber "

or

"ARM System Developer’s Guide, Designing and Optimizing System Software,
By Andrew N. Sloss, Dominic Symes & Chris Wright " can be the good options to start with basics.

& if you're not new to ARM then technical reference manual & datasheet are enough to go through.

### very question

Points: 2

Points: 2

#### very question

Thanks my friends
I installed Keil u vision4
and I have lpc1768 header board
Now I want to continue,whould you please show me the way of learning ARM?
Do you recommend using CMSIS library or the keil's library? which one is better & more helpful

#### very question

Hi my friends
I wrote my first program for LPC1768 with CMSIS library and compiled it with keil
I want to set p0.21 but after programing all of my p0 pins show 2.2v
I program with bootloader and I change the start address of memory in to 0x2000
Code:
#include "lpc17xx.h"
#include "lpc17xx_gpio.h"

int main(void) {

GPIO_SetDir(0,1<<21,1);
GPIO_SetValue(0,1<<21);

while(1){

}
}

#### alexan_e

Can you retry with 1UL<<21 instead of 1<<21

#### very question

Can you retry with 1UL<<21 instead of 1<<21
Thanks alexan_e
but it does'nt have any difference from the past
in the simulation i see 0x00100000=1 but when I test port0 all of them 2.2V:shock:

Last edited:

#### alexan_e

I'm not sure if it's the code or there is something wrong with the project or the way you program the chip.

What if you try
Code:
LPC_GPIO0->FIODIR = 1UL<<21;  // set P0.21 as output
LPC_GPIO0->FIOCLR = 1UL<<21;  // set P0.21 to 0

very question

### very question

Points: 2

#### very question

I'm not sure if it's the code or there is something wrong with the project or the way you program the chip.

What if you try
Code:
LPC_GPIO0->FIODIR = 1UL<<21;  // set P0.21 as output
LPC_GPIO0->FIOCLR = 1UL<<21;  // set P0.21 to 0
I haven't any problem in the simulation
what is the default value of this microcontroller's pins?(zero?)
I will change this program as you told & I will tell you the result:grin:

#### alexan_e

The default for all pins is input with pull-up enabled so you would read logic 1.
Exceptions are the P0.27, P0.28, P0.29, P0.30 which are I2C and USB pins and have no pullup resistor feature.

The code I gave you write the values directly to the registers instead of calling the functions because I want to make sure that the problem is not the functions (which I have never used)

#### very question

HI my friends
I changed program in the following way and everything is ok now
Code:
#include "lpc17xx.h"
#include "lpc17xx_gpio.h"
int main(void)
{
FIO_SetDir(0,0x0000000f,1);
FIO_SetValue(0,0x0000000f);

}
but I haven't understood yet what was the problem of my last program and why the keil compiler didn't make any error 8-O
this is my last program
Code:
#include "lpc17xx.h"
#include "lpc17xx_gpio.h"
int main(void) {

GPIO_SetDir(0,1<<21,1);
GPIO_SetValue(0,1<<21);

while(1){
}
}

#### alexan_e

1<<21 equals 0x00200000 but now you have used 0x0000000f , these two are not the same.

I also suggest you use 1UL<<x , UL means unsigned long because if you don't it may not work correctly due to truncation

- - - Updated - - -

Actually you have used different functions too, FIO_SetDir and FIO_SetValue instead of GPIO_SetDir and GPIO_SetValue .
You should check the library code to see the difference.

Points: 2

### enekas

Points: 2

#### very question

1<<21 equals 0x00200000 but now you have used 0x0000000f , these two are not the same.

I also suggest you use 1UL<<x , UL means unsigned long because if you don't it may not work correctly due to truncation
I know 1<<21 is different with 0x0000000f ,that was just an example

Actually you have used different functions too, FIO_SetDir and FIO_SetValue instead of GPIO_SetDir and GPIO_SetValue .
You should check the library code to see the difference.
by the following program it worked right
Code:
#include "lpc17xx.h"
#include "lpc17xx_gpio.h"
int main(void)
{
GPIO_SetDir(0,0x0000000f,1);
GPIO_SetValue(0,0x0000000f);

while(1)
{
}
}
I think we can't use this form 1<<21 in this library

Last edited:

#### alexan_e

Where did you find the "lpc17xx_gpio.h" header, I can't find it in the code bundle.

I remember having problems with 1<<x in the past but I don't remember exactly the case.

#### very question

Where did you find the "lpc17xx_gpio.h" header, I can't find it in the code bundle.

.
"lpc17xx_gpio.h" is in the lpc17xx.cmsis.driver.library/Drivers

#### very question

I wrote another program according to the LedBlinky example from cmsis library , I want 300ms delay, but in the experiment it delays more than 300ms
I think ,the problem is in SysTick_Config
Is there any body know how to set it?
Code:
#include"lpc17xx.h"
#include "lpc17xx_gpio.h"
#include "lpc17xx_libcfg.h"
volatile unsigned long SysTickCnt;
void SysTick_Handler (void);
void Delay (unsigned long tick);
void SysTick_Handler (void) {
SysTickCnt++;
}

void Delay (unsigned long tick) {
unsigned long systickcnt;

systickcnt = SysTickCnt;
while ((SysTickCnt - systickcnt) < tick);
}

int main(void){
GPIO_SetDir(1, 0x10000000, 1);             /* LED on P1.0 defined as Output    */
SysTick_Config(SystemCoreClock/1000 - 1); /* Generate interrupt each 1 ms   */

while(1){
GPIO_SetValue(1,0x10000000);             /* LED on P1.0 on    */
Delay(300);
GPIO_ClearValue(1, 0x10000000);         /* LED on P1.0 off    */
Delay(300);

}
}

Last edited:

Status
Not open for further replies.