UART Help

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

UART Help

2,366件の閲覧回数
Rodrigo
Contributor I
Hi,

I have a M52233DEMO and I want to connect to a device at 2400 bps 8N1 and send 5 bytes via UART.
Could anyone help me configure the uart and send this string?

Thanks in advance.

Rodrigo Meireles
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

823件の閲覧回数
PaoloRenzo
Contributor V
Inside Codewarrior sysinit.c just change the following line inside mcf52235_uart_init()

/*
* No parity, 5-bits per character
*/
MCF_UART0_UMR = (0
| MCF_UART_UMR_PM_NONE
| MCF_UART_UMR_BC_5 );


#define MY_UART_BAUD 2400

/*
* Calculate baud settings
*/
ubgs = (uint16)((SYSTEM_CLOCK*1000000)/(MY_UART_BAUD * 32));

MCF_UART0_UBG1 = (uint8)((ubgs & 0xFF00) >> 8);
MCF_UART0_UBG2 = (uint8)(ubgs & 0x00FF);

Finally don't use printf, call uart_putchar function...

Good luck
0 件の賞賛
返信

823件の閲覧回数
Rodrigo
Contributor I
Thanks Paolo,

I did what you said to change the uart to 2400 8N1. I tested if it worked using the windows hyper terminal but it only works using printf. The uart_putchar() function doesn't show anything in the hyper terminal.

I am modifying the "hello world" program that came with the codewarrior using the M52233DEMO UART DEBUG project.

I did like this:

int main(){

mcf52233_uart_init();
uart_putchar(0,'a');
fflush(stdout);

return 0;

}
0 件の賞賛
返信