Hi!
in a system with MCF52259+MQX+MFS+USB HOST if an error occurs when installing my usb mass storage I want ro reinit the usb system without reset my hardware. How can I do?
When my system detecting an usb mass storage if usb_filesystem_install fails I want to reinit the usb stack without reset my board so I can restarting with an usb attach event. Is there an usb register to write or an MQX function for this purpose?
Thank in advance for any suggestions.
解決済! 解決策の投稿を見る。
/* Reset USB peripheral */
reg_ptr->USBOTG.USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
/* Wait while resetting */
while (reg_ptr->USBOTG.USBTRC0 & USB_USBTRC0_USBRESET_MASK)
{}
There is one issue. MCF5225 does not support USB peripheral reset, this code is from MCF51MM.
The next thing is to switch off and switch on Vbus, look at: _bsp_usb_io_init in gpio_init.c, you have there:
//reg_ptr->GPIO.PORTUA |= MCF5225_GPIO_PORTxP3; // turn Vbus off
Un-comment it.
/* Reset USB peripheral */
reg_ptr->USBOTG.USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
/* Wait while resetting */
while (reg_ptr->USBOTG.USBTRC0 & USB_USBTRC0_USBRESET_MASK)
{}
There is one issue. MCF5225 does not support USB peripheral reset, this code is from MCF51MM.
The next thing is to switch off and switch on Vbus, look at: _bsp_usb_io_init in gpio_init.c, you have there:
//reg_ptr->GPIO.PORTUA |= MCF5225_GPIO_PORTxP3; // turn Vbus off
Un-comment it.