fferraro

Coldfire - USB in Host mode problems TOKEN BUSY

Discussion created by fferraro on Jun 11, 2008
Latest reply on Jun 25, 2008 by fferraro

I am using CodeWarrior 6.3 C Compiler for Coldfire MCF52223 on the Freescale M52223EVB Development board. I need to use the processor USB interface in Host mode. My software is based on the CMX routines (Host Demo) downloaded from Freescale Web Site.

 

My problem is specifically:

 

I wait till pending tokens are processed, checking the bit 5 of the MCF_USB_CTL register (IPSBAR Offset 0x1C0094) ( bit5 = MCF_USB_CTL_TXDSUSPEND_TOKBUSY) before starting reset signaling (MCF_USB_CTL |= MCF_USB_CTL_RESET) or before writing any tokens to the Token Register (IPSBAR Offest 0x1C00A8), but sometimes this bit5 does not clear.

 

#define DSC_BUG 0                in the project and this is the code:

 

#if DSC_BUG == 0

  while(MCF_USB_CTL & MCF_USB_CTL_TXDSUSPEND_TOKBUSY)

  {

    if (MCF_USB_INT_STAT & MCF_USB_INT_STAT_USB_RST)

    {

      MCF_USB_CTL &= ~MCF_USB_CTL_TXDSUSPEND_TOKBUSY;

      break;

    }

  }

#endif

 

Changing the setting in the Target panel in the sheet “Code Generation” I get different behaviours and the program stops in different modes and in different subroutines.

I think I have some problems related to Compiler optimizations:
depending on the optimization level it seems that the same C source code works well or not, and sometimes it stops.

 

Any suggestion?

 

I have tried the CodeWarrior 7 C Compiler but I do not found any differences.

Outcomes