CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

pic18f2550 usb bulk

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ksb16



Joined: 01 Apr 2016
Posts: 3

View user's profile Send private message

pic18f2550 usb bulk
PostPosted: Fri Apr 01, 2016 4:27 am     Reply with quote

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?
Ttelmah



Joined: 11 Mar 2010
Posts: 19546

View user's profile Send private message

PostPosted: Sat Apr 02, 2016 10:44 am     Reply with quote

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.
ksb16



Joined: 01 Apr 2016
Posts: 3

View user's profile Send private message

PostPosted: Sat Apr 02, 2016 1:18 pm     Reply with quote

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)
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Apr 02, 2016 4:05 pm     Reply with quote

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
ksb16



Joined: 01 Apr 2016
Posts: 3

View user's profile Send private message

PostPosted: Wed Apr 06, 2016 9:14 am     Reply with quote

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.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 06, 2016 9:46 pm     Reply with quote

As far as I know, the files in the link are the only ones they ever released.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group