From 0320ebc1d8f4becec9ef2f0ce39d240753fbd04a Mon Sep 17 00:00:00 2001 From: George Beckstein Date: Sat, 19 Jan 2019 14:44:35 -0500 Subject: [PATCH] Removed 0 max packet size assert for ISO endpoints. Ensured usbd_ep_abort would not be called on ISO endpoints (this currently causes an ASSERT in the Nordic driver --- .../TARGET_MCU_NRF52840/USBPhy_Nordic.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/usb/device/targets/TARGET_NORDIC/TARGET_MCU_NRF52840/USBPhy_Nordic.cpp b/usb/device/targets/TARGET_NORDIC/TARGET_MCU_NRF52840/USBPhy_Nordic.cpp index e50fec1147..acaf719ac2 100644 --- a/usb/device/targets/TARGET_NORDIC/TARGET_MCU_NRF52840/USBPhy_Nordic.cpp +++ b/usb/device/targets/TARGET_NORDIC/TARGET_MCU_NRF52840/USBPhy_Nordic.cpp @@ -119,6 +119,15 @@ void USBPhyHw::init(USBPhyEvents *events) { // Store a reference to this instance instance = this; + /* + * TODO - Configure ISOIN endpoint to respond with ZLP when + * no data is ready to be sent + * + * This is a feature available in the Nordic SDK15.2 + * For now we just configure the appropriate register on initialization + */ + NRF_USBD->ISOINCONFIG |= 0x01; // set RESPONSE to 1 (respond with ZLP) + // Enable IRQ NVIC_SetVector(USBD_IRQn, (uint32_t)USBD_IRQHandler); //NVIC_SetPriority(USBD_IRQn, 7); @@ -396,7 +405,10 @@ bool USBPhyHw::endpoint_write(usb_ep_t endpoint, uint8_t *data, uint32_t size) { } void USBPhyHw::endpoint_abort(usb_ep_t endpoint) { - nrf_drv_usbd_ep_abort(get_nordic_endpoint(endpoint)); + nrf_drv_usbd_ep_t nrf_ep = get_nordic_endpoint(endpoint); + // Don't call abort on ISO endpoints -- this will cause an ASSERT in the Nordic driver + if(nrf_ep != NRF_DRV_USBD_EPOUT8 && nrf_ep != NRF_DRV_USBD_EPIN8) + nrf_drv_usbd_ep_abort(nrf_ep); } void USBPhyHw::process() {