fferraro

USB: error in “Frame Number Register Low/High“

Discussion created by fferraro on Jun 25, 2008
Latest reply on Jul 4, 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 problems is:

 

1)  In the reference manual of the MCF52223 about chapter “16.4.1.17 Frame Number Register Low/High (FRM_NUML, FRM_NUMH)” the descriptor is errata. (it is the same of 16.4.1.16).

 

2) In the demo code CMX I have discovered a bug in this loop in subroutine “usb_host_start_transaction(..)” in the file “usb_host.c”

 

/* wait till frame is due */
    do {
      elapsed=(hcc_u16)(MCF_USB_FRM_NUM-my_device.eps[ep].last_due);
      elapsed &= ((1<<11)-1);
    } while(elapsed < my_device.eps[ep].interval);
   
    my_device.eps[ep].last_due += my_device.eps[ep].interval;
    my_device.eps[ep].last_due &= ((1<<11)-1);
   


 

It seems that the MCF_USB_FRM_NUM register, sometimes returns invalid values. So the elapsed time between two transactions may be less than desired , so the device stops working.

Any suggestion?

Outcomes