Forum Discussion
Altera_Forum
Honored Contributor
11 years agoI think I have found a solution for my problem, the problem is caused by circular buffers assigned with the following line in the header file fifoed_avalon_uart.h
... /* * ALT_AVALON_UART_BUF_LEN is the length of the circular buffers used to hold * pending transmit and receive data. This value must be a power of two. */ # define FIFOED_AVALON_UART_BUF_LEN (64) ... when I changed this value with 2 or 1 I was still missing one char (better than missing 63 chars)... since I am not using interrupt functions (instead I am looking to RRDY bit periodically), I have made the following change to the file "fifoed_avalon_uart.c" (I don't have any idea about side effects of this change over uart rcv interrupt !) ... void fifoed_avalon_uart_init (fifoed_avalon_uart_state* sp,alt_u32 irq_controller_id, alt_u32 irq) { void* base = sp->base; int error; /* * Initialise the read and write flags and the semaphores used to * protect access to the circular buffers when running in a multi-threaded * environment. */ error = ALT_FLAG_CREATE (&sp->events, 0) || ALT_SEM_CREATE (&sp->read_lock, 1) || ALT_SEM_CREATE (&sp->write_lock, 1); if (!error) { /* enable interrupts at the device */ sp->ctrl = FIFOED_AVALON_UART_CONTROL_RTS_MSK | FIFOED_AVALON_UART_CONTROL_RRDY_MSK | FIFOED_AVALON_UART_CONTROL_DCTS_MSK; //IOWR_FIFOED_AVALON_UART_CONTROL(base, sp->ctrl); //DISABLE THIS LINE //DISABLE THIS LINE //DISABLE THIS LINE //DISABLE THIS LINE //DISABLE THIS LINE /* register the interrupt handler */ ... Now everything is OK with my project, I have no missing received data, but I don't know if the uart interrupt services are still OK...