<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>USB CDC on STM32L device : unable to connect to host.</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/29821/usb-cdc-on-stm32l-device-unable-to-connect-to-host</link><description> 
Hi all, 

 
I try to make a device based on STM32L151 which will communicate
through USB in CDC mode. 

 
My software was initially developped on an STM32F4-discovery
board, and it was working perfectly. It was also working on another
board using a</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: USB CDC on STM32L device : unable to connect to host.</title><link>https://community.arm.com/thread/80789?ContentTypeID=1</link><pubDate>Mon, 03 Dec 2012 02:51:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:540dcc2f-3438-48b3-b831-f618b5c3cae6</guid><dc:creator>Landry C.</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Tsuneo, thank you for your answer.&lt;/p&gt;

&lt;p&gt;
As there&amp;#39;s no USB connector on the STM32L-Discovery board, I cut a
usb cable and plug the green wire to D+ (PA12) and the white one to
D- (PA11). I double check with a multimeter and our previous designs
using USB, as there is plenty of wrong schematics all over the
internet... In doubt, I eventually swap the wire, to be sure, but no
improvment.&lt;/p&gt;

&lt;p&gt;
Still, I now suspect some issue with IO configuration for USB
pins. It seems that the USB functionnality isn&amp;#39;t the default
configuration so I tried to add the following lines :&lt;/p&gt;

&lt;pre&gt;
//Set to AF configuration for USB, even if nobody seems to use it ?
GPIO_PinAFConfig(GPIOA, GPIO_Pin_11, GPIO_AF_USB);
GPIO_PinAFConfig(GPIOA, GPIO_Pin_12, GPIO_AF_USB);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;                    //Draw d+ and d- lines to ground ! Host can manage it only if I set it on GPIO_Mode_IN instead
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;//PP;             //OD or PP : no improvment
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;                //default state anyway
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;               //maximum speed
GPIO_Init(GPIOA, &amp;amp;GPIO_InitStructure);
&lt;/pre&gt;

&lt;p&gt;
And according to my scope (and as there&amp;#39;s no detection on the PC
side) GPIO_Mode_AF seems to force both USB lines to ground... The
only way to let host send something over that bus is to configure it
as GPIO_Mode_In, but of course, the STM32L raises no interrupt, since
I guess it&amp;#39;s not configured the right way.&lt;/p&gt;

&lt;p&gt;
I certainly miss something here, but I&amp;#39;ve no idea.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB CDC on STM32L device : unable to connect to host.</title><link>https://community.arm.com/thread/61426?ContentTypeID=1</link><pubDate>Sat, 01 Dec 2012 06:03:54 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f41509b6-2057-47a2-b1f7-217ae68dc92a</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sound like you did the porting fine.&lt;/p&gt;

&lt;p&gt;
STM32L-discovery board doesn&amp;#39;t mount any USB connector for the
target MCU (STM32L152)&lt;br /&gt;
Aren&amp;#39;t the connections to D+ / D- pin swapped at the extra USB
connector?&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>