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++

Detecting Jtag connection

Altera_Forum
Honored Contributor II
880 Views

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? 

 

Thanks, 

Bill
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
213 Views

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. 

 

Bill
0 Kudos
Reply