UART in interrupt mode

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

UART in interrupt mode

Jump to solution
1,598 Views
M_ttferrari
Contributor III

Hi everyone,

 

My problem is when isrUART2 runs because I can't read the data received. I don't know how I read URB2 register (data is correctly stored into URB2).

 

I show step by step my code:

 

fh_ptr = fopen("ittyc:", (pointer)(IO_SERIAL_XON_OFF | IO_SERIAL_TRANSLATION);

_int_install_isr(BSP_UART2_INT_VECTOR, uart_isr, fh_ptr);

for(;:smileywink:;

 

then my isr function is:

 

void uart_isr((pointer user_isr_ptr){

MQX_FILE_PTR fd;

fd = (MQX_FILE_PTR)user_isr_ptr;

read(fd,&buffer[0],1);

}

 

read function never returns because into fd there isn't any data to read. But, as I mention before, into URB2 register the data that I sent is correctly stored.

 

Obviously, the pointer to file that I'm passing to uart_isr don't aim to the registers of UART2. How do I have to pass this pointer?

 

Thanks in advance

 

 

0 Kudos
1 Solution
460 Views
M_ttferrari
Contributor III

Hi

I've found the solve to this problem reading this thread 

 

https://community.freescale.com/thread/64147

 

I tried with this code to aim towards UART2

 

MCF52XX_UART_STRUCT_PTR vuart;

vuart = (MCF52XX_UART_STRUCT_PTR)(&((VMCF5225_STRUCT_PTR)_PSP_GET_IPSBAR())->UART[2]);

UART_USR = vuart->READ.USR;

 

It works fine.

 

Thanks anyway:

 

M@tt

View solution in original post

0 Kudos
1 Reply
461 Views
M_ttferrari
Contributor III

Hi

I've found the solve to this problem reading this thread 

 

https://community.freescale.com/thread/64147

 

I tried with this code to aim towards UART2

 

MCF52XX_UART_STRUCT_PTR vuart;

vuart = (MCF52XX_UART_STRUCT_PTR)(&((VMCF5225_STRUCT_PTR)_PSP_GET_IPSBAR())->UART[2]);

UART_USR = vuart->READ.USR;

 

It works fine.

 

Thanks anyway:

 

M@tt

0 Kudos