Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12622 Discussions

JTAG_UART with no PC make trouble



When I use JTAG_UART as my standard stdout and use print I get problem. When there is a host open oon the other side every thing go well. But when I don't have host open I get JTAG_UART behaiver of low traffic , problem to move lot of data by the TSE and long time to astablish a socket prot.

I have read here: that the reason for that can come from 2 places.

1. Or use small mode

2.No clk attach to the driver.

I check the mode I use and confirm I don't use the small mode.

I check the clk and see that I config sys_clk_timer for the hal -> sys_clk_timer.

My next suspicion is a long time timeout setting.

SO I read that by useing ioctl() function and specific the define TIOCSTIMEOUT I can handle the time and also can check if there a remote host by onther define TIOCGCONNECTED, but I don't know how and where to use them.

Is there a user guide or any explaniation to handle them?

Is there anther way to solve the problem I face?




0 Kudos
4 Replies


Greetings and welcome to Intel's forum.

May I know the Quartus version and Devkit you are using?

I am not aware of the define TIOCSTIMEOUT and TIOCGCONNECTED and how it is used from Intel;s data base, but you can send me the link of information on this.

You may have a look on the HAL API functions for iotcl() function for your reference here:

The link you posted has suggested the workaround, have you tried the resolution they suggested?

Hope to hear on your feedback.

Thank you.


Kelly Jialin, GOH

0 Kudos

Thanks Kelly for your replay.

About the    TIOCSTIMEOUT and TIOCGCONNECTED you can fined it here in Intel publishing :

About The link to ioctl() I have see it but the problem is the inputs and output of it. The first parameter id int fd, which is not the common use of FILE* fd but use a number from 0 till 32. But I don't know which one is refer for sdout. I was gust it is 1 by looking on the define of using it where I think 0-> stdin, 1-> stdouit, 3- stderror but I am not sure.

What I try to do is looking for HOST connectqdisconnect on the JTAG_UART so I try this:

int state;
int err;
int device_num=1;

err = ioctl (device_num, TIOCGCONNECTED, &state);// check if HOST connect to the stdout
if(state == 0)
printf("\nNo HOST UART found\n");
printf("\nNo HOST UART found fclose was operate\n");


but it didn't detect.

SO I add some delay  before by thinking it need more time from powerup. I also make some loop of 10 cycles to make some check but all didn't help.

Only when I add the timeout parameter:

int time =1;

err = ioctl (device_num, TIOCSTIMEOUT, &time);// set Timeout for stdout as JTAG_UART

it start to detect, but it take for every print 1 sec to wait and it is to much for me. 

I need that immidutly when there is no HOST to cancel the printing.

Also the function fclose(stdout); which is common in C didn't work and it continue to make print to the JTAG_UART. Maybe there is a diffrent command or define I can use dynamicly to stop printing if no host is present.

I didn't understand what is the work arrount suggest in the link I add? They point to be sure there is a timer attach to the default driver. I check it (see attach) and it is look there is a timer (sys_tck)timer) So I think I use one. If it is not the place to look for the attach time or if there is a need to change the default driver please let me know.

Maybe there is other source that can handle the JTAG_UART problem without attach host?








0 Kudos


Here are some additional information that you may refer:

Thank you.



0 Kudos


You need to use the timer IP core in your platform Designer(QSYS). Configure it and compile your hardware deign.

Then, choose System Library from the left hand side of the Properties window. Ensure that the stdout, stderr and stdin devices are set to jtag_uart and that the System clock timer is set to sys_clk_timer.

Step by step procedure is given in below link-

let me know if you have any other queries.



0 Kudos