A problem with mcf52235 UART interruption.Please help me.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

A problem with mcf52235 UART interruption.Please help me.

1,074 Views
karonarthur
Contributor I
I am using a PCB made by myself.I initialize UART0 correctly.It transmit and receive well if i don't use interruption.I want to use interruption to receive data from computer.But no interruption is generated.I wrote my codes like this.Only critical parts is written .I think most registers must be initiated correctly or it can not work.
Could someone give me a hint?I really appreciate your help.

(CodeWarrior v6.4)
mcf5xxx_vectors.c

........
.extern _IntUART0m //Simply add a '_' before function name????
........
vector077:    .long    _IntUART0m   /* UART0 */
........

int_handler.c
__declspec(interrupt)
void IntUART0m(void)
{
    printf("03. UART interrupt entered! \n\r"); /* The charactors can be displayed in the console window */

}

int_init()
  MCF_INTC0_IMRL &= ~(0
    | MCF_INTC_IMRL_INT_MASK13 | MCF_INTC_IMRL_INT_MASK14 | MCF_INTC_IMRL_INT_MASK15
    | MCF_INTC_IMRL_MASKALL);
  MCF_INTC0_ICR13 = 0b00011011; //UART0
  MCF_INTC0_ICR14 = 0b00011011;
  MCF_INTC0_ICR15 = 0b00011011; //level and priority

uart_init() //UCSR and UIMR
  MCF_UART_UCSR(0) = (0|MCF_UART_UCSR_RCS_SYS_CLK | MCF_UART_UCSR_TCS_SYS_CLK);

  MCF_UART_UIMR(0) = (0 | MCF_UART_UISR_TXRDY |MCF_UART_UISR_FFULL_RXRDY );

main() // config SR at the beginning of main()
    asm
    {
        move.l  0x2000,D0
        move.w  D0,SR
    }
Labels (1)
0 Kudos
1 Reply

221 Views
mjbcswitzerland
Specialist V
Hi

One small point is that you should never use the same interrupt level and priority for multiple interrupt sources - therefore you should set different values for UART0,UART1 and UART2. This would however not stop interrupts working as far as I known.

The initialisation of the interrupts looks correct, assuming mcf5xxx_vectors.c is really being used by your project (see
http://forums.freescale.com/freescale/board/message?board.id=CWCFCOMM&thread.id=1501).

What is not visible in the code snippets is where the RX in enabled. When the TX is enabled you would normally immediately get an interrupt due to the fact that the tx bufer is emply (since you are setting interrupts on TXRDY).

The best way to find out what is happening is to monitor the interrupt flags in the UART status register. If the interrupt is getting set, then check whether it is propogating through to the interrupt controller (where you can check that the corresponding mask has really been removed).

If you don't make any progress, look at the uTasker project at www.uTasker.com (users' forum at http://www.uTasker.com/forum/ )
The project contains support of UART in interrupt and DMA modes as well as lots more too. It is possible to simulate the operation of the UARTs (including their interrupts and interrupt routines) and map the simulated UARTs to COM ports on the PC to test a complete project on a simulated M5223X.

Good luck

Regards

Mark




0 Kudos