| View previous topic :: View next topic |
| Author |
Message |
Guy_FPGA Guest
|
Posted: Thu Nov 20, 2008 8:33 am Post subject: Altera DE3 - USB Bulk Transfer |
|
|
Hello all,
I have a DE3 board. I need to transfer data over the USB lines. As a
start I took the DE3_USB example and expanded it. In this example they
transmit 4 Bytes on the lines from the PC to the NIOS and back from
the NIOS to the PC.
I need to transfer 536B.
At first I used the Windows DDK bulk-transfer. The DDK supply an
example a consul application that opens a read pipe and a write pipe
and delivers the data through the pipes. I took the consul application
and extended it to transmit 536B and receive 536B as well.
OK- I can transmit 536B from the PC to the NIOS. But delivering data
back from the NIOS is always stuck at 128B. Lets get to some code:
If the NIOS execute:
BULK_Write(hBulk, szBulkDataOut, 536);
and the PC runs: ReadFile(hRead, pinBuf, 536, &nBytesRead, NULL);
then the PC is stuck... I mean it is still pending for data - the sw
is waiting - doesnt continue.
However:
NIOS: BULK_Write(hBulk, szBulkDataOut, 536);
PC : ReadFile(hRead, pinBuf, 128, &nBytesRead, NULL);
ReadFile(hRead, pinBuf, 128, &nBytesRead, NULL);
......
......
......
then the PC gets only the first 128B and pending on the second
request.
even if I write:
NIOS: BULK_Write(hBulk, szBulkDataOut, 128);
BULK_Write(hBulk, szBulkDataOut, 128);
.....
.....
PC : ReadFile(hRead, pinBuf, 128, &nBytesRead, NULL);
ReadFile(hRead, pinBuf, 128, &nBytesRead, NULL);
......
......
......
then the PC is pending on the second read.
SO....
1. How do I transfer data from NIOS to PC using the bulk transfer?
2. Do you know how to create a windows GUI project that communicate
with the USB?... I couldn't compile the rwbulk from DDK in windows I
needed the special make file of DDK and the special BUILD that comes
with the DDK as well.
Hope someone could help me out there....
Thanks a lot ...
Guy |
|
| |
|
Back to top |
Mark McDougall Guest
|
Posted: Fri Nov 21, 2008 7:01 am Post subject: Re: Altera DE3 - USB Bulk Transfer |
|
|
Guy_FPGA wrote:
| Quote: | Do you know how to create a windows GUI project that
communicate with the USB?... I couldn't compile the rwbulk from DDK in
windows I needed the special make file of DDK and the special BUILD
that comes with the DDK as well.
|
Can't help you with your NIOS-II transfer problems but I have written GUI
USB transfer software. IIRC it was actually HID-based, but I have also
played with the console-mode bulk transfer sample in the DDK as well.
The problem is that the DDK contains headers and (IIRC) libraries that
aren't available with the standard visual studio distro. Even for the HID
stuff, I had to use headers and link against some DDK library(ies?) under
Visual C/C++. I'm sure you could manage the same with your bulk transfer
stuff?!?
Regards,
--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266 |
|
| |
|
Back to top |
Guy_FPGA Guest
|
Posted: Sat Nov 22, 2008 4:56 pm Post subject: Re: Altera DE3 - USB Bulk Transfer |
|
|
Hi Mark,
Thanks for your response,
You seem to be the only expert in this metter.
Well you are right about the DDK and Visual - it doesnt work that good
together.
Honestly I do not understand how to use the HID in windows. why cant I
use bulk transfer in windows?
And why does the buffer is 128B?
do you have a Visual sample project?
what about the NIOS side SW? I am relying on Altera's SW, are there
any modifications needed?
Really thanks,
I an having some difficulties ere since I am a HW man...
so thanks again,
Guy |
|
| |
|
Back to top |
Mark McDougall Guest
|
Posted: Mon Nov 24, 2008 6:36 am Post subject: Re: Altera DE3 - USB Bulk Transfer |
|
|
Guy_FPGA wrote:
| Quote: | Honestly I do not understand how to use the HID in windows. why cant I
use bulk transfer in windows?
|
You use the same code as the sample HIDCLIENT in the DDK. It's just a
matter of getting the right headers and libraries from the DDK into your
Visual C project.
Bulk transfer is another kettle of fish. You need the bulkusb.sys driver
but again, you can use a project from either Visual C or the DDK to
communicate once you have the headers/libraries.
| Quote: | And why does the buffer is 128B?
what about the NIOS side SW? I am relying on Altera's SW, are there
any modifications needed?
|
That seems like a NIOS-side problem to me. Can't help there sorry as I've
never used the NIOS USB stuff.
| Quote: | do you have a Visual sample project?
|
The code I write was done several years ago (hence the sketchy details)
and I don't own the IP for it, so I can't redistribute it, sorry.
But it's really just a matter of moving your DDK code to Visual C and
getting the right headers/libraries - the code itself should work as-is.
Or maybe the headers/libs were in the Platform SDK??? I can't recall. :(
I'll see if I can dig anything else up...
Regards,
--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266 |
|
| |
|
Back to top |
Mark McDougall Guest
|
Posted: Mon Nov 24, 2008 6:46 am Post subject: Re: Altera DE3 - USB Bulk Transfer |
|
|
Mark McDougall wrote:
| Quote: | I'll see if I can dig anything else up...
|
In the HID project, I have the following additional library files...
usbd.lib
hid.lib
setupapi.lib
Under VC++ Tools->Options->Projects->Directories, includes
$(VCInstallDir)include
$(VCInstallDir)atlmfc\include
$(VCInstallDir)PlatformSDK\include\prerelease
$(VCInstallDir)PlatformSDK\include
$(FrameworkSDKDir)include
C:\WINDDK\2600.1106\inc
....and for library files...
$(VCInstallDir)lib
$(VCInstallDir)atlmfc\lib
$(VCInstallDir)PlatformSDK\lib\prerelease
$(VCInstallDir)PlatformSDK\lib
$(FrameworkSDKDir)lib
C:\WINDDK\2600.1106\lib\wxp\i386
Regards,
--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266 |
|
| |
|
Back to top |
|