AnsweredAssumed Answered

excess NAK for USB enumeration for BF525

Question asked by xingsing on Aug 8, 2012
Latest reply on Aug 15, 2012 by xingsing

I am coding firmware for BF525, for a USB in peripheral mode and encountered a problem at the very start - i am now using the default USB driver because of memory constraints.

At USB enumeration, when viewing with USB analyzer, I can see that GetDescriptor and SetAddress operations are success, but after BF525 sends the correct descriptor or ACK the SetAddress, there are lots of NAK (over 100k). And the enumeration is broken after the SetAddress - from the analyzer there is lots of incomplete GetDescriptor. I wonder if there is something wrong with my implementations.

 

Here are my initialization:

     *pUSB_INTRUSBE  =0x26;    //  RESUME_BE, RESET_BE, DISCON_BE

    *pUSB_INTRTXE = 0;//0xff;    // reset value

    *pUSB_INTRRXE = 0;//0xfe;    // reset value

    *pUSB_INDEX = 0;    // access ENDPOINt 0

   

    *pUSB_TX_MAX_PACKET = 32;

    *pUSB_RX_MAX_PACKET = 32;

    *pUSB_TXCSR = 0;

    *pUSB_RXCSR = 0;

   

    *pUSB_EP_NI0_RXMAXP = 64;

    *pUSB_EP_NI0_TXMAXP = 64;

 

    *pUSB_POWER = 0x60;    // enable High speed mode and soft connection mode

    *pUSB_GLOBAL_CTL = 0x805;    // GLOBAL_ENA (USB Enable), enable EP4_Rx and EP2_Tx

 

 

register_handler(ik_ivg10, USB_Setup_ISR);

    register_handler(ik_ivg12, USB_Rx_ISR);

    register_handler(ik_ivg13, USB_Tx_ISR);   

    *pSIC_IWR1 |= (IRQ_USB_INT0 | IRQ_USB_INT1 | IRQ_USB_INT2);

    *pSIC_IMASK1 |= (IRQ_USB_INT0 | IRQ_USB_INT1 | IRQ_USB_INT2);

 

The setup sequence is got through IVG10:

 

unsigned short status = *pUSB_CSR0;

unsigned short sttus2 = *pUSB_INTRUSB;

*pUSB_INTRUSB = status2;

unsigned short l = *pUSB_COUNT0;

int i;

unsigned short buf[64];

for (i=0; i<l/2; i++)

     buf[i] = *pUSB_EP0_FIFO;

ssync();

*pUSB_CSR0 |= (SERVICED_RXPKTRDY | DATAEND);

ssync();

if ( (buf[0] & 0xfc) == 0x80 && (buf[0] >> 8) == 0x06)

{

     SendSetupDescriptor(buf[1] >> 8);

} else

if ( (buf[0] & 0xfc) == 0 && (buf[0] >> 8) == 0x05)

{

*pUSB_FADDR = buf[1];

}

...

 

Through ICE I found that I only got two types of incoming interrupt, one is Get descriptor and the other is SetAddress

 

Thanks in advance.

Attachments

Outcomes