2024-05-05 01:59 AM
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
2024-05-05 03:52 AM - edited 2024-05-05 03:56 AM
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
2024-05-05 05:14 AM
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 .
2024-05-05 05:32 AM
Hi,
yes, the 4u7 cer cap is ok.
But i would recommend to buy a
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.
2024-05-16 09:37 PM
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 ,
2024-05-16 10:44 PM
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 !
2024-05-17 05:21 AM
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 .
2024-05-17 07:25 AM
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 */
}
2024-05-17 09:14 AM
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 */
}