This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

stm32f407 usb High speed host

Hi
I have question about STM32F407 and USB host.
I am using discovery board and I can work with USB Full speed properly. I need to work with USB High Speed but in keil projects there is a sample which is based on ULPI and it needs USB HS PHY (it is not exist on discovery board)

I need to know: What are exactly those pins with names: USB_HS_DP and USB_HS_DM on microcontroller package?
is it possible to port this sample for USB HS or it just need external PHY.

another question about MCBSTM32F400:
Do you know the throughput of USB HOST HS as a MSD driver?

for example if you open a file and just write a 32768 bytes buffer how long does it take?
like this:

U8 buff[32768];
void tst_fwrite (void) {
  FILE *fout;
  U16 i;
  fout = fopen ("speed.log","w");
  if (fout != NULL) {
    for(i=0;i<512;i++)
     fwrite (&buff[0], 1, 32768, fout);
  }
  fclose (fout);
}


it will write 16MB.
with such a code on USB FS it can write 950KByte per second.
maybe it will be my Tempting to buy MCBSTM32F400.

Parents
  • The USB HS signals (DM/DP) come out of the PHY, not the micro

      #ifdef USE_ULPI_PHY // ULPI
      RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
                             RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOH |
                               RCC_AHB1Periph_GPIOI, ENABLE);
    
    
      GPIO_PinAFConfig(GPIOA,GPIO_PinSource3, GPIO_AF_OTG2_HS) ; // D0
      GPIO_PinAFConfig(GPIOA,GPIO_PinSource5, GPIO_AF_OTG2_HS) ; // CLK
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource0, GPIO_AF_OTG2_HS) ; // D1
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource1, GPIO_AF_OTG2_HS) ; // D2
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource5, GPIO_AF_OTG2_HS) ; // D7
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource10,GPIO_AF_OTG2_HS) ; // D3
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource11,GPIO_AF_OTG2_HS) ; // D4
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource12,GPIO_AF_OTG2_HS) ; // D5
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource13,GPIO_AF_OTG2_HS) ; // D6
      GPIO_PinAFConfig(GPIOH,GPIO_PinSource4, GPIO_AF_OTG2_HS) ; // NXT
      GPIO_PinAFConfig(GPIOI,GPIO_PinSource11,GPIO_AF_OTG2_HS) ; // DIR
      GPIO_PinAFConfig(GPIOC,GPIO_PinSource0, GPIO_AF_OTG2_HS) ; // STP
    
      // CLK
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 ;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_Init(GPIOA, &GPIO_InitStructure);
    
      // D0
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3  ;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      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);
    
    
    
      // D1 D2 D3 D4 D5 D6 D7
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1  |
        GPIO_Pin_5 | GPIO_Pin_10 |
          GPIO_Pin_11| GPIO_Pin_12 |
            GPIO_Pin_13 ;
    
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
      GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
      GPIO_Init(GPIOB, &GPIO_InitStructure);
    
    
      // STP
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0  ;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_Init(GPIOC, &GPIO_InitStructure);
    
      //NXT
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_Init(GPIOH, &GPIO_InitStructure);
    
    
      //DIR
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 ;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_Init(GPIOI, &GPIO_InitStructure);
    
    
      RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_OTG_HS |
                             RCC_AHB1Periph_OTG_HS_ULPI, ENABLE) ;
    
      #else
    ..
    

    Without the PHY the USB signals come out of PB.12,14, and 15

Reply
  • The USB HS signals (DM/DP) come out of the PHY, not the micro

      #ifdef USE_ULPI_PHY // ULPI
      RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
                             RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOH |
                               RCC_AHB1Periph_GPIOI, ENABLE);
    
    
      GPIO_PinAFConfig(GPIOA,GPIO_PinSource3, GPIO_AF_OTG2_HS) ; // D0
      GPIO_PinAFConfig(GPIOA,GPIO_PinSource5, GPIO_AF_OTG2_HS) ; // CLK
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource0, GPIO_AF_OTG2_HS) ; // D1
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource1, GPIO_AF_OTG2_HS) ; // D2
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource5, GPIO_AF_OTG2_HS) ; // D7
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource10,GPIO_AF_OTG2_HS) ; // D3
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource11,GPIO_AF_OTG2_HS) ; // D4
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource12,GPIO_AF_OTG2_HS) ; // D5
      GPIO_PinAFConfig(GPIOB,GPIO_PinSource13,GPIO_AF_OTG2_HS) ; // D6
      GPIO_PinAFConfig(GPIOH,GPIO_PinSource4, GPIO_AF_OTG2_HS) ; // NXT
      GPIO_PinAFConfig(GPIOI,GPIO_PinSource11,GPIO_AF_OTG2_HS) ; // DIR
      GPIO_PinAFConfig(GPIOC,GPIO_PinSource0, GPIO_AF_OTG2_HS) ; // STP
    
      // CLK
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 ;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_Init(GPIOA, &GPIO_InitStructure);
    
      // D0
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3  ;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      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);
    
    
    
      // D1 D2 D3 D4 D5 D6 D7
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1  |
        GPIO_Pin_5 | GPIO_Pin_10 |
          GPIO_Pin_11| GPIO_Pin_12 |
            GPIO_Pin_13 ;
    
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
      GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
      GPIO_Init(GPIOB, &GPIO_InitStructure);
    
    
      // STP
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0  ;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_Init(GPIOC, &GPIO_InitStructure);
    
      //NXT
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_Init(GPIOH, &GPIO_InitStructure);
    
    
      //DIR
      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 ;
      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
      GPIO_Init(GPIOI, &GPIO_InitStructure);
    
    
      RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_OTG_HS |
                             RCC_AHB1Periph_OTG_HS_ULPI, ENABLE) ;
    
      #else
    ..
    

    Without the PHY the USB signals come out of PB.12,14, and 15

Children