This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5529 - USB - CDC Example C6 does not work as expected

Other Parts Discussed in Thread: MSP-EXP430F5529LP

Hi all,

I am currently debugging a prototype which uses the USB in CDC mode. The board is supposed to send data packets  over the USB of maximun 400 bytes every 20ms.

Trouble is that the 5529 USB controllers hangs after one to a few packets have been correctly sent, depending of the data packet size.

A trace of the USB activity shows that the controller abruptly stops sending data. On the firmware side, the routine

cdcSendDataInBackground returns constantly the busy state. I also tried

USBCDC_sendData() wite the same results : the bCDCDataSent_event event is no longer generated.

Tryting to get more insight into the cause of this weird behavior,  I tried example C6 of the USB developers package on a MSP-EXP430F5529LP, I was surprised to obtain the same result.

The demo is suppoded to send 500 packets of 2047bytes over the USB in CDC mode. The controller hangs after the 1st data packet is properly sent. The reception no longer works too, wich suggest that the USB controller might be disabled.

In both cases, the transmission seems reliable if data packets are sent much slower, e.g. a few packets per secondes.

I still have no clue about what cous cause such trouble. Any help would be much appreciated.

  • Hello,

    I am not able to re-produce your issue with the C6 example and the MSP-EXP430F5529LP.  Can you please give me more details?  Did you modify the C6 example in anyway?  Or the board?  Steps to re-produce your issue or code you used that dispalys your issue would be helpful.

    Regards,

    Arthi Bhat

     

  • Hello,

    Thank you for your reply.

    I have been able to have this C6 example working properly and subsequently my firmware too.

    I had to slightly modifiy T.I.USB library (the most recent one) because the MSP430's USB module output endpoint NAK bits were not cleared after the 1st received packet, bloccking the transaction on the bus.

    Solution :

    CdcToBufferFromHost() :  clear NAK bit of USBOEPBCTX_2  and NAK bit of USBOEPBCTY_2 (Output Endpoint 2) if there is no more data left.

    Code fragment :

    CdcToBufferFromHost (uint8_t intfNum) {     uint8_t * pEP1;     uint8_t nTmp1;     uint8_t bWakeUp = FALSE;                                                   //per default we do not wake up after interrupt     uint8_t edbIndex;

    edbIndex = stUsbHandle[intfNum].edb_Index;

      if (CdcReadCtrl[INTFNUM_OFFSET(intfNum)].nBytesToReceiveLeft == 0){     //do we have somtething to receive?         CdcReadCtrl[INTFNUM_OFFSET(intfNum)].pUserBuffer = NULL;            //no more receiving pending         if((USBOEPBCTX_2 & 0x80) != 0) 

    {          USBOEPBCTX_2 = USBOEPBCTX_2 & ~NAK;  // Clear not acknowledge bit !!!         }

            if((USBOEPBCTY_2 & 0x80) != 0)  

    {          USBOEPBCTY_2 = USBOEPBCTY_2 & ~NAK;  // Clear not acknowledge bit  !!!         }         return (bWakeUp);  

    }

    Furthermore, I added  a reset of the USBOEPIFG flag in the corresponding interrupt service routine :

    UsbIsr.c :

     case USBVECINT_OUTPUT_ENDPOINT2:

     USBOEPIFG = USBOEPIFG & 0xFB;   // Clear Interrupt

    .....

    because I was not sure this flag is systematically cleared by the hardware. The USB module documentation is not that clear about this question.

     

    With these modifcations, we have no more trouble with the USB transactions. We could achieve the projected data rate with zero ttrouble.

     

  • Glad you solved your issue.  

    Regards,

    Arthi Bhat

**Attention** This is a public forum