PDA

View Full Version : USB 18F4550 in High or full speed???



Jonathan Orrego
- 27th September 2006, 18:12
Hi!
I want to make a hobby pc osciloscope using the 18F4550.

I downloaded the EasyHID, tested and works right (i commented the receive routine because i will only transfer data to the pc).

But its too slow....
I implemented a counter in the vb application, the result is that the pbp application generated with easyusb takes 8 secs. to transfer 1000 packets of 8 bytes each.
The stange thing is that if i use easyhid again, but this time i specify 64 bytes per packet, it takes exactly the same ammount of time to transfer 1000 packets of 64 bytes.

1) Is there some PBP code that shows how to configure and use the full or high speed (not HID)?
2) Does the PicBasic instructions USBIn and USBOut works with full or high speed?

Thanks a lot

Jonathan Orrego
Buenos Aires, Argentina

sayzer
- 27th September 2006, 18:41
Hi Jonathan ,

Did you search the forum for USB?

Enter "USBIN" into the search box and see the results.
Enter "USBOUT" into the search box and see the results.

You will have plenty of examples & ideas.

Check this first.

http://www.picbasic.co.uk/forum/showthread.php?t=1987&highlight=USBIN

Toley00
- 16th November 2006, 13:08
Have a look at this page

http://www.semifluid.com/?p=24

He also made a Graphic LCD version. This is not in PicBasic but it will show you the limitation of the internal A/D inside the PIC.

skimask
- 17th November 2006, 03:36
Hi!
I want to make a hobby pc osciloscope using the 18F4550.

I downloaded the EasyHID, tested and works right (i commented the receive routine because i will only transfer data to the pc).

But its too slow....
I implemented a counter in the vb application, the result is that the pbp application generated with easyusb takes 8 secs. to transfer 1000 packets of 8 bytes each.
The stange thing is that if i use easyhid again, but this time i specify 64 bytes per packet, it takes exactly the same ammount of time to transfer 1000 packets of 64 bytes.

1) Is there some PBP code that shows how to configure and use the full or high speed (not HID)?
2) Does the PicBasic instructions USBIn and USBOut works with full or high speed?

Thanks a lot

Jonathan Orrego
Buenos Aires, Argentina


About the USB taking the same amount of time to transfer 8 times the data.......
If I remember my USB particulars right, the internals of the USB fire off an 'event' every 1ms or so. If there's data in the buffer, it gets transferred, if not, no transfer. However, the kicker to this is the internal buffer. If the internal buffer gets filled up before the 1ms timer goes off, it transfers anyways. So, basically, the bigger the blocks, the faster the transfer. Use the biggest blocks you can get away with and fill the extra space with dummy data. Depending on the application, the block size will vary. As an example, I was able to build a USB transferring device using a PIC18F4620 and an FTDI chip. I could easily get over 600KB/second as long as my block size at the PC end was above 4K (give or take, any larger didn't provide any speed gains). But if I set my block size very small, say 64 bytes like you have, the speed dropped dramatically.
Hope this made sense. And like I said earlier, I'm a bit rusty on my USB particulars...
JDG

lengcallrobot
- 14th July 2008, 22:40
Personally, I think Toley00 and Skimask misunderstand the problem of
Jonathan Orrego because the limitation of sending the data via USBOUT
with EndPoint #1 are not from the speed of ADC. The conversion speed
of ADC is faster than the USB speed we can archieve (64 kbit/s).
Moreover, we can only use a packet of 64Byte at maximum in PIC, so
we cannot increase our speed by using a packet size of 4k.

So, our question is how to increase the speed of USB from 64 kbit/s
to basic speed or high speed or full speed ? In PBP compiler, there
is no option/parameter to select/change the speed, so what can we do?

Best regards,

skimask
- 14th July 2008, 22:56
Personally, I think Toley00 and Skimask misunderstand the problem of Jonathan Orrego because the limitation of sending the data via USBOUT with EndPoint #1 are not from the speed of ADC. The conversion speed of ADC is faster than the USB speed we can archieve (64 kbit/s). Moreover, we can only use a packet of 64Byte at maximum in PIC, so we cannot increase our speed by using a packet size of 4k.
So, our question is how to increase the speed of USB from 64 kbit/s to basic speed or high speed or full speed ? In PBP compiler, there is no option/parameter to select/change the speed, so what can we do?

Maybe, but since that post was over 1 1/2 years ago, I don't really remember what the problem was in the first place.

True, packet size is limited, and again, you're limited by the number of events you can fire off in X time, and limited by how fast the firmware can reload the buffer with useful data.

But again, as mentioned in the other post, the PICs are not capable of high speed (480mbps) mode, so you're limited to FULL speed (12mbps) mode at best.
If the buffer is limited to 64 bytes, and you're limited to 1ms per xfer event, then, there's you're limit...64kB/sec.
I guess I don't really know if you can go faster than that on a PIC. I assume it's possible, but don't know. As I posted last year, I've been able to max out FULL speed mode, just barely.

lengcallrobot
- 15th July 2008, 12:05
Maybe, but since that post was over 1 1/2 years ago, I don't really remember what the problem was in the first place.

True, packet size is limited, and again, you're limited by the number of events you can fire off in X time, and limited by how fast the firmware can reload the buffer with useful data.

But again, as mentioned in the other post, the PICs are not capable of high speed (480mbps) mode, so you're limited to FULL speed (12mbps) mode at best.
If the buffer is limited to 64 bytes, and you're limited to 1ms per xfer event, then, there's you're limit...64kB/sec.
I guess I don't really know if you can go faster than that on a PIC. I assume it's possible, but don't know. As I posted last year, I've been able to max out FULL speed mode, just barely.

Thank for your post, however, for other friend and me, we can only send the data at 64kbit/s which is too slow comparing to Low-speed (1.5Mbit/s) or Full-speed (12Mbit/s).

My question now is: How to configure the PIC to run at Low-speed mode or Full-speed mode? (I use PBP and VB6).

skimask
- 15th July 2008, 14:34
One other option that doesn't take too many pins and has very little hardware hassle is the CP2103 type USB/Serial converter chips. They work great and they can be configured to go pretty fast.

Bruce
- 16th July 2008, 17:13
My question now is: How to configure the PIC to run at Low-speed mode or Full-speed mode?
Look in your USB.TXT file. There's a section that explains how to run at full-speed and
low-speed.