March 29, 2024, 01:47:17 AM

STM32-E407 USB Comunication

Started by dvd_video, July 31, 2013, 04:48:59 PM

Previous topic - Next topic

dvd_video

Hi forum,

I am making USB communication. The PC is receiver and the board is transmitter, but i cant find decent functions to run the USB. I only inited USB_HS as alternative function. What should i do next ?


void InitUSBHSCDC(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;

  /* Configure USB HS as alternate function  */
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_UP;
  GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_AF;
                                  //  ID           Vbus          DM           DP
  GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  /* USB HS configuration */

  /* Enable GPIOB clock */
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);

  /* Enable USB HS clock */
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_OTG_HS, ENABLE);

  GPIO_PinAFConfig(GPIOB, GPIO_PinSource12, GPIO_AF_OTG_HS);
  GPIO_PinAFConfig(GPIOB, GPIO_PinSource13, GPIO_AF_OTG_HS);
  GPIO_PinAFConfig(GPIOB, GPIO_PinSource14, GPIO_AF_OTG_HS);
  GPIO_PinAFConfig(GPIOB, GPIO_PinSource15, GPIO_AF_OTG_HS);

  GPIO_Init(GPIOB, &GPIO_InitStructure);
}

I am an automation engineer graduated from TU-Sofia, Bulgaria. My passion is Programming, hardware martial arts and cycling.

LubOlimex

Hey dvd_video,

There is a USB example in the default demo package for IAR: https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E_revE+_demo.zip.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex