Skip to main content
ColdWeather
Senior
July 9, 2011
Question

Virtual COM port (USB CDC) example - ... Endpoints? _SOLVED but SEVERE MISTAKE in RL-USB!

  • July 9, 2011
  • 11 replies
  • 2052 views
Posted on July 09, 2011 at 23:13

Hello!

I've adjusted the Virtual Com Port example from the

FS USB Library V3.2.1/V3.3.0 to my needs on

STM32F103RC.

It works.

As a preparation to merge USB CDC and Mass Storage

(suggestions and solutions are welcome!) I'm trying now

first to ''move'' the COM communication to the endpoints

4,5 and 6 instead of the origin 1,2 and 3 in the example.

It does not work.

Exactly, the Virtual COM does appear under Win7

(endpoint 0 is untouched) but no communication

occures.

I think I've missed some substitution or misunderstood

the allocation of the endpoints.

Could anyone share with me a kind of check list, what

changes/substitutions should be made to the application

part of the USB library (usb_conf.h, usb_desc (.h, .c),

 

usb_prop (.h, .c), usb_endp.c, usb_istr (.h,.c) and

 

usb_pwr (.h, .c)) to get the communication over

EP4, EP5 and EP6?

TIA.

#usb-endpoints-change #virtual-com-port-alternative-endpoints #composite-virtual-com #usb-cdc-rl-usb-severe-mistake
This topic has been closed for replies.

11 replies

alok472
Associate
July 11, 2011
Posted on July 11, 2011 at 10:33

Are you trying to make a composite device ? Is mass-storage the 1st interface ? Can you post yr fw here ?

ColdWeather
Senior
July 11, 2011
Posted on July 11, 2011 at 14:28

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=0680X000006I6aF&d=%2Fa%2F0X0000000brB%2FSH._di2PELHZ3bExzeub1iM99ZyQxpDNRs5QX4qlE.c&asPdf=false
ColdWeather
Senior
July 15, 2011
Posted on July 15, 2011 at 09:15

Was it a killer question? Any from ST who wrote the USB lib? Or was it in India?

alok472
Associate
July 18, 2011
Posted on July 18, 2011 at 15:18

''Was it a killer question? ''

Sorry, i wasnt getting time to visit the forum due to my current assignments.

it seems the assignment of EPs is OK, did you make relevant changes in descriptors as well ? Is it possible to show your configuration descriptor ?

The reason to ask for composite device is that i attempted this long time back (>6yrs back) and i was facing some problem due to lack of support in Windows OS. I remember something was mentioned on Microsoft site.

Now, the Windows OS support the composite but we need to make Mass-storage the 1st interface. This is what i am able to recall...

tsuneo
Associate II
July 18, 2011
Posted on July 18, 2011 at 17:03

Your mods are almost fine.

Did you modify EP_NUM macro value, too?

inc\usb_conf.h

#define EP_NUM         (4)   // <--- 7 (max EP number + 1, for EP0)

Tsuneo

ColdWeather
Senior
July 18, 2011
Posted on July 18, 2011 at 19:09

Did you modify EP_NUM macro value, too?

 

 

inc\usb_conf.h

 

#define EP_NUM         (4)   // <--- 7 (max EP number + 1, for EP0)

 

 

Tsuneo

 

No,  I did not, and...

YES, THAT WAS IT!

Now it started working as soon as I changed EP_NUM to 7!

 

I assumed, EP_NUM is the number of endpoints actually in use, not the number of last used endpoint, and left it unchanged...

Thanks!

Meanwhile I am not sure if I should use ST FS USB library or better switch to KEIL RL-USB along with its ''Drivers'' for STM32F10x... KEIL has a pretty nice help file and examples to its RL-USB (as well as for other RL- parts), also with the explanations, how to build a composite device, what I miss now in ST USB examples/UM0424.

What is your opinion?

P.S. Are you that Tsuneo, who made also a lot of well known examples for USB implementation on Silabs F340?

 

ColdWeather
Senior
July 18, 2011
Posted on July 18, 2011 at 19:15

''Was it a killer question? ''

 

Sorry, i wasnt getting time to visit the forum due to my current assignments.

 

Sorry, I did not mean you personally or your answer. I saw a view counter of my posting growing but missed any answer and became impatient, so my ''killer question'' was a kind of unaddressed rhetorical exclaim.

tsuneo
Associate II
July 18, 2011
Posted on July 18, 2011 at 20:59

> What is your opinion?

For development of a composite device, Keil's USB stack is much easier than ST's.

Keil's stack is organized for this purpose. Just a couple of clicks on the configuration dialog makes it.

http://www.keil.com/support/man/docs/rlarm/rlarm_usb_create_compo.htm

ST's stack is designed for single class. Of course, You may make a composite device on ST's, but you have to modify a fair amount of lines on the source code.

> P.S. Are you that Tsuneo, who made also a lot of well known examples for USB implementation on Silabs F340?

Thanks.

I've posted to many fora on USB, SiLabs, Microchip, Keil, LPC2000, Freescale, TI MSP430, Axelson's, and here.

I'm on vacation, now :)

Tsuneo

ColdWeather
Senior
July 19, 2011
Posted on July 19, 2011 at 10:18

Nice to meet you here, Tsuneo!

 

 

> For development of a composite device, Keil's USB stack is much easier than ST's.

 

> Keil's stack is organized for this purpose. Just a couple of clicks on the configuration

 

> dialog makes it.

Yesterday I was fighting with KEIL USB stack and noticed, it needs - at least for the CDC - synchronous calls to push the whole engine (see

http://www.keil.com/support/man/docs/rlarm/rlarm_usb_create_cdc.htm

). ST USB stack seems to be fully and nice interrupt driven, instead (''init and forget'').

Igor.

ColdWeather
Senior
July 23, 2011
Posted on July 23, 2011 at 10:41

FYI: while playing with the RL-USB from KEIL on the board with STM32F103RC

(similar to MCBSTM32) I might have found a severe mistake in the KEIL ''USB-Driver''.

The driver file is ''usbd_STM32F103.c'' and is normally to copy and custom in the

project.

Symptoms: firmware with USB CDC implemented stalled as soon as the USB cable

was unplugged on the self powered device.

Found: the USB interrupt stayed pending because of ESOF flag set while in the ISR

there was no branch processing this flag. USBD_Reset() enables the interrupt on

this flag along with SOF. The part of the code doing this looks like:

 

CNTR = ....

 

         ((USBD_P_SOF_Event   != 0) ? CNTR_SOFM    : 0) |

 

         ((USBD_P_SOF_Event   != 0) ? CNTR_ESOFM   : 0);

The interrupt occurs as soon as and only when the USB is unplugged.

Suspicion: ''copy and paste'' mistake. Besides, I suppose, KEIL programmers might

have tested the code on the device that was bus powered only (supply gone,

problem gone).

Solution: the last line setting CNTR_ESOFM has been removed; firmware works.

My question to USB gurus: how the handler for ESOF should look like if I decide to process it?