USB serial on stm32-h407 newbie
Posted: Fri Mar 01, 2013 7:26 pm
Hi,
I am trying to get a serial over usb connection on a stm32-h407 board on the usb micro connector (port OTG_HS).
I started with the demo ARMCM4-STM32F407-LWIP-FATFS-USB since that is for a very similar board (stm32-E407).
In the demo the usb serial is on port OTG_FS so I went ahead and switched the port in use in mcuconf.h
#define STM32_USB_USE_OTG1 FALSE
#define STM32_USB_USE_OTG2 TRUE
and then in main.c I set the usb driver to USBD2
static const SerialUSBConfig serusbcfg = {
&USBD2
};
After this changes the code seems to lock in
static void otg_core_reset(USBDriver *usbp) {
stm32_otg_t *otgp = usbp->otg;
/* Core reset and delay of at least 3 PHY cycles.*/
otgp->GRSTCTL = GRSTCTL_CSRST;
while ((otgp->GRSTCTL & GRSTCTL_CSRST) != 0) <------------------------- here
;
halPolledDelay(12);
/* Wait AHB idle condition.*/
while ((otgp->GRSTCTL & GRSTCTL_AHBIDL) == 0)
;
}
Am I forgetting to change any other board specific setting?
(the schematics of the usb port in question looks identical on the two boards)
Any suggestion about where I should start looking?
cheers
Renzo
I am trying to get a serial over usb connection on a stm32-h407 board on the usb micro connector (port OTG_HS).
I started with the demo ARMCM4-STM32F407-LWIP-FATFS-USB since that is for a very similar board (stm32-E407).
In the demo the usb serial is on port OTG_FS so I went ahead and switched the port in use in mcuconf.h
#define STM32_USB_USE_OTG1 FALSE
#define STM32_USB_USE_OTG2 TRUE
and then in main.c I set the usb driver to USBD2
static const SerialUSBConfig serusbcfg = {
&USBD2
};
After this changes the code seems to lock in
static void otg_core_reset(USBDriver *usbp) {
stm32_otg_t *otgp = usbp->otg;
/* Core reset and delay of at least 3 PHY cycles.*/
otgp->GRSTCTL = GRSTCTL_CSRST;
while ((otgp->GRSTCTL & GRSTCTL_CSRST) != 0) <------------------------- here
;
halPolledDelay(12);
/* Wait AHB idle condition.*/
while ((otgp->GRSTCTL & GRSTCTL_AHBIDL) == 0)
;
}
Am I forgetting to change any other board specific setting?
(the schematics of the usb port in question looks identical on the two boards)
Any suggestion about where I should start looking?
cheers
Renzo