Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

Detecting Jtag connection

Honored Contributor II

I want to be able to detect if the Jtag USB Blaster is connected, or if it is and connected to the NIOS II debugger. Is there a simple address to read to check for its presence? 


I have my own I/O (printf, puts, gets, getchar, etc.) which I direct to Telnet if connected, RS-232 serial otherwise, unless there is a Jtag uart in which case I use it. I use my own Jtag serial code (because it's way more efficient and smaller). I notice Altera code runs a timer and clears the "presence" state if the timer times out and there is no Jtag activity (AC bit in Jtag control). I use my own code because I don't want the alt_alarm and ioctl baggage while still being able to detect if the Jtag is connected. 


There has to be a better way than running a timer looking for activity. I set in my Jtag ISR a "JtagPresent" variable but when running in the debugger I don't get an interrupt to set this flag. This would be enough for me to know to use Jtag over the real serial port. 


Is there a way using the hardware (not altera driver) to detect if the Jtag is present or not? 



0 Kudos
1 Reply
Honored Contributor II

Answering my own post: It appears a simple check of the AC bit in the control register is all that is required to detect JTAG on power up. On 2 different systems so far it has proven to work. I don't know if that is the correct method, but I'll go with it until something better or correct comes up.