cancel
Showing results for 
Search instead for 
Did you mean: 

USB HID on STM32

tuyenvquang
Associate II
Posted on April 09, 2015 at 05:04

I a writing a USB HID program for STM32F107, but when i look at the USB HID library from STM, i am so confused and cannot understand the library for my own modification, such as where is the descriptor, how its value is set...

Anyone can suggest me any docs for this or sample project.

Thanks very much
2 REPLIES 2
Amel NASRI
ST Employee
Posted on April 09, 2015 at 13:05

Hi,

Look at UM0424 available in this page: http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/LN1734/PF258157.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

tuyenvquang
Associate II
Posted on April 13, 2015 at 11:57

#if defined(STM32L1XX_MD) || defined(STM32L1XX_HD)|| defined(STM32L1XX_MD_PLUS)|| defined(STM32F37X)|| defined(STM32F30X)

/* Enable the SYSCFG module clock (used for the USB disconnect feature) */

 

RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

#endif /* STM32L1XX_XD */

/* Set all the GPIOs to AIN *************************************************/

// Configures all IOs as AIN to reduce the power consumption.

//

#if !defined(STM32L1XX_MD) && !defined(STM32L1XX_HD) && !defined(STM32L1XX_MD_PLUS)&& !defined(STM32F37X) && !defined(STM32F30X)

GPIO_AINConfig();

#endif /* STM32L1XX_XD */

#if defined(STM32F37X) || defined(STM32F30X)

/* Enable the USB disconnect GPIO clock */

 

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIO_DISCONNECT, ENABLE);

 

/*Set PA11,12 as IN - USB_DM,DP*/

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_Init(GPIOA, &GPIO_InitStructure);

    

  /*SET PA11,12 for USB: USB_DM,DP*/

  GPIO_PinAFConfig(GPIOA, GPIO_PinSource11, GPIO_AF_14);

  GPIO_PinAFConfig(GPIOA, GPIO_PinSource12, GPIO_AF_14);

1. I dont understand about USB disconnect feature in the bold lines. Could you explain to me why we need USB Disconnect?]

2. And the last two red lines: IN- USB_DM.DP and USB_DM,DP. Are they different? Please explain? 

Thanks very much!