Hi,
I just received my Teensy3.1 (nice work!), and my goal is to create a JTAG Adapter for programming/debugging other chips. The plan is to provide an USB interface to the Teensy3.1 and writing a driver with libusb for the urJTAG utility (maybe OpenOCD in the future).
The JTAG uses a TCK clock signal and TDI and TMS are sampled on the rising edge of TCK, and TDO changes on the falling edge of TCK.
In my previous home-made JTAG Adapter, using an arduino, I simply used the delay function and toggled the TCK pin high/low. This worked great since the speed was limited anyway. With the powerful 72MHz of the Teensy3.1 I think it's not far fetched to reach for a 12MHz TCK clock signal, isn't it? But how would you implement this in an efficient way? My idea at the moment is:
- Bulk Transfer of TDI, TMS data (~2kB) into the buffer of the Teensy
- Starting a 12MHz timer (maybe make this user-selectable ranging from 10kHz to 12MHz?)
-> On Timer Interrupt:
-> Check if we are going to pull TCK high, if yes, fetch TDI, TMS state from the buffer and toggle pins
-> Check if we are going to pull TCK low, if yes, read TDO pin state and store in output buffer
-> No Data left? Stop Timer, set complete flag, bulk transfer buffer back to Host device
My Questions:
- What do you think, would this be possible?
- Is it a good idea to solve this with a timer or should I use a for-loop with delays?
- How would you go about sending a single clock pulse?
- Do you have some sort of code snippet or existing library code about setting up timers on the Teensy3?
And of course I'd make this an open-source project, maybe with a nice little PCB populating JTAG headers where you can put in your Teensy.
---
Simon
I just received my Teensy3.1 (nice work!), and my goal is to create a JTAG Adapter for programming/debugging other chips. The plan is to provide an USB interface to the Teensy3.1 and writing a driver with libusb for the urJTAG utility (maybe OpenOCD in the future).
The JTAG uses a TCK clock signal and TDI and TMS are sampled on the rising edge of TCK, and TDO changes on the falling edge of TCK.
In my previous home-made JTAG Adapter, using an arduino, I simply used the delay function and toggled the TCK pin high/low. This worked great since the speed was limited anyway. With the powerful 72MHz of the Teensy3.1 I think it's not far fetched to reach for a 12MHz TCK clock signal, isn't it? But how would you implement this in an efficient way? My idea at the moment is:
- Bulk Transfer of TDI, TMS data (~2kB) into the buffer of the Teensy
- Starting a 12MHz timer (maybe make this user-selectable ranging from 10kHz to 12MHz?)
-> On Timer Interrupt:
-> Check if we are going to pull TCK high, if yes, fetch TDI, TMS state from the buffer and toggle pins
-> Check if we are going to pull TCK low, if yes, read TDO pin state and store in output buffer
-> No Data left? Stop Timer, set complete flag, bulk transfer buffer back to Host device
My Questions:
- What do you think, would this be possible?
- Is it a good idea to solve this with a timer or should I use a for-loop with delays?
- How would you go about sending a single clock pulse?
- Do you have some sort of code snippet or existing library code about setting up timers on the Teensy3?
And of course I'd make this an open-source project, maybe with a nice little PCB populating JTAG headers where you can put in your Teensy.
---
Simon
Last edited: