It is currently 26 Jun 2019 03:27

All times are UTC + 1 hour




Post new topic Reply to topic  [ 729 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 49  Next
Author Message
 Post subject:
PostPosted: 10 Nov 2008 09:30 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3779
Location: Nieuwpoort, Belgium
Hi, I did a change in the USB CDC library: made send (PIC -> PC) speed better.
The speeds are now (without additional data processing in PC or PIC):
from PC -> PIC: 250 KB/sec
from PIC -> PC: 270 KB/sec

Have fun. :D

_________________
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
 Post subject:
PostPosted: 11 Nov 2008 15:23 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3779
Location: Nieuwpoort, Belgium
Hi, a small change in the USB HID library: enumeration is much faster now. :D

_________________
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
 Post subject:
PostPosted: 12 Nov 2008 08:24 
Offline

Joined: 07 Dec 2006 11:00
Posts: 317
Location: Vienna, Austria
Dany wrote:
Hi, a small change in the USB HID library: enumeration is much faster now. :D


Hi, Dany!

Because Windows is not what I name an operating system, I use Linux. Did you ever test your library with Linux?
I know that many USB<->Serial converters are really PnP in Linux and are supported without any changes or additional setups in the OS. When plugged in, a new /dev/ttyUSBnn appears, that's all. This is what I am actually looking for since at least 1.5 years: A lib making a PIC appear as such a "serial port" when plugged in, so that I can talk to it.

Does this work? I have neither the right PIC here nor a board for testing (will have to build one), so my only option is to ask. If you confirm that it really works as I need, it is worth to build up a testing environment.


What I also would like to know:
Does your library work transparently in the background (means: interrupt controlled and giving me an Rx and Tx buffer to be read from/written to from my application), or must I run a daisy loop as fast as possible and repeatedly poll/execute a USB-procedure (makes programming more complicated)?
Please, be so kind and leave me some details.

Rainer


Top
 Profile  
 
 Post subject:
PostPosted: 12 Nov 2008 10:23 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3779
Location: Nieuwpoort, Belgium
rainer wrote:
Because Windows is not what I name an operating system, I use Linux. Did you ever test your library with Linux?

Hi Rainer,
No I did not test it on Linux (I do not have it available on my PC). :?

rainer wrote:
I know that many USB<->Serial converters are really PnP in Linux and are supported without any changes or additional setups in the OS. When plugged in, a new /dev/ttyUSBnn appears, that's all. This is what I am actually looking for since at least 1.5 years: A lib making a PIC appear as such a "serial port" when plugged in, so that I can talk to it.

Does this work? I have neither the right PIC here nor a board for testing (will have to build one), so my only option is to ask. If you confirm that it really works as I need, it is worth to build up a testing environment.
I will ask a test to someone using Linux. I let you know the result asap.

rainer wrote:
What I also would like to know:
Does your library work transparently in the background (means: interrupt controlled and giving me an Rx and Tx buffer to be read from/written to from my application), or must I run a daisy loop as fast as possible and repeatedly poll/execute a USB-procedure (makes programming more complicated)?
Please, be so kind and leave me some details.
It works as you say transparently in the background, acting like any ordinary serial port, you do not have to execute any USB related procedure. :D

_________________
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
 Post subject:
PostPosted: 13 Nov 2008 10:34 
Offline

Joined: 07 Dec 2006 11:00
Posts: 317
Location: Vienna, Austria
Dany, you are excellent. Thank you very much for your very kindly help. I will wait for your answer. This is exactly what I am looking for then! Phantastic!

As you confirmed that it runs "transparently", I assume that it is interrupt driven. Or am I wrong? Can I still run another interrupt procedure (i.e. for interrupt driven serial port (UART in PIC), or for running a clock with a timer, or does this make problems?


Is there any PIC with USB in a DIL-Package? Usually one with a huge FLASH, because your library will surely need a lot of space. SMD versions are somewhat problematic because I make my PCBs myself and it is really a pain without vias below a PIC (a wire soldered on both sides in is too high and needs much space)
Which PIC do you recommend?


Top
 Profile  
 
 Post subject:
PostPosted: 13 Nov 2008 11:26 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3779
Location: Nieuwpoort, Belgium
rainer wrote:
As you confirmed that it runs "transparently", I assume that it is interrupt driven. Or am I wrong?
No, you are right, it is interrupt driven.

rainer wrote:
Can I still run another interrupt procedure (i.e. for interrupt driven serial port (UART in PIC), or for running a clock with a timer, or does this make problems?
It will make (I hope) no problems as long a the USB interrupt has the highest priority.

rainer wrote:
Is there any PIC with USB in a DIL-Package? Usually one with a huge FLASH, because your library will surely need a lot of space.
Yes, the 18F2455/2550/4455/4550 family.

rainer wrote:
SMD versions are somewhat problematic because I make my PCBs myself and it is really a pain without vias below a PIC (a wire soldered on both sides in is too high and needs much space)
Which PIC do you recommend?
I myself use for the moment the P18F2550 (32Kbyte flash, 2Kbyte ram -- of which 1Kbyte USB ram --, 256Byte eeprom). The CPU in it can run on 48 MHZ, using crystals from 4 Mhz onwards!

_________________
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
 Post subject:
PostPosted: 22 Nov 2008 15:08 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3779
Location: Nieuwpoort, Belgium
Hi all,
To both the USB HID and CDC libraries the function "ActiveUsb" has been added:
function ActiveUsb: boolean;               
// Returns true if "ConfiguredUsb" and the USB bus is active
It can be used to e.g. drive the "USB" led on the USB PIC device. It signals an active USB connection with the USB enumeration process completed.

Usage is e.g. in the main program loop:
    If ActiveUsb
    then PortB.0 := 1
    else PortB.0 := 0;
provided the "USB" led is driven by PortB.0.

Have fun. :D

_________________
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
 Post subject:
PostPosted: 22 Nov 2008 15:24 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3779
Location: Nieuwpoort, Belgium
Hi all,

A new version of the USB CDC library has been made: USB_CDC_PP2_Library.ppas

It has from the user's view the same functionality as the USB_CDC_Library.ppas one. The only difference is that in USB_CDC_PP2_Library.ppas the "ping pong buffering" feature has been used (with alternating USB buffers, permitting simultaneous data processing and data transmission), which should make the USB transmissions faster.

I myself measured the following speeds:
PC --> PIC: 250 Kbyte/sec (which is the same as for the non ping pong version)
PIC --> PC: 350 kByte/sec (versus 270 KByte/sec for the non ping pong version).
Since my PC is very slow compared to what is on the PC market today, I assume the small (or no) difference is also due to my PC.

Anyway: have fun! :D

p.s. Ping pong mode 2 (all EP's use ping pong) has been used in stead of mode 3 (EP0 does not use ping pong) because not all PIC revisions work well in mode 3.

_________________
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
 Post subject:
PostPosted: 22 Nov 2008 15:35 
Offline

Joined: 25 Jun 2007 16:50
Posts: 47
Wow, congratulation ! Dany, can you give your test speed program to public ? I want to test it on my PC. Thank you.

-Tomy


Top
 Profile  
 
 Post subject:
PostPosted: 25 Nov 2008 15:01 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3779
Location: Nieuwpoort, Belgium
Tomy wrote:
Dany, can you give your test speed program to public ? I want to test it on my PC.

Hi, no problem, the speed test software is now present on the website http://www.rosseeld.be/DRO/PIC/index.htm#PIC_Units see " Additional: Software for testing the USB CDC speed." in the section of USB CDC.

Have fun! :D

_________________
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)


Last edited by Dany on 27 Oct 2010 09:51, edited 1 time in total.

Top
 Profile  
 
 Post subject: step motor in your lib
PostPosted: 25 Nov 2008 17:22 
Offline

Joined: 02 Apr 2006 05:56
Posts: 432
Location: Riode Janeiro, Brasil
Hi Danny
I'm doing a lib that is for step motors. I don't know if I will go to the end, as I'm very short in time. This lib will be for small pics, I intend that it runs in pics like 16F628A or 16F88.

BUT, if I go to the end on this project, I would like to know if you could put in your library. The reason I'm asking that is I think that if we concentrate these projects in just one point, it would be much better, and I think that your lib is becoming this point. What you think about that?
(it will go with source, circuit, simulation on proteus, manual, etc.)
Regads
Jose


Top
 Profile  
 
PostPosted: 26 Nov 2008 09:39 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3779
Location: Nieuwpoort, Belgium
joseLB wrote:
Hi Danny
I'm doing a lib that is for step motors. I don't know if I will go to the end, as I'm very short in time. This lib will be for small pics, I intend that it runs in pics like 16F628A or 16F88.

BUT, if I go to the end on this project, I would like to know if you could put in your library. The reason I'm asking that is I think that if we concentrate these projects in just one point, it would be much better, and I think that your lib is becoming this point. What you think about that?
(it will go with source, circuit, simulation on proteus, manual, etc.)
Regads
Jose
No problem, glad to be of some help. You can send me everything you want to be published. :D

p.s. There is also an opportunity here: http://www.mikroe.com/en/projects/

_________________
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
 Post subject:
PostPosted: 27 Nov 2008 11:09 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3779
Location: Nieuwpoort, Belgium
Hi all,

1. Concerning "usbcom.inf" (the driver info file for USB units CDC and CDC_PP2):
The value "MaximumTransferSize" has been changed. I misunderstood its purpose. :oops:
Quote:
[usbcom_nt_addreg.HW]
HKR,,"MaximumTransferSize",0x10001,65536
...


2. Concerning the USB units (HID, CDC and CDC_PP2) I was obliged to make a small change:
The statement "UCON.PKTDIS := 0;" (to re-enable USB packet handling) has been moved from the beginning of the "TokenSetupPID" procedure to the end of it.
The reason: I disovered that enabling packet handling too soon gave sometimes enumeration problems, especially with the CDC_PP2 unit.

Important: this change is in contradiction (I think) with what Microchip states in the "A3 silicon errata":
Quote:
When an IN endpoint is owned by USB SIE and
the UCON register PKTDIS bit is set, if a USB NAK
event occurs on the IN endpoint before the
PKTDIS bit is clear, then after the PKTDIS is clear,
the pending IN endpoint will send out more bytes
than expected. For example, if configured to send
out 8 bytes, the SIE would actually send out
12 bytes of data.

Work around
The PKTDIS bit is set when a USB control transfer
setup packet is received. Clear this bit as soon as
possible, and clear it before turning over any IN
endpoint ownership to the SIE.


In the distributed C18 version of the USB library,
the following change should be made:

File: usbctrltrf.c, version 1.0, dated 11/19/04
Function:
void USBCtrlEPServiceComplete(void)

Required Modification:
Move UCONbits.PKTDIS = 0, which is located
at the end of the function, to the start of the
function instead.

_________________
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
 Post subject:
PostPosted: 04 Dec 2008 17:03 
Offline

Joined: 25 Jun 2007 16:50
Posts: 47
Hi Dany,

Thank you for your test program.
Here is my cdc speed test result.

http://img510.imageshack.us/my.php?imag ... estey0.png

PC -> PIC seems slow, it is 61.21KB/s
But you have 250KB/s. Maybe I miss something ?
I use PIC18F4550.

Another problem is, when I compile your test program.
It say "File not found : 'WinCom.dcu'"
But WinCom.PAS in the same directory with the project file.
And I already add search path to there. ( I use Delphi7 )
Any idea ?

And where is "RcsTiming" component ?

-Tomy


Top
 Profile  
 
 Post subject:
PostPosted: 04 Dec 2008 18:43 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3779
Location: Nieuwpoort, Belgium
Tomy wrote:
Here is my cdc speed test result.
PC -> PIC seems slow, it is 61.21KB/s
But you have 250KB/s. Maybe I miss something ?
I use PIC18F4550.
Hi, thanks for the measurement.

I also have already seen that kind of speed: when I test with the USB cable connected to an PC usb port (on a card plugged into the motherboard) on my PC, I measure the same speed as you do. However, when I plug the cable via an usb hub which is connected to the same PC usb port, I measure 250 kB/sec. The hub is a "high speed (2.0)" hub. I do not know why the difference is there.

Another possibility is that your PC has a lot of usb devices connected, which will slow down the speed of course.

So: the speed is highly dependant on the PC usb configuration topology. Perhaps more kowledged USB guru's can explain this. :?:
I myself would like to know e.g. why the speed does not drop a little bit when changing the topology but fall back to a very low speed (as you also signal).
Also I do not know how to optimise for speed the settings of the "usbcom" driver in "usbcom.inf" and the timeouts for the virtual com port in "wincom.pas". :oops:

p.s. What kind of library are you measuring? the non ping pong or the ping pong version?

Tomy wrote:
Another problem is, when I compile your test program.
It say "File not found : 'WinCom.dcu'"
But WinCom.PAS in the same directory with the project file.
And I already add search path to there. ( I use Delphi7 )
Any idea ?
It should be found. :cry: Do you use the project file I provided?
Perhaps the "Project -> Options -> Directories-Conditionals" needs adaptation for your Delphi developent environment?

Tomy wrote:
And where is "RcsTiming" component ?
Sorry about that. It can be found on: http://www.nldelphi.com/Forum/showthread.php?t=19213

_________________
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 729 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 49  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


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 post attachments in this forum

Search for:
Jump to: