UART with LCP11C24

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

UART with LCP11C24

1,255 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by prancius on Wed Sep 19 02:41:43 MST 2012
Hello,

Need help for newbee.

In blink example i added line
[U][SIZE=2][/SIZE][/U]
[SIZE=2][SIZE=2]UARTInit(115200);

And got error: undefined reference to `UARTInit'

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"uart.h" [/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]do not helps. What else need to do?[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff][/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]Regards,[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]Pranas
[/COLOR][/SIZE][/COLOR][/SIZE][/SIZE][/SIZE]
0 Kudos
16 Replies

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Sep 20 11:49:07 MST 2012
This old 2010 samples include CMSIS 1.3 in an own folder. If you create a new LPCXpresso project CMSIS 2.0 is included via library :)

Especially reserving RAM-ROM for CAN usage (without changing linker script) is easier in new created projects as mentioned above.

So I always suggest to start with a new LPCXpresso project and add needed files instead of copying this old samples :rolleyes:
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by prancius on Thu Sep 20 11:06:20 MST 2012
Hello,

Yes i confirm your code is workink well. Problem was in digitus cable. Now i am using ftdi cable and data comes as expected.

Thank you for good videos.

Can you explain what is style diference? As you sad it is 2010?

Regards,
Pranas
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Sep 19 14:48:58 MST 2012

Quote: prancius
So you sugest to create CMSIS 2.0 based project.

Okay i done it, now i have problem with uart functions.
Missing reference to function
[U][SIZE=2]UARTInit(9600);[/SIZE][/U]

[U][SIZE=2]Any sugestions? Should i place somewhere uart.h and uart.c files?[/SIZE][/U]


Did you view these videos :confused:

LPCXpresso Introduction part 1 training video
http://www.youtube.com/watch?v=dV7rG2VdG9E&feature=relmfu

LPCXpresso Introduction part 2 training video
http://www.youtube.com/watch?v=cLvGwmJAA7k&feature=relmfu

Learn Eclipse the LPCXpresso way - from the developers
http://www.youtube.com/watch?v=E6vSPloei-0

How to handle source files is shown in 'LPCXpresso Introduction part 2 training video'  ;)


Quote: prancius

Also for loop did helps. Where is something else.
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](i=0;i<100000000;i++){}[/SIZE][/LEFT]


I don't understand that :confused:


Quote: prancius
[SIZE=2]When sending unsigned char 100 i get 7. I cant understand. Firstlly i thought it use just 7 byte, but no... [/SIZE]



Again: Changed sample above is working, so if you are not receiving correct data either your hardware isn't working or your terminal settings are wrong. It's not a code problem :eek:
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by prancius on Wed Sep 19 13:03:31 MST 2012
So you sugest to create CMSIS 2.0 based project.

Okay i done it, now i have problem with uart functions.
Missing reference to function
[U][SIZE=2]UARTInit(9600);[/SIZE][/U]

[U][SIZE=2]Any sugestions? Should i place somewhere uart.h and uart.c files?[/SIZE][/U]

Also for loop did helps. Where is something else.
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](i=0;i<100000000;i++){}[/SIZE][/LEFT]

[LEFT][SIZE=2]When sending unsigned char 100 i get 7. I cant understand. Firstlly i thought it use just 7 byte, but no... [/SIZE][/LEFT]
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Sep 19 09:58:13 MST 2012

Quote: prancius
Why think it is old?



It's using CMSIS 1.3 and also own linker scripts. That's 2010 style

Changing your code to
unsigned char m1='1';
unsigned char m2='2';
unsigned char m3='3';

int main (void)
{
 volatile unsigned int i;
 UARTBuffer[0]=m1;
 UARTBuffer[1]=m2;
 UARTBuffer[2]=m3;
 UARTInit(9600);
 while (1)
 {
[COLOR=Red]  for(i=0;i<1E5;i++){}                    //delay[/COLOR]
  UARTSend( (uint8_t *)UARTBuffer, 3);
  UARTBuffer[2]=++m3;
 }
}
is showing a working 9600 bps transmission. Without delay you are kidding UART FIFO, so the result is nonsense :eek::p:eek:
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by prancius on Wed Sep 19 09:24:40 MST 2012
Hello,

It is not CAN project ir is UART
Why think it is old?

Project source
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Sep 19 09:14:55 MST 2012
You're still working with this old CAN sample and its included libs, so I don't know if you are really using 9600 bps :confused:

#1 You should scope your TxD and confirm right speed ;)

#2 You should start a new LPCXpresso CMSIS2.0 CAN project without this old stuff as mentioned already in  http://knowledgebase.nxp.com/showthread.php?t=3138  :)
 
#3 Post your project that someone else can confirm right UART speed  :rolleyes:
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by prancius on Wed Sep 19 08:27:10 MST 2012
This terminal also shows the same simbols.

[LEFT][SIZE=2]UARTBuffer[0]=48;[/SIZE]
[SIZE=2]UARTBuffer[1]=49;[/SIZE]
[SIZE=2]UARTBuffer[2]=50;[/SIZE][/LEFT]

I got

[IMG]http://infoside.lt/~pranas/simbols.JPG[/IMG]

And it should be 0, 1, 2

Also noticed.
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]sending unsigned[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]char[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] m1=100;  in terminal is [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]7[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]sending unsigned[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]char[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] m2=101; in terminal is [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]5[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]sending unsigned[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]char[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] m3=102; in terminal is [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]3[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE]
Why it so?

Regards,
Pranas
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Wed Sep 19 05:46:51 MST 2012

Quote: prancius

[SIZE=2][LEFT] Is there some trick?
[/LEFT]
[/SIZE]



Yes :) Throw away Hyperterminal, use TeraTerm: http://ttssh2.sourceforge.jp/ ;)
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by prancius on Wed Sep 19 05:24:42 MST 2012
I have tried 9600 and 115200, The same ..
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ArtjomGromak on Wed Sep 19 05:11:23 MST 2012

Quote: prancius
Hello,

Your sugestions helps me alot. Now i can see data in terminal.

Now i have another problem.

Then i am sending

[SIZE=2][LEFT]UARTBuffer[0]=48;
UARTBuffer[1]=49;
UARTBuffer[2]=50;

I expect get in terninal 0,1,2 but get strange simbols.

Is there some trick?

Thank you

[/LEFT]
[/SIZE]


Try change baubrate in terminal or in program.
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by prancius on Wed Sep 19 05:08:39 MST 2012
Hello,

Your sugestions helps me alot. Now i can see data in terminal.

Now i have another problem.

Then i am sending

[SIZE=2][LEFT]UARTBuffer[0]=48;
UARTBuffer[1]=49;
UARTBuffer[2]=50;

I expect get in terninal 0,1,2 but get strange simbols.

Is there some trick?

Thank you

[/LEFT]
[/SIZE]
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Wed Sep 19 04:32:45 MST 2012
User Manual:

Quote:

24.6 Functional description:
The SysTick timer is a [COLOR=Red]24-bit[/COLOR] timer that counts....:p

0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ArtjomGromak on Wed Sep 19 04:07:51 MST 2012
SysTick->LOAD=SystemCoreClock;



Try chacge SysTick->LOAD=SystemCoreClock/100; (I think SystemCoreClock is too big for SysTick->LOAD).

or call UARTSend from main.
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by prancius on Wed Sep 19 03:39:34 MST 2012
Thank you, now my code without errors, but can not get anything in Hyperterminal.


[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"driver_config.h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]
[LEFT][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include[/LEFT]
[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"target_config.h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]
[LEFT][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include[/LEFT]
[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"gpio.h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]
[LEFT][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include[/LEFT]
[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]<stdio.h>[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]
[LEFT][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include[/LEFT]
[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"uart.h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]
[/COLOR][/SIZE]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/LEFT]
[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]state=0;[/SIZE]
 
[LEFT][SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] UARTBuffer[BUFSIZE];[/SIZE]
[SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032]uint32_t[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] count=3;[/SIZE][/LEFT]
 
[LEFT][SIZE=2] [/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/LEFT]
[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][B]SysTick_Handler[/B] ([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2])[/SIZE]
[LEFT][SIZE=2]{[/SIZE]
[SIZE=2]state=~state;[/SIZE]
[SIZE=2]GPIOSetValue( 0, 7, state);[/SIZE][/LEFT]
 
[LEFT][SIZE=2]UARTBuffer[0]=80;[/SIZE]
[SIZE=2]UARTBuffer[1]=81;[/SIZE]
[SIZE=2]UARTBuffer[2]=82;[/SIZE][/LEFT]
 
[LEFT][SIZE=2]UARTSend( ([/SIZE][SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032]uint8_t[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] *)UARTBuffer, count );[/SIZE][/LEFT]
 
[LEFT][SIZE=2]}[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/LEFT]
[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][B]main[/B] ([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2])[/SIZE]
[LEFT][SIZE=2]{[/SIZE]
[SIZE=2]SystemInit ();[/SIZE]
[SIZE=2]GPIOInit();[/SIZE][/LEFT]
 
[LEFT][SIZE=2]UARTInit(115200);[/SIZE][/LEFT]
 
[LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/*[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]
[SIZE=2][COLOR=#3f7f5f]1 - output[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]0 - input[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]*/[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]GPIOSetDir(0,7,1);[/SIZE][/LEFT]
 
[LEFT][SIZE=2]SysTick->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]LOAD[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=SystemCoreClock;[/SIZE]
[SIZE=2]SysTick->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]VAL[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=0;[/SIZE]
[SIZE=2]SysTick->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CTRL[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=0x7;[/SIZE][/LEFT]
 
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]while[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (1) {}[/SIZE][/LEFT]
 
[LEFT][SIZE=2]}[/SIZE][/LEFT]
 
I am using digitus serial converter. 
2 pin RX to LPC11C24 board TX (P1_7)
3 pin TX to LPC11C24 board RX (P1_6)
5 pin gnd to board gnd


Any ideas what else problem could be?

Regards,
Pranas
[/LEFT]
0 Kudos

1,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ArtjomGromak on Wed Sep 19 03:03:24 MST 2012

Quote: prancius
Hello,

Need help for newbee.

In blink example i added line
[U][SIZE=2][/SIZE][/U]
[SIZE=2][SIZE=2]UARTInit(115200);

And got error: undefined reference to `UARTInit'

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]#include[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"uart.h" [/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]do not helps. What else need to do?[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff][/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]Regards,[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]Pranas
[/COLOR][/SIZE][/COLOR][/SIZE][/SIZE][/SIZE]



Add uart.c in project directory. And edit driver_config.h.
0 Kudos