cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F1 USB in CDC mode

Posted on August 19, 2016 at 10:38

Hello there,

I am struggling with this issue for over a (whole) day now... I have a custom STM32F103VBT6 board. I am trying to power up USB in CDC mode. I am using CubeMX to generate the code. At first, my USB was not visible at all by the PC. After resolving

http://www.edaboard.com/thread358html#post1534040

my PC sees the board as unknown device now and I am not able to update the driver with inf file. I am wondering, either this 1k5 resistor pulling up the USB line should be kept there all the time, or should I disconnect it after a certain time or event? I dont think the USB library handles this at any point at all (if it had to be disconnected later). Interesting thing is that I also cant see the USB connection (bootloader) when entering the system memory. And I am sure I am entering that region, because my code doesnt start. Also I am not in RAM, because of the fuses (BOOT0 = 1, BOO1 = 0). In the code, I see that program counter is once entering the USB related interrupt routine here:

/**
* @brief This function handles USB low priority or CAN RX0 interrupts.
*/
void USB_LP_CAN1_RX0_IRQHandler(void)
{
/* USER CODE BEGIN USB_LP_CAN1_RX0_IRQn 0 */
/* USER CODE END USB_LP_CAN1_RX0_IRQn 0 */
HAL_CAN_IRQHandler(&hcan);
HAL_PCD_IRQHandler(&hpcd_USB_FS);
/* USER CODE BEGIN USB_LP_CAN1_RX0_IRQn 1 */
/* USER CODE END USB_LP_CAN1_RX0_IRQn 1 */
}

So I gues the device is somehow aknoqledging that it is connected. When the USB is not connected, this vector is hitted by program counter constantly but no Callback is further called, it finishes here:

if (__HAL_PCD_GET_FLAG (hpcd, USB_ISTR_ESOF))
{
/* clear ESOF flag in ISTR */
__HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_ESOF); 
}

Even after I connect the USB back the behaviour stays the same. The question is, why doesnt the USB work correctly? I have checked hardware connections, they are solid.

https://www.dropbox.com/s/pm8d92q0vd2i80z/Zrzut%20ekranu%202016-08-19%png?dl=0

I would really, really appreciate help here... Im going insane.
0 REPLIES 0