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.
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
Hi this code was part of "STM32_USB-Host-Device_Lib_V2.1.0" ... isn't it?
would you please check the throughput of USB HS in MSC.
I should try to manopulate keil project to use internal PHY I think.
thanks
Auu, mistake on the figure,
13 full-size transactions/frame --> 19 full-size transactions/frame
Tsuneo
Hi Tsuneo Chinzei
thanks for your details but I couldn't get this part: "It works in full-/low-speed, but not on high-speed."
what's the meaning of this sentence?
you mean these pins (PB14 and PB15) are just have the name of High speed USB but can not work in High Speed mode.
about the write speed with external PHY, I know it depends on USB stick but, for example speed of Silicon Power 8BG 200x CompactFlash with Transcend card reader in my computer is about 9MB/s
Is it possible to write with such speed by external PHY?
another thing:
I changed USE_ULPI_PHY to USE_EMBEDDED_PHY and HCD_GetCurrentSpeed function always return "Full speed" value.
speed of write is about 500KB/s ... it should be optimize but it is not High speed
It is my understanding that you need an external PHY to get to the 480 Mbps rates.
You should be able to test the maximal rate of the flash device on the STM32 without USB, this will be the limiting factor.
I don't have a system set up to bench mark this for you. I'd guess that 5-10 MBps would be achievable.
Is there anybody has MCBSTM32F400 or STM3240G-EVAL to test this speed
"Figure 88. USB controller configured in dual mode and used in full speed mode"
I found it:
2.2.31 Universal serial bus on-the-go high-speed (OTG_HS)The STM32F405xx and STM32F407xx devices embed a USB OTG high-speed (up to 480 Mb/s) device/host/OTG peripheral. The USB OTG HS supports both full-speed and high-speed operations. It integrates the transceivers for full-speed operation (12 MB/s) and features a UTMI low-pin interface (ULPI) for high-speed operation (480 MB/s). When using the USB OTG HS in HS mode, an external PHY device connected to the ULPI is required.
but it is a kind of disaster that we call something OTG HS but there is no HS and it need external PHY ... so what the hell is PB14 (OTG_HS_DM) and PB15 (OTG_HS_DP). why do they call it "HS"?
anyway ...
Does anybody check the throughput?