FPGA requests the PC to send or accept data via USB

Hi Jake,

I don’t know whether it’s a limitation of USB or the FPGA but it would be nice and more efficient to have the FPGA requesting the PC to send or accept data, instead of a polling mechanism.

Patrick.

Hi Patrick-

USB does have a mechanism called “interrupt transfers” which are not currently supported by our firmware. However, interrupt transfer is somewhat of a misnomer since the transaction is still a polled situation – it’s just polled by the operating system rather than the application.

It is something we have considered, though – and will keep in mind.

This is an excellent application of multi-threaded programming. If you put your polling operation in a seperate thread, you can allow your application to continue processing while the child thread waits on your FPGA process and then acts on the data, much like you would do with interrupt based operation. My understanding is that it is a limitation of USB that only the master (the PC) may initiate a transfer.

Best regards,
Jason

[QUOTE=jdoege]This is an excellent application of multi-threaded programming. If you put your polling operation in a seperate thread, you can allow your application to continue processing while the child thread waits on your FPGA process and then acts on the data, much like you would do with interrupt based operation. My understanding is that it is a limitation of USB that only the master (the PC) may initiate a transfer.
[/QUOTE]

Indeed it would be pretty silly to have the PC application running on a single thread and waiting for USB data to be ready.

As far as I understand, a child thread cannot simply wake up when data is ready. It’s necessary at regular intervals, to wake up, issue a call to UpdateTriggerOuts(), check a defined condition and process the data if ready. This is a limitation in realtime applications.

Patrick.

You’re right that the child thread can’t just ‘wake up’ when data is ready. It’s somewhat the same as a USB interrupt transfer. The difference is simply that the operating system needs to handle the polling operation for you. In either case, the computer itself needs to poll the device.