I'm having more doubts about my problem: Just I don't understand why the first character I write via Uart is ignored until receive the second character. By this way, I always obtain the penultime character introduced, and not the last how I should obtain!!!! :smileysad:
This is my code. Please, could you say me where I'm wrong?
/*ISR*-----------------------------------------------------------
*
* ISR Name : new_tick_isr
* Comments :
* This ISR replaces the existing timer ISR, then calls the
* old timer ISR.
*END*-----------------------------------------------------------*/
void uart_isr(pointer user_isr_ptr)
{
MY_ISR_STRUCT_PTR isr_ptr;
volatile char buffer;
isr_ptr = (MY_ISR_STRUCT_PTR)user_isr_ptr;
//if (fstatus(serial_fd))
while(fstatus(serial_fd))
{
read(serial_fd,(pointer)&buffer,1);
write(serial_fd,(pointer)&buffer,1);
}
/* Chain to the previous notifier */
(*isr_ptr->OLD_ISR)(isr_ptr->OLD_ISR_DATA);
}
/*TASK*----------------------------------------------------------
*
* Task Name : main_task
* Comments :
* UART ISR function. Executed when receiving a new character via uart
*END*-----------------------------------------------------------*/
void main_task(uint_32 initial_data)
{
MY_ISR_STRUCT_PTR uart_isr_ptr;
uint_32 baud=9600;
uint_32 flag=IO_SERIAL_RAW_IO;
serial_fd = fopen("ittya:",BSP_DEFAULT_IO_OPEN_MODE);
// configuro la UART0 a 9600 bps
ioctl(serial_fd,IO_IOCTL_SERIAL_SET_FLAGS, &flag);
ioctl(serial_fd,IO_IOCTL_SERIAL_SET_BAUD, &baud);
write(serial_fd,(pointer)"hola",4);
uart_isr_ptr = _mem_alloc_zero((_mem_size)sizeof(MY_ISR_STRUCT));
uart_isr_ptr->OLD_ISR_DATA =
_int_get_isr_data(BSP_UART0_INT_VECTOR);
uart_isr_ptr->OLD_ISR =
_int_get_isr(BSP_UART0_INT_VECTOR);
_int_install_isr(BSP_UART0_INT_VECTOR, uart_isr,
uart_isr_ptr);
fflush(serial_fd);
for(;
;
_mqx_exit(0);
}
Thanks you in advance
Regards