2010-08-01 08:44 AM
STM32F103 USB VCP Demo Code Problems
#stm322011-05-17 05:00 AM
Dear Sturmer,
Could you please attach the schematics of your Softbaugh board for a sanity check versus our Evaluation boards by ST ? be aware that this Sofbaugh board is fitted by our ''STM32F103RC'' : High density devices. Equivalent to our STM32E-EVAL workspace not STM32B-EVAL. let me know you comments. Cheers STOne-32.2011-05-17 05:00 AM
I'm unfortunately not able to share the schematics of the demo board. The USB part of the circuit is identical to the EVAL-B, with a jumperable USB_DISCONNECT pin. I have it set to PORTC bit 13, and have made that known in hardware_platform.h Other than memory size, what are the differences between the medium/high density devices? Will these matter for the USB peripheral?
2011-05-17 05:00 AM
Just an idea.
Try compiling without optimization (-O0). I've often cursed example code (from another company), that was buggy, but happened to work when optimizations were disabled.2011-05-17 05:00 AM
The only problem I have had, was getting the pull up to work correctly.
I had several problems when the pull up activates before the USB interrupts are started.2011-05-17 05:00 AM
I'm already compiling with optimization off, so that's not likely the issue.
The circuit I have is slightly different than the ST version with regards to the pull-up. I'm fairly new to USB... Is DP supposed to be pulled up when USB is active, and pulled down when disabled? Or is it the other way round? Or have I missed the mark altogether?2011-05-17 05:00 AM
If just connected with a pin, then the code must change slightly.
Here is my changes: void Set_System(void) { GPIO_InitTypeDef GPIO_InitStructure; /* Enable USB_DISCONNECT GPIO clock */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIO_DISCONNECT, ENABLE); GPIO_DeInit(USB_DISCONNECT); // make sure it's default /* Configure USB pull-up pin */ GPIO_InitStructure.GPIO_Pin = USB_DISCONNECT_PIN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; // change from OD to PP GPIO_Init(USB_DISCONNECT, &GPIO_InitStructure); } void USB_Cable_Config (FunctionalState NewState) { if (NewState == DISABLE) // opposite { GPIO_ResetBits(USB_DISCONNECT, USB_DISCONNECT_PIN); } else { GPIO_SetBits(USB_DISCONNECT, USB_DISCONNECT_PIN); } }2011-05-17 05:00 AM
Hi,
DP, should be up when VBUS ( 5 Volts from cable) is detected present and you should enumerate the device within 10ms from ''USB reset'' else the host will cut the connection and DP down when VBUS is not present. Cheers, STOne-32.2011-05-17 05:00 AM
The pin is tied to a PMOS that connects DP to VDD through a 1.5k resistor. Pulling it DOWN should turn it ON, which should enact the pullup. I've tried this configuration with both the push-pull and open-drain modes on the output, with no success. I'm pretty sure that the GPIO is working, but I supposed I should scope the DP line to be sure.
2011-05-17 05:00 AM
From: sturmer.ryan.001
Subject: STM32F103 USB VCP Demo Code Problems The function Virtual_Com_Port_Reset(), which appears to be the function that configures the endpoints and activates the USB hardware does not appear to even be called by the demo code. What gives? The Virtual_Com_Port_Reset() is called via the Device_Property.Reset(); in void USB_Istr(void) when the host requests the slave to reset. So if your getting NO activity it is likely that the USB pull-up are not working (as has been mentioned in the thread)