[DONE] DualCDC associate new SerialUSBDriver

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

Re: [DONE] DualCDC associate new SerialUSBDriver

Post by alex31 »

The CDCs should be active at the same time, you need to init the enpoints for both in that code then do sduConfigureHookI() for both.


you mean someting like

Code: Select all

    /* Enables the endpoints specified into the configuration.
       Note, this callback is invoked from an ISR so I-Class functions
       must be used.*/
    usbInitEndpointI(usbp, SER1_USBD1_DATA_REQUEST_EP, &ep1config);
    usbInitEndpointI(usbp, SER1_USBD1_INTERRUPT_REQUEST_EP, &ep2config);

    /* Resetting the state of the CDC subsystem.*/
    sduConfigureHookI(&SDU1);
 
    usbInitEndpointI(usbp, SER2_USBD1_DATA_REQUEST_EP, &ep3config);
    usbInitEndpointI(usbp, SER2_USBD1_INTERRUPT_REQUEST_EP, &ep4config);

    /* Resetting the state of the CDC subsystem.*/
    sduConfigureHookI(&SDU2);



Post the descriptors, I could give it a try later.


I put the descriptor in the file usbconfig1.c in this project https://drive.google.com/file/d/0B3a7E0ODHTNHYUp4WS1LNk5vbEU/view?usp=sharing which a clone of a discovery demo with just dual cdc tryies.
When i plug the usb, i see the two CDC devices, but trying to access them make the stm to busfault.

For the descriptor, i use the one that has been posted at the begining of this thread, ... more than one year ago, and it's kind of copy and paste
of stmicro demo without using the convenient macro provided by chibios usb.h to construct headers.

I understand that you have more urgent and interesting things to do than debug my code, but if you can continue to give me tips,
i will perhaps be able to complete this dual cdc example ...

Anyway, thanks for your help.

Alexandre
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [DONE] DualCDC associate new SerialUSBDriver

Post by Giovanni »

Yes, like that. Of course you have to make sure that the endpoint numbers match what you have in the descriptors.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: [DONE] DualCDC associate new SerialUSBDriver

Post by russian »

alex31 wrote:I put the descriptor in the file usbconfig1.c in this project https://drive.google.com/file/d/0B3a7E0ODHTNHYUp4WS1LNk5vbEU/view?usp=sharing which a clone of a discovery demo with just dual cdc tryies.
When i plug the usb, i see the two CDC devices, but trying to access them make the stm to busfault.

I've just compiled this code and I only see one CDC device and yes, some kind of an error.

Did anyone ever get dual CDC to function property? I'm sorry if I am missing something trivial.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [DONE] DualCDC associate new SerialUSBDriver

Post by Giovanni »

I entirely forgot about this... I hope to find some time and create an "official" dual CDC demo.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: [DONE] DualCDC associate new SerialUSBDriver

Post by russian »

Giovanni wrote:I entirely forgot about this... I hope to find some time and create an "official" dual CDC demo.

That would be great! Dual CDC would help my project - we use one serial port for communication with a handy 3rd party tool we are integrated with, and another port is used to communicate with our own tool which knows more low-level specifics of our project. At the moment it's an extra $4 chip and a connector and some resistors and a second cable.

Once we have dual CDC demo, I would post another question regarding another cool use of USB... We would never stop asking :)
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

Re: [DONE] DualCDC associate new SerialUSBDriver

Post by alex31 »

That would be great! Dual CDC would help my project


+1 :-)

Alexandre
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [DONE] DualCDC associate new SerialUSBDriver

Post by Giovanni »

Hi,

I committed a demo for the F3 (and an incomplete one for the F4), the problem is that I see only one COM port, I think it is a problem with the .inf file but I am unable to create one for multiple interfaces.

Will try tomorrow on Linux that does not need .inf stuff.

BTW, on the F4 the dual CDC can only be implemented on OTG_HS because OTG_FS does not have enough endpoints.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: [DONE] DualCDC associate new SerialUSBDriver

Post by russian »

Giovanni wrote:on the F4 the dual CDC can only be implemented on OTG_HS because OTG_FS does not have enough endpoints.

It's really exciting to see some progress in this department!

So in case of stm32f4discovery we cannot use the default OTG_FS device sitting on PA11 & PA12 for DualCDC, we would have to use OTG_HS device which uses PB14 & PB15?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [DONE] DualCDC associate new SerialUSBDriver

Post by Giovanni »

Correct, that would be USBD2.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [DONE] DualCDC associate new SerialUSBDriver

Post by Giovanni »

Hi,

Update, I committed both F3 and F4 demos (USB_CDC_IAP), I only tested the F3 one on Win7 and Linux Ubuntu. The demos can easily be extended to 3 or more virtual COM ports on those devices with sufficient endpoints.

Windumb requires a driver, it is included in the project directory, Linux just works.

Giovanni
Post Reply