Skip to content

Commit

Permalink
Merge pull request #11402 from jeromecoutant/PR_USB_L4
Browse files Browse the repository at this point in the history
STM32L4 USB device
  • Loading branch information
0xc0170 authored Sep 4, 2019
2 parents c7c4819 + 55d60f3 commit 34109f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions targets/TARGET_STM/USBPhy_STM32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
{
USBPhyHw *priv = ((USBPhyHw *)(hpcd->pData));
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
uint32_t USBx_BASE = (uint32_t)USBx;
if (priv->sof_enabled) {
priv->events->sof((USBx_DEVICE->DSTS & USB_OTG_DSTS_FNSOF) >> 8);
}
Expand Down Expand Up @@ -249,6 +250,7 @@ void USBPhyHw::init(USBPhyEvents *events)
#elif defined(TARGET_NUCLEO_L496ZG) || \
defined(TARGET_NUCLEO_L496ZG_P) || \
defined(TARGET_DISCO_L496AG) || \
defined(TARGET_DISCO_L4R9I) || \
defined(TARGET_NUCLEO_L4R5ZI)
__HAL_RCC_GPIOA_CLK_ENABLE();
pin_function(PA_11, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_OTG_FS)); // DM
Expand Down Expand Up @@ -530,8 +532,10 @@ bool USBPhyHw::endpoint_write(usb_ep_t endpoint, uint8_t *data, uint32_t size)

void USBPhyHw::endpoint_abort(usb_ep_t endpoint)
{
#ifndef TARGET_STM32L4
HAL_StatusTypeDef ret = HAL_PCD_EP_Abort(&hpcd, endpoint);
MBED_ASSERT(ret == HAL_OK);
#endif
}

void USBPhyHw::process()
Expand Down
6 changes: 6 additions & 0 deletions targets/targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -4329,6 +4329,7 @@
"TRNG",
"FLASH",
"QSPI",
"USBDEVICE",
"MPU"
],
"release_versions": ["2", "5"],
Expand Down Expand Up @@ -4400,6 +4401,7 @@
"TRNG",
"FLASH",
"QSPI",
"USBDEVICE",
"MPU"
],
"release_versions": ["2", "5"],
Expand Down Expand Up @@ -7984,6 +7986,7 @@
"TRNG",
"FLASH",
"MPU",
"USBDEVICE",
"QSPI"
],
"release_versions": ["2", "5"],
Expand Down Expand Up @@ -8024,6 +8027,7 @@
"SERIAL_ASYNCH",
"TRNG",
"FLASH",
"USBDEVICE",
"MPU"
],
"release_versions": ["2", "5"],
Expand Down Expand Up @@ -8068,6 +8072,7 @@
"SERIAL_ASYNCH",
"TRNG",
"FLASH",
"USBDEVICE",
"MPU"
],
"release_versions": ["2", "5"],
Expand Down Expand Up @@ -8119,6 +8124,7 @@
"TRNG",
"FLASH",
"QSPI",
"USBDEVICE",
"MPU"
],
"release_versions": ["2", "5"],
Expand Down

0 comments on commit 34109f0

Please sign in to comment.