MCF5282 Uart Interrupt

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

MCF5282 Uart Interrupt

2,803件の閲覧回数
JohnDoe
Contributor II

Hello. I've been programming the MCF5282 eval board these days. Now I can't get the Uart Interrupt work, edge port and timer interrupt are working by now. Is there a special way to configure the uart? Dunno what am i doing wrong. Uart code is attached below.

Thanks for your help.

// Code:

void _SCI5_uart2_init(uint32 baudRate)

{           //Initialize internal No.1 UART

           register uint16 ubgs;

           

           //Disable receiver and transmitter

           MCF5282_UART1_UCR = (MCF5282_UART_UCR_TX_DISABLED |

                               MCF5282_UART_UCR_RX_DISABLED);

           MCF5282_GPIO_PUAPAR = 0x0F; //Set Port UA to initialize URXD0/URXD1 UTXD0/UTXD1

           MCF5282_UART1_UCR = MCF5282_UART_UCR_RESET_TX; //Reset Transmitter

           MCF5282_UART1_UCR = MCF5282_UART_UCR_RESET_RX; //Reset Receiver

           MCF5282_UART1_UCR = MCF5282_UART_UCR_RESET_MR; //Reset Mode Register

           

           

           //No parity, 8-bits per character

           MCF5282_UART1_UMR = (MCF5282_UART_UMR1_PM_NONE |

                               MCF5282_UART_UMR1_BC_8 );

           //No echo or loopback, 1 stop bit

           MCF5282_UART1_UMR = (MCF5282_UART_UMR2_CM_NORMAL |

                               MCF5282_UART_UMR2_STOP_BITS_1);

           

           //Set Rx and Tx baud by timer

           MCF5282_UART1_UCSR = (MCF5282_UART_UCSR_RCS_SYS_CLK |

                                MCF5282_UART_UCSR_TCS_SYS_CLK);

           

           MCF5282_UART1_UIMR = 0; //disable irq

           

 //Calculate baud settings

           ubgs = (uint16)((SYSTEM_CLOCK*1000000)/(baudRate * 32));

           MCF5282_UART1_UBG1 = (uint8)((ubgs & 0xFF00) >> 8);

           MCF5282_UART1_UBG2 = (uint8)(ubgs & 0x00FF);

           

           //Enable receiver and transmitter

           MCF5282_UART1_UCR = (MCF5282_UART_UCR_TX_ENABLED |

                               MCF5282_UART_UCR_RX_ENABLED);

                               

           //enable Rx irq

           MCF5282_UART1_UIMR = (MCF5282_UART_UIMR_FFULL);

           MCF5282_UART1_UISR = (MCF5282_UART_UISR_RXRDY);

           MCF5282_INTC0_ICR14 = (uint8)(MCF5282_INTC_ICR_IL(2) | MCF5282_INTC_ICR_IP(1));

           MCF5282_INTC0_IMRL &= ~(MCF5282_INTC_IMRL_INT14);        

}

ラベル(1)
0 件の賞賛
返信
1 返信

638件の閲覧回数
mpeters
Contributor I
Have you taken a look at our sample code? It is available on the MCF5282 product summary page, and is available for download. In the sample code, you can see how we initialized/configured the UART.

Here is the link to the MCF5282 Product Summary Page. You will want to download the .zip file called "MCF5282SC" under the "Software" section:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MCF5282&nodeId=0162468rH3YTLC00M95448

Regards,
-mp
0 件の賞賛
返信