lpcware

usb WDH interrupt not always happening

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
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

Outcomes