cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple USB CDC (USB IAD). How?

baranovay
Associate
Posted on June 10, 2010 at 07:46

Multiple USB CDC (USB IAD). How?

#iad #cdc #stm32f103 #dual-cdc-with-stm32l152 #usb-cdc-duart
24 REPLIES 24
michele77
Associate II
Posted on July 27, 2012 at 11:06

Hello everyone,

I would also be interested to implement a FT2232 or FT4232 like functionality (DUART, QUART) with STM32.. an experienced developer told me he thinks it's impossible because there aren't enough endpoints.

Any comments from the official STM32 support forum?

Are there any pointers to source code and/or application notes that would suggest how to do this?

Best regards,

Michele

tsuneo
Senior
Posted on July 27, 2012 at 16:39

> an experienced developer told me he thinks it's impossible because there aren't enough endpoints.

One CDC function requires 2 IN / 1 OUT endpoints (interrupt IN/ bulk IN/ bulk OUT), other than the default EP.

Available endpoints of each STM32F family are,

STM32F102/103

- FS Device core: 7 IN / 7 OUT

STM32F105/107

- OTG_FS: 3 IN / 3 OUT

STM32F2xx/4xx

- OTG_FS: 3 IN / 3 OUT

- OTG_HS: 5 IN / 5 OUT

STM32F102/103 - 3x CDC composite

STM32F105/107 - just one CDC

STM32F2xx/4xx - 2x CDC composite on OTG_HS

Starting from ST's example, it isn't so hard, to make them a CDC composite device,

if you would know where and how to touch on the source code 🙂

I can tell you where and how.

Do you want to make one with me?

Tsuneo

michele77
Associate II
Posted on July 27, 2012 at 18:06

Hello Tsuneo,

I could not hope for a better answer... I was reading your posts about Silabs and others and trying to understand what way to tackle the problem. The single CDC example works fine for me.

I would surely want to do this with you and I would also be willing to do this open source if you think it's appropriate.

I really need this functionality from my STM32F102/3xB.

The only problem I see is the significance of my contribution compared to yours!

I don't have much experience with STM32 and I use open source tools (CodeSourcery+Eclipse) to develop.. even though I am willing to spend a bit of money into a commercial suite if you think it's necessary.

Please let me know how we can proceed from here. My email address is michele.bavaro at gmail.

All the best,

Michele

Posted on July 27, 2012 at 19:35

I can tell you where and how. Do you want to make one with me?

It would be of general usefulness, I can see a couple of potential applications.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
tsuneo
Senior
Posted on July 27, 2012 at 21:19

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6bc&d=%2Fa%2F0X0000000brf%2FPkDyba1OTBM8zIARSqdJmVQwC2E.uJnnFL8_iH25GXo&asPdf=false
tsuneo
Senior
Posted on July 27, 2012 at 23:08

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6bh&d=%2Fa%2F0X0000000brg%2FgnytwOnLExb6NzIMfocAxqgEgXaBdii8kEmyairNx68&asPdf=false
Posted on July 27, 2012 at 23:34

I had to add :

#define CDC_V1_10 0x0110

#define USB_ENDPOINT_OUT(addr)                 ((addr) | 0x00)

#define USB_ENDPOINT_IN(addr)                  ((addr) | 0x80)

Keil is still choking on the following with a ''Error #146 Too many initializer values''

   IAD_CDC_IF_DESC_SET( USB_CDC_CIF_NUM0, USB_CDC_DIF_NUM0, USB_ENDPOINT_IN(1), USB_ENDPOINT_OUT(2), USB_ENDPOINT_IN(2) ),

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
michele77
Associate II
Posted on July 28, 2012 at 11:31

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6bm&d=%2Fa%2F0X0000000brh%2FJ3lZIf6d6RgH7VoTomHlC3rMXe269v7CzBNws.utHOk&asPdf=false
tsuneo
Senior
Posted on July 29, 2012 at 12:05

Hi clive1,

Thanks to your interest to our project!

mbavaro,

The modification code on my above post is not enough. I made more change on more source files. I attached current version of source code to this post.

The device appears as 3x CDC composite device on Windows successfully.

Current development state is,

- Descriptors and INF : finished

- Bulk IN/OUT endpoints : not touch yet

- Class requests and interrupt EPs: not touch yet

I'm testing this code on Olimex STM32-P I took STM3210B_EVAL option as the base setting. STM3210B_EVAL assigns PD9 for DISCONNECT port. Olimex STM32-P103 applies PC

To make this difference, platform_config.h was modified as follows,

platform_config.h

/* Define the STM32F10x hardware depending on the used evaluation board */

#ifdef USE_STM3210B_EVAL

#ifdef OLIMEX_STM32_P103

#define USB_DISCONNECT GPIOC

#define USB_DISCONNECT_PIN GPIO_Pin_11

#define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOC

#else

#define USB_DISCONNECT GPIOD

#define USB_DISCONNECT_PIN GPIO_Pin_9

#define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOD

#endif

#define EVAL_COM1_IRQHandler USART1_IRQHandler

Also, OLIMEX_STM32_P103 macro was added to Project > Options > C/C++ > Preprocessor Symbols: Define, over macros of original STM3210B_EVAL setting (I'm using Keil).

USE_STDPERIPH_DRIVER, STM32F10X_MD, USE_STM3210B_EVAL, OLIMEX_STM32_P103

To fit DISCONNECT port to your board, you'll need similar modification.

Tsuneo

________________

Attachments :

Virtual_COM_Port_x3_r1.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I15i&d=%2Fa%2F0X0000000biF%2F2lC9XEy6QTQfHdTP77j3PvDzqPmzkXh..r8E2F0tNwM&asPdf=false