RE: Printf with MPC565?

"David Eicher" <[email protected]>
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Message-ID <[email protected]>
I don't know if I can help with this problem, but I'm faced with a similar
problem. I'm trying to send printf(  ) output to the SCI1 interface and I'm
using GNU C. I have not been able to test and see if printf( ) output will
go to SCI because I can't get the linker to find the libraries where the
printf( ) function is. Working on that (separate issue).

 

What I've learned so far is, printf(  ) outputs to a file called STDOUT
(similar to STDIN, and STDERR). STDOUT is a file, it is actually a pointer
to a file descriptor. This file descriptor is a data structure with many
entries. It sounds like Metrowerks has already done the work of configuring
the STDOUT file descriptor to output on SCI1. I'm not sure if this has been
done on my GNU C (Macraigor configured, but no support from Macraigor). Your
challenge then, is to figure out what is the standard mechanism for
re-configuring STDOUT to SCI2.

 

Do a "find in files" type search on STDOUT (might be stdout), and find where
it is defined. You'll find it is defined as type FILE. Then look for the
place in the code where the file descriptor structure values get set. One of
the values might be related to SCI1. If so, you might need to change that to
SCI2. Or, create a:

 

FILE *STDOUT_ALTERNATE;

 

And sent this value to SCI2. Then in your software, when you want to
redirect to SCI2, you redirect your output from STDOUT to the alternate.

 

Hope this helps,

 

Dave

 

PS Does anyone know how GNU C does this?

 

Thanks.

 

  _____  

From: [email protected] [mailto:[email protected]] On Behalf Of
Dobbin Allan-r11834
Sent: Wednesday, July 13, 2005 7:44 AM
To: '[email protected]'
Subject: RE: [MPC500] Printf with MPC565?

 

I am unsure how you set Codewarrior to print to SCI.  What was the format of
the printf command that went to SCIA?  Whatever it is, it is somehow sending
the data to the QSMCM_A.SC1DR.R data register.  To print to SCIB, you have
to set the command up to write data to the other data register i.e.
QSMCM_B.SC1DR.R.

If you supply a pointer to the data register in the printf statement, or
have set stdout to point to the SCI data register (0x30500E), you have to
change the address to QSMCM_B data register (0x30540E).

Regards,
Allan

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of
vijayanandl
Sent: Wednesday, July 13, 2005 8:48 AM
To: [email protected]
Subject: [MPC500] Printf with MPC565?


Hello all
     I just have a question regarding printing with MPC565. I use the 
Metrowerks codewarrior BDI environment with the standard library. I have two
serial ports for printing. One port is connected to 
QSMCM_A.TXD1, QSMCM_A.RxD1. The other port is connected to 
QSMCM_B.TxD1,QSMCM_B.RxD1.
I made the initial settings for port1 and 2 as follows
QSMCM_A.SCC1R1.R=0x100C;QSMCM_A.SCC1R0.R=0x0082; 
QSMCM_B.SCC1R1.R=0x100C;QSMCM_B.SCC1R0.R=0x0082; 
which sets it to 9600 kBaud and printed from both the ports. From 
port1 the output was ok but I am unable to print from port2. The 
string to be printed on port2 gets printed on port1. 
My question is, is there a way to configure the printf to enable 
printing in port 2? What are the settings I need to make? 
Thanks in advance.

Regards
Vijay


      


-----------------------------------------------------------
To learn more about Freescale Microcontrollers, please visit
http://www.freescale.com/mcu







  _____  

YAHOO! GROUPS LINKS 

 

*	 Visit your group "MPC500 <http://groups.yahoo.com/group/MPC500> "
on the web.
  
*	 To unsubscribe from this group, send an email to:
 [email protected]
<mailto:[email protected]?subject=Unsubscribe> 
  
*	 Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/>  Terms of Service. 

 

  _____  



[Non-text portions of this message have been removed]



-----------------------------------------------------------
To learn more about Freescale Microcontrollers, please visit
http://www.freescale.com/mcu


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/MPC500/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.