View previous topic :: View next topic |
Author |
Message |
ksb16
Joined: 01 Apr 2016 Posts: 3
|
pic18f2550 usb bulk |
Posted: Fri Apr 01, 2016 4:27 am |
|
|
Hello all,
I've been attempting to use the pic18F2550 as a USB bulk transfer device with WinUsb as the driver on my Windows 7 PC.
The pic is setup using the usb config from ex_usb_scope.c. So it is set up as a bulk device. I made modifications so all it does is attempt one call to usb_get_packet and then one call to usb_put_packet.
I have everything done so that the device enumerates and an INF file that tells windows to use winusb. I can enumerate all the information about the PIC as a usb device including the bulk endpoints. However I can't seem to read or write data properly. On both ends all I get is "00" regardless of the byte of data that I send.
Does anybody have any idea what is going on? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19381
|
|
Posted: Sat Apr 02, 2016 10:44 am |
|
|
You don't exactly give us a lot to work on:
What is your packet size defined as?. It must be 8,16,32 or 64 bytes. You can send less, but the actual endpoint packet size must be one of these values. (the CCS example uses 8 bytes for RX, and 64 for TX).
Have you got the processor configured for full speed USB?. Bulk is not supported on the lower speed.
Have you tested the scope example, to prove your hardware is working _first_.
There is no point in calling get_packet, till data has been received. |
|
![](templates/subSilver/images/spacer.gif) |
ksb16
Joined: 01 Apr 2016 Posts: 3
|
|
Posted: Sat Apr 02, 2016 1:18 pm |
|
|
The packet sizes are exactly the same as the example code, I took that code and just removed the oscope part. This is so I can write my own usb application on windows to communicate with the PIC via bulk and winusb or libusbK, both see the PIC device via usb and can receive its settings though they both only receive null bytes from the pic when doing reads.
Unfortunately usbdemo.sys and oscope.exe which are supposed to be provided did not come with the install for some reason so I haven't been able to test them.
I am using usb_kbhit() to test if data has been received and data is actually being placed into the rx buffer it just isn't what I sent. I know the hardware works because if I use any of the other usb examples I have no problems. The hardware is setup to use full speed as well. I'm using #use delay(clock=48MHz, crystal=20MHz, USB_FULL) |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Apr 02, 2016 4:05 pm |
|
|
Quote: |
Unfortunately usbdemo.sys and oscope.exe which are supposed to be
provided did not come with the install for some reason so I haven't been
able to test them.
|
See this thread. The link there is still working.
http://www.ccsinfo.com/forum/viewtopic.php?t=54622 |
|
![](templates/subSilver/images/spacer.gif) |
ksb16
Joined: 01 Apr 2016 Posts: 3
|
|
Posted: Wed Apr 06, 2016 9:14 am |
|
|
Is there a version of the inf file that works for windows 7 64-bit? The one in the download is made for windows 95 or 98 and I don't have much experience with those files. The provided CCS cdc inf works as is and windows/libusbk build inf files for you. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Apr 06, 2016 9:46 pm |
|
|
As far as I know, the files in the link are the only ones they ever released. |
|
![](templates/subSilver/images/spacer.gif) |
|