Forum Discussion
JTAG_UART with no PC make trouble
Hi,
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: https://www.intel.com/content/www/us/en/docs/programmable/683282/current/ioctl.html#mwh1416946996642__section_N10013_N10010_N10001
The link you posted has suggested the workaround, have you tried the resolution they suggested?
Hope to hear on your feedback.
Thank you.
Regards,
Kelly Jialin, GOH
Thanks Kelly for your replay.
About the TIOCSTIMEOUT and TIOCGCONNECTED you can fined it here in Intel publishing : https://www.intel.com/content/www/us/en/docs/programmable/683130/23-1/ioctl-operations-43708.html
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");
fclose(stdout);
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?
Thanks
Bar.