cancel
Showing results for 
Search instead for 
Did you mean: 

2(two) USB-2.0_FS Working

MMARI.1
Senior

hi , i need   manage one usb  pendrive and usb keyboard in USB_fs mode .

it's possible to use 2 USB_FS mode simultaneously like One is HOST+mass storage  and Another One is for HOST+HID can anyone please suggest . 

Cube ide able make the code generation above mentioned criteria but in Reality it possible to run ? based on your suggestion i can make order  2  USB_fs mode available  controller

8 REPLIES 8
AScha.3
Chief

Hi,

no problem, just need a cpu with 2 x USB otg/host .

I have this running with MSC (usb-stick) and Audio-host (sound card) on H743 and

on H563 MSC and Audio-host on one USB (dual).

 

You can also look on selection tool, for cpus with 2 usb (otg) :

https://www.st.com/en/development-tools/st-mcu-finder-pc.html

 

If you feel a post has answered your question, please click "Accept as Solution".

@AScha.3 @Peter BENSCH 

hi, 

controller is STM32F446RCT6 is fine to me 

for STM32F446RCT6  i need add 4.7 uf on VCAP_1 pin ?

 https://community.st.com/t5/stm32-mcus-boards-and-hardware/vcap-in-hardware-design/td-p/65256 

the attached  datasheet capacitor  will be suitable one ? or please suggest capacitor type  .

 

Hi,

yes, the 4u7 cer cap is ok.

But i would recommend to buy a 

NUCLEO-F446RE

to have a working setup for your first tests. Might save you a lot of time.

And to check the software: just try to make the basic program you need:

use Cube or IDE , start new project with nucleo-f446 , set what you want, the 2 x USB host;

generate code and if everything looks fine, get the nucleo board for real test. 

If you feel a post has answered your question, please click "Accept as Solution".

hi, good morning ,

Dual host working is working fine but few doubts on Vbus Sensing .

Without Vbus Sense ( Not Activated  Vbus Sense in cube mx configuration ) is both host is working fine and With Vbus Sense Enabled also working fine . 

Vbus Sense is mandatory ?  and  how to capture the vbus sense by software ?  incase of Vbus sense enabled condition ,

 

Hi,

you need Vbus Sense (afaik) for usb-otg, to check : is a host connected, that supplies vbus , or not .

So if you only make host , you dont use or need it.

 

>Dual host working is working fine

Good !

If you feel a post has answered your question, please click "Accept as Solution".

hi , 

New Challenge is trying use Dual Host + Dual HID .

 Port No.1  Full_Speed + Keyboard .

 Port No.2  Internal FS Phy + barcode  .

interestingly both are working simultaneous with error output 

Keyboard Output

if  k key pressed then  output kkk

if 2  key pressed then output 22

Barcode Output 

sticker code : 1745933  scanned   output 117774455533333

sticker code: 18963      scanned   output 11118889966633

At a time Only One Host + One Device - either keyboard or barcode working fine  !.

In your  in-depth view Enabling High Speed Host + HID and  Adding HIGH Speed Driver IC will give any solution . Based on your suggestion I can order high speed Driver IC 

Any other solution will possible use keyboard and barcode simultaneous . 

 

 

 

 

 

 

 

 

 

 

 

Hi,

>Adding HIGH Speed Driver IC will give any solution .

I dont think so, because HID usually is lo or full speed, not high.

 

>At a time Only One Host + One Device - either keyboard or barcode working fine  !

The errors shown still have the correct data , just some confusion in the data . 🙂

So it looks like some basic problem in your software, when 2 hosts are busy.

How you separate the hosts and their states ?

I had to write a different name for one host, the cube init made 2x same names (Appli_state) - just look, what you have:

in usb_host.c ,

from my program:

static void USBH_UserProcess1  (USBH_HandleTypeDef *phost, uint8_t id)
{
  /* USER CODE BEGIN CALL_BACK_2 */
  switch(id)
  {
  case HOST_USER_SELECT_CONFIGURATION:
  break;

  case HOST_USER_DISCONNECTION:
	  Appli_state_sound = APPLICATION_DISCONNECT;
  break;

  case HOST_USER_CLASS_ACTIVE:
	  Appli_state_sound = APPLICATION_READY;
  break;

  case HOST_USER_CONNECTION:
	  Appli_state_sound = APPLICATION_START;
  break;

  default:
  break;
  }
  /* USER CODE END CALL_BACK_2 */
}

static void USBH_UserProcess2  (USBH_HandleTypeDef *phost, uint8_t id)
{
  /* USER CODE BEGIN CALL_BACK_21 */
  switch(id)
  {
  case HOST_USER_SELECT_CONFIGURATION:
  break;

  case HOST_USER_DISCONNECTION:
	  Appli_state = APPLICATION_DISCONNECT;
  break;

  case HOST_USER_CLASS_ACTIVE:
	  Appli_state = APPLICATION_READY;
  break;

  case HOST_USER_CONNECTION:
	  Appli_state = APPLICATION_START;
//	  *DWT_CYCCNT = 0;										// clear counter
//	  *DWT_CONTROL = *DWT_CONTROL | 1 ; 					// start cycle counter

  break;

  default:
  break;
  }
  /* USER CODE END CALL_BACK_21 */
}

 

If you feel a post has answered your question, please click "Accept as Solution".

hi, Declared  the ApplicationTypedef again with Appli_state_key but problem same  as mentioned earlier .

i think i am missing something .

ApplicationTypeDef Appli_state_key = APPLICATION_IDLE ;
ApplicationTypeDef Appli_state = APPLICATION_IDLE;

static void USBH_UserProcess1  (USBH_HandleTypeDef *phost, uint8_t id)
{
  /* USER CODE BEGIN CALL_BACK_2 */
  switch(id)
  {
  case HOST_USER_SELECT_CONFIGURATION:
  break;

  case HOST_USER_DISCONNECTION:
  Appli_state_key = APPLICATION_DISCONNECT;
  break;

  case HOST_USER_CLASS_ACTIVE:
  Appli_state_key = APPLICATION_READY;
  break;

  case HOST_USER_CONNECTION:
  Appli_state_key = APPLICATION_START;
  break;

  default:
  break;
  }
  /* USER CODE END CALL_BACK_2 */
}

static void USBH_UserProcess2  (USBH_HandleTypeDef *phost, uint8_t id)
{
  /* USER CODE BEGIN CALL_BACK_21 */
  switch(id)
  {
  case HOST_USER_SELECT_CONFIGURATION:
  break;

  case HOST_USER_DISCONNECTION:
  Appli_state = APPLICATION_DISCONNECT;
  break;

  case HOST_USER_CLASS_ACTIVE:
  Appli_state = APPLICATION_READY;
  break;

  case HOST_USER_CONNECTION:
  Appli_state = APPLICATION_START;
  break;

  default:
  break;
  }
  /* USER CODE END CALL_BACK_21 */
}