Forum Discussion
cal_uart(with fifo) + NIOSserial.c
As we know, we need uart with fifo to enchance the performance. So we got the cal_uart from Altera, which should tested by ourselves because it is not provided officially by altera.
Now we use cal_uart with 16 byte rx_fifo, 16 byte tx_fifo. We hope the fifo is transparent to linux driver, so the linux driver is still NIOSserial.c, which we changed nothing. But we got : 0. U-boot access the UART sucessful during rx, tx. We think U-boot using pool methed. Is it right? 1. tx data is successful 2. rx data is abnormal. After linux startup, linux will reboot immediately after we receive any data by cal_uart. 3. We try to debug NIOSserial.c using printk . Is it right way to debug in UART driver? thank u in advance.23 Replies
- Altera_Forum
Honored Contributor
It will be very difficult to debug on the same serial console. You'd better use jtag as console, to test the new uart on some other port.
You can use printk() then. - Altera_Forum
Honored Contributor
I use the cal_UART instead of the UART,then generate cpu_name.ptf, compared with the old cpu_name.ptf, there is no the list information in the new cpu_name.ptf!
who can help me ? 1. PORT_WIRING { PORT rxd { direction = "input"; width = "1"; Is_Enabled = "1"; } PORT txd { direction = "output"; width = "1"; Is_Enabled = "1"; } PORT cts_n { direction = "input"; width = "1"; Is_Enabled = "0"; } PORT rts_n { direction = "output"; width = "1"; Is_Enabled = "0"; } } - Altera_Forum
Honored Contributor
I can get
and rts_n, cts_n are depent to your setup during add cal_uart to NiosII in SOPCbuilder.PORT rxd { direction = "input"; width = "1"; Is_Enabled = "1"; } PORT txd { direction = "output"; width = "1"; Is_Enabled = "1"; } - Altera_Forum
Honored Contributor
How about RXD and TXD?
- Altera_Forum
Honored Contributor
We tested the cal_uart's irq signal is only active for 1 clock period so
I changed <cal_uart>/uart_pm.pl:L1933:rx_char_ready to rx_not_empty in order to irq <= ... rx_not_empty ... then it worked well. - Altera_Forum
Honored Contributor
Can anyone tell me how to obtain the CAL_UART design please?
* Edited* Got it now. many thanks - Altera_Forum
Honored Contributor
Hi all,
I am trying the cal_avalon_uart core, but I get some problems. I tried to do as mountain8848 said : change rx_char_ready to rx_not_empty at line 1933 But I still get communication problems with uClinux. I only receive chars after 64 bytes are in the FIFO (the FIFO is 64 bytes long). SO an interrupt is only generated when the fifo is completely full. The main problem is that after it worked once or twice (64 or 128 bytes received), uClinux crashes (no response on any console). Did someone fix this ? Thanks for help Regards Pierre-Olivier - Altera_Forum
Honored Contributor
We were able to get the cal_uart working fully only after modifying the verilog code.
It seems that it only supports polling mode cleanly. When using interrupts, it doesn't generate them in a way that takes advantage of the fifo's. We had to modify our verilog code so that interrupts were generated only when the fifo was 75% full for example. This was done by changing the "qualified_irq" assignment. Until we made the modifications, the cal_uart component didn't perform any different than the normal Altera_Avalon_Uart. - Altera_Forum
Honored Contributor
in n2cpu_nii5v1.pdf p45, It is said " By peripheral design, an IRQ bit is guaranteed to remain asserted until the processor explicitly responds to the peripheral."
If we did not changed anything with FIFO_UART(cal_uart), the irq is a pulse, which duty cycle is one period of the system clock. So we change rx_char_ready to rx_not_empty at line 1933 so it will generate the IRQ properly----generate irp until NiosII deassert it by read all datas from FIFO.And we tested FIFO_UART with original NIOSserial.c In our opinion: 1. FIFO_UART does generate IRQ as soon as it received one byte 2. During uClinux IRQ server, FIFO_UART dose receive any bytes to FIFO if there are datas in the RXD line ---- this is one of benefits of FIFO. 3. NIOSserial.c does receive all datas from FIFO_UART untill FIFO is empty and IRQ will deassert. Then things happen again and again. Like trk_golf said, It will be grate if the IRQ generates at 75% full of FIFO. But it should be add a Timer to tell the us there are datas in FIFO, which maybe never get 75% full of FIFO. We did not work out this method. Any helps about this will be appreciate! PS: After change the SOPC components perl scripts file , you should regenerate NiosII in SOPC builder, recompile in Quartus, re-debug in uClinux. - Altera_Forum
Honored Contributor
Thanks for the replies,
So it acts like I expected, but I don't understand why uClinux crashes then. When I cat the serial port (cat /dev/ttyS3), it works for around 128 chars, then linux crashes. Is there any explanation to this ? Thanks Pierre-Oliver