Is there a know issue with USB ClearFeature and the DATA0 toggle?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is there a know issue with USB ClearFeature and the DATA0 toggle?

757 Views
marcbunyard
Contributor IV

I am using the K20 with MQX Lite and Processor Expert, and I'm having a problem with the USB CLEAR FEATURE command.  The command is a CLEAR FEATURE (Endpoint Halt, Endpoint 1 IN).  After this command is handled, the DATA0/1 toggle is uneffected.  When I look at the code, and the documentation, there is a mismatch.  I've tried setting the DATA0/1 bit instead of clearing since the description of the bit is the last setting of this bit.  I have also used the value 0x40 for USB1_BD_LE_DATA1.  Nothing changes the behavior of the DATA0/1 bit when view with the USB analyzer.

K20P100M72SF1RM.pdf

BufferDescriptorFormat.png

Processor Expert USBX.c

...

#define USB1_BD_LE_DATA1                          0x40000000U

#define USB1_BD_LE_STALL                          0x04000000U

...

void USB1_DeviceUnstallEndpoint(LDD_TDeviceData *DeviceDataPtr, uint8_t EpNum, uint8_t EpDir)
{
  USB1_TDeviceData                *DevDataPtr = (USB1_TDeviceData*)DeviceDataPtr;
  USB1_TEpData                    *EpDataPtr;
  USB1_TBD                        *BDPtr;

  USB1_UsbLock(DevDataPtr);
  EpDataPtr = &DevDataPtr->EpData[((uint32_t)EpNum << 0x01U)]; /* Get address of EPx data structure */
  if (EpDataPtr->TransferType == LDD_USB_CONTROL) {         /* Control EP? */
    (EpDataPtr + 1)->EpState = (USB1_TePState)((uint32_t)((EpDataPtr +1 )->EpState) & ~(uint32)USB1_EP_STALLED);
  } else {
    if (EpDir != LDD_USB_DIR_OUT) {
      EpDataPtr++;
    }
    BDPtr = EpDataPtr->BDPtr;
   
    BDPtr->CtrlReg &= ~(USB1_BD_LE_STALL | USB1_BD_LE_DATA1); /* UNSTALL ODD BD entry, set data toggle to DATA0 */
   (++BDPtr)->CtrlReg &= ~(USB1_BD_LE_STALL | USB1_BD_LE_DATA1); /* UNSTALL EVEN BD entry, set data toggle to DATA0 */

  }
  EpDataPtr->EpState = (USB1_TePState)((uint32_t)(EpDataPtr->EpState) & ~(uint32)USB1_EP_STALLED);
  USB1_UsbUnlock(DevDataPtr);
}

0 Kudos
2 Replies

460 Views
marek_neuzil
NXP Employee
NXP Employee

Hello,

thank you for reporting this issue. We are analyzing the problem now because it seems that there is an error. We will inform you about the resolution.

Best Regards,

Marek Neuzil

0 Kudos

460 Views
marcbunyard
Contributor IV

I just received a response from the technical service request that said that I should move to the KSDK USB stack.  There is a suggestion to set the DTS bit along with clearing of the DATA0/1 bit, but when I tried that, it still had problems. 

0 Kudos