Display a string on via the uart (using the LTC1114 CPU)

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

Display a string on via the uart (using the LTC1114 CPU)

2,216 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by guillaume_arveni on Thu Feb 16 06:53:04 MST 2012
Hi,

I am using the UART example and I would like to display "Hello" via the uart.

==> How can I do it? I am using the printf("hello") function but it does not work.

Please let me know about that

Regards,

guillaume
0 Kudos
Reply
5 Replies

2,180 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by js-nxp on Thu Feb 23 16:15:58 MST 2012
:eek: OMG I have been asking for this since December http://knowledgebase.nxp.com/showthread.php?t=2696
and now I get not one but 2 examples the same day? Quick someone get me the smelling salts, I feel faint. :D

Zero's example worked right away, all in one folder and [B]I THINK[/B] I can understand what's going on and maybe able to start using printf in some of my projects. It's bigger than what I'm used to with AVRs but smaller than the NXP's example.

The NXP's example compiles fine but I cannot run it on the LPCXpresso, see screenshot.
0 Kudos
Reply

2,180 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Feb 23 08:47:50 MST 2012
It's still carnival :)

Obviously it's very difficult to start with project wizard and post an actual sample with:

#1 CMSIS 2.0

#2 small 8K version (with 'CR_INTEGER_PRINTF' symbol to reduce code size)

#3 Managed linker script
0 Kudos
Reply

2,180 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Thu Feb 23 07:56:25 MST 2012
Hello js and guillaume,

Code Red's site clearly explains how to override the semihosting target for printf and also contains a link to an example for the LPC1768. Attached is a simple example how to do it on the LPC1114.
0 Kudos
Reply

2,180 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by js-nxp on Thu Feb 16 15:11:55 MST 2012
guillaume I have given up on using printf and the uart as everyone will tell you what to do or point you to some useless information rather than giving you a working example.

I say useless because, even though it may be easy enough for someone who uses the IDE and processor all the time, it's pretty overwhelming for someone just starting out with the NXP chips or the IDE.

And then there are those people who will tell you that printf should not be used in a small processor or the world will end...so just be careful or you may destroy the planet. :D
0 Kudos
Reply

2,180 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Feb 16 07:32:26 MST 2012
As described in http://support.code-red-tech.com/CodeRedWiki/UartPrintf

printf can be used for console output in semihosting projects.

For UART output you have to provide a __sys_write function to output buffered data to UART:

...
#include "stdio.h"
...
//use UART for printf
int __sys_write(int iFileHandle, char *pcBuffer, int iLength)
{
 UARTSend(pcBuffer,iLength);            //send data buffer to UART
 return iLength;
}
Now printf is using this function to write its data to UART via UARTSend() function, which is hopefully included in uart.c of your project :rolleyes:

That's all
0 Kudos
Reply