usb WDH interrupt not always happening

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

usb WDH interrupt not always happening

1,941 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alager on Tue Aug 19 20:52:14 MST 2014
We have a project that copies a file from a USB flash drive on an lpc1768.  On some builds the copy goes fine, no issues.  But then on other builds, with minor changes to other unrelated modules, the WDH interrupt is not happening.
And then we can make mods to yet other modules, and then we DO get the interrupt.  It's very strange.

We are using the stack written by NXP, Ravikanth.P.

When the issue shows up we are sitting in this while loop forever:
void  Host_WDHWait (void)
{
  while (!HOST_WdhIntr) {
    ;
  }
  HOST_WdhIntr = 0;
}



More information:
I found that adding back modCounter to EINT3_IRQHandler(), even when not
referenced in the code, it increases bss use by 4 bytes and allows the WDH interrupt
to happen, but if I remove it, then we never get the interrupt!
void EINT3_IRQHandler( void )
{
static unsigned int modCounter; // <-- removing this causes the WDH interrupt to never happen

//Make sure the falling edge for p0[17] sent us here
if( LPC_GPIOINT->IO0IntStatF & (1ul << 17ul ) )
{
gMeterCounter++;

//pulse meter 1
LPC_GPIOINT->IO0IntClr |=  (1ul << 17ul );//clear the interrupt flag
}
else
if( LPC_GPIOINT->IO0IntStatF & (1ul << 25ul ) )
{
//pulse meter2
LPC_GPIOINT->IO0IntClr |=  (1ul << 25ul );//clear the interrupt flag
}
}


I've attached the map file of each build, I don't understand how this "harmless" change can affect the USB module like this.

Thank you for any help you can give,

Aaron

Original Attachment has been moved to: wo-modCounter.txt.zip

Original Attachment has been moved to: w-modCounter.txt.zip

标签 (1)
0 项奖励
回复
7 回复数

1,725 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alager on Thu Sep 04 08:25:17 MST 2014
As a follow up, I did comparisons with the versions that did work, with the version that did not work.  The only thing I could find was that the memory from alloc ( for the usb buffers), was on an 8 byte boundary for the one that fails.  The two that work were both on 16 byte boundaries.  So I added some code to align the memory to 16 byte boundaries, and that seems to have fixed it.
The weird part is that looking through the lpcopen code, it appears to be aligned on 4 byte boundaries, so I'm not sure if this will totally fix my issue, but it is for now, until things fail again.


Aaron
0 项奖励
回复

1,725 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alager on Wed Aug 27 10:34:36 MST 2014
No one else has faced this issue?
0 项奖励
回复

1,725 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ezharkov on Thu Aug 21 09:44:45 MST 2014
What I'm using is based on one of the pre-lpcopen releases (lpc177x_8x\Drivers\source\lpc177x_8x_usbhost.c). They don't seem to have a similar file for lpc175x_6x. But my guess is that it is pretty much the same thing as what you are using.

(I have not personally seen the problem myself yet. Everything seemed to work just fine for me. Both on LPC1788 and on an LPC176x. But another developer noticed a problem on an LPC1788 and it looked very similar to what you describe. I.e., slight changes to seemingly unrelated parts of the code would make the problem show up or go away.)
0 项奖励
回复

1,725 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alager on Thu Aug 21 09:19:21 MST 2014
Are you using the same USB stack, from the cmsis2 examples?  Or are you using the open lpc example?  I'm looking at using the new open plc version, they were release in early this year.  maybe they're better? 
But it still seems odd since it's the hardware module that is not behaving correctly.
0 项奖励
回复

1,725 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ezharkov on Wed Aug 20 10:50:20 MST 2014
We also have a project (LPC1788) in which we sometimes do not get a WDH interrupt. Therefore, I'd like to hear what you find out.
0 项奖励
回复

1,725 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alager on Wed Aug 20 08:43:30 MST 2014
yes it is:
volatile  USB_INT32U   HOST_WdhIntr  = 0;         /* Semaphore to wait until the TD is submitted            */
0 项奖励
回复

1,725 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wmues on Wed Aug 20 04:01:46 MST 2014
Is HOST_WdhIntr declared "volatile"?

regards
Wolfgang
0 项奖励
回复