Gabriel Caudillo

MCF5282 Uart Interrupt

Discussion created by Gabriel Caudillo on May 1, 2006
Latest reply on May 3, 2006 by Matthew Peters

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);        

}

Outcomes