UART issues on the M52233 DEMO board

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

UART issues on the M52233 DEMO board

1,747 次查看
Eqqman
Contributor I

Hello-

 

I'm using the M52233 DEMO board with Code Warrior version 7.1.  I haven't been able to get any output from the UART channel 1.  If I use code like this:

 

uart_init(1, SYSTEM_CLOCK_KHZ, kBaud9600);

uart_putchar(1, 'U');

 

I expect an output that I don't actually get.  If I use these same function calls with channel 0, I see the character come out on an oscilloscope.  Reading around other posts, I see people recommending making sure the GPIO setting for those pins are correct, but going by the schematic for the board the UART TX/RX pins don't seem to be multiplexed with any other IO pins (and I can't find a pin diagram in the 5223x manual).  I'm also not clear if I can leave the RTS/CTS pins floating for channel 1.  They aren't connected on channel 0 when I get it to work there, but the channel 0 pins are also jumpered to the DB9 connection.  I'm not sure what I should look at next.

标签 (1)
0 项奖励
回复
2 回复数

871 次查看
RichTestardi
Senior Contributor II

Hi,

 

All ports default to GPIO on reset.  You can check in the debugger, but you most likely need to set MCF_GPIO_PUBPAR to set UTXD1 and URXD1 to their primary (as opposed to GPIO) function.  Something like:

 

  MCF_GPIO_PUBPAR = MCF_GPIO_PUBPAR_URXD1_URXD1|MCF_GPIO_PUBPAR_UTXD1_UTXD1;

 

See section 14.6.5.2 of the reference manual.

 

It is likely some piece of code is doing this for you for UART0, but you have to do it for yourself for UART1.

 

You can use just the TX/RX pins for UART1 if you want to -- just make sure you initialize it without hardware flow control (which I believe is the default in the UART control registers).

 

If you use UART1, you may need to use an external level shifter to convert the pins to RS232 levels, like: http://www.sparkfun.com/commerce/product_info.php?products_id=133

 

-- Rich

0 项奖励
回复

871 次查看
Eqqman
Contributor I

Thanks for the help.  I browsed around theM52233DEMO_sysinit.c file and added

 

MCF_GPIO_PUBPAR = 0 | MCF_GPIO_PUBPAR_UTXD1_UTXD1 | MCF_GPIO_PUBPAR_UTXD1_UTXD1;

 

which now has the channel working.  In my opinion this kind of thing should have been included in the uart_init function, since if the peripheral is not ready for use after calling an initialization function, then it wasn't really initialized.

0 项奖励
回复