Jump to content
  • 0

DjtgEnable and DjtgDisable take a long time to complete


Jim H

Question

I am using the Digilent HS2 cable on a Windows10 machine, using dmgr.dll and djtg.dll.  I am able to call DmgrOpen and DjtgEnable to initialize my JTAG.  I can then perform reads and writes to my FPGA without issues.

But since we have multiple programs accessing the same JTAG port, I need to call DjtgEnable before each read, and DjtgDisable after each read.  This works fine except it takes a long time to complete the enable and disable calls (rough measurements show 63 msec for the enable, and 140 msec for the disable).  Switching to the old Digilent cable and drivers (dpcutils.dll) shows a much faster completion rate.

Any ideas?

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Hi @Jim H,

I reached out to one of our design engineers about this forum and they responded with:

"I’m somewhat surprised that it takes longer to perform a disable call than an enable call, but that could be the result of flushing a PC side buffer and waiting for synchronization with the USB device. I’m not really surprised that enable is somewhat slow. Each time the port gets enabled we have to make and sure the PC side and the serialization engine on the device side are in sync. If they aren’t in sync then we have to perform a bunch of extra steps. What would be interesting to see is how long it takes to perform the enable operation the first time, disable the port while keeping the application open, and then re-enable it again in the same application. I’d expect it to be considerably faster the second time through than it is the first time because we should be skipping some initialization steps.
 
In any case I don’t think there’s a lot that we can do to speed it up. Interleaving access this way is going to be slow. If you truly need to interleave access between multiple applications then I think the only way to get good performance is design your application following a client/server model and have the server manage access to the HS2. The server can enable the port and keep it enabled and then provide interleaved/serialized access for the clients. 

 
I do find it very interesting that dpcutil is faster since it’s simply a wrapper dll that makes calls into dmgr and djtg. However, now that I read the post again they say “old Digilent cable” which I think means the original JTAG USB Cable. If that’s the case, then sure it makes sense. The old cable has a different USB controller and a completely different host side USB driver than the HS2. The USB protocol is completely different. Unfortunately there is no way to make the HS2 work the same way as the older cables when it comes to enable and disable."

thank you,

Jon
 

Link to comment
Share on other sites

Thanks for your quick reply.  In our current implementation with the "original JTAG USB" cable and dpcutils, we do use a semaphore to allow multiple applications to use the Digilent.  But that involves the calls to jtag enable and jtag disable around the access. You mentioned a server/client setup but I don't see a way to keep the port enabled and allow different apps to access it - each application must call jtag enable and jtag disable otherwise it crashes...

We are testing the HS2 because we need 2-wire JTAG.. is there another solution that gives us 2-wire capability without the slow enable/disable?

Thanks

 

Link to comment
Share on other sites

Hi @Jim H,

I talked to our design engineer and they responded with "a server/client setup the server opens and enables the port and performs all calls to the DJTG API. The clients make no calls to the DMGR or DJTG API. The end result is a single process that directly accesses the device. All client processes must communicate with the server process to transfer data.

The only devices that Digilent makes that support 2-wire JTAG are the HS2 and SMT2. They both use the same drivers and USB controller, and thus will have equally slow enable and disable operations. I’m unware of any good way to speed up enable/disable operations, which means the only solution is to implement a client/server application as I described above, or find another cable that supports 2-wire mode and hope that it doesn’t have similar issues."

thank you,

Jon
 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...