CMSIS GPIO driver - potential bug

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CMSIS GPIO driver - potential bug

470 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Marc Crandall on Wed Aug 03 14:13:01 MST 2011
Hello,

I wanted to let you know about a potential driver problem for the CMSIS GPIO LPC178x_8x.

In the file "lpc177x_8x_gpio.c"

I believe this function should be modified as follows. (Note the case 5 addition)

This took me a very long time to track down - hope this is useful to someone else.

(Note I sent this message to NXP support as well)

<code>
static LPC_GPIO_TypeDef *GPIO_GetPointer(uint8_t portNum)
{
LPC_GPIO_TypeDef *pGPIO = NULL;

switch (portNum)
{
case 0:
pGPIO = LPC_GPIO0;
break;

case 1:
pGPIO = LPC_GPIO1;
break;

case 2:
pGPIO = LPC_GPIO2;
break;

case 3:
pGPIO = LPC_GPIO3;
break;

case 4:
pGPIO = LPC_GPIO4;
break;

case 5:
pGPIO = LPC_GPIO5;
break;

default:
break;
}

return pGPIO;
}
</code>
Labels (1)
0 Kudos
3 Replies

379 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Marc Crandall on Wed Aug 17 13:14:00 MST 2011
Hi Dave,

If you have a second you should post this bug you found in the bug tracker system they have setup.  I've posted a few more there as well.

Marc
0 Kudos

379 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Mon Aug 08 12:46:20 MST 2011
As an FYI, you can also post these in the bug tracker at http://www.lpcware.com/node/add/ct-plus-task. Then they issue can be tracked and you'll know if/when the issue has been fixed.
0 Kudos

379 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Dave on Sun Aug 07 22:04:00 MST 2011
Here's another one to be aware of (I haven't contacted NXP to let them know):

File is SYSTEM_LPC177X_8X.C, line 406 reads as follows:
<code>
  if(LPC_SC->CLKSRCSEL & 0x01)//pll1_clk_in = main_osc
  USBClock = (OSC_CLK * ((LPC_SC->PLL1STAT & 0x1F) + 1));
  else //pll1_clk_in = irc_clk
  USBClock = (IRC_OSC * ((LPC_SC->PLL0STAT & 0x1F) + 1));
</code>

I believe it should be as follows:
<code>
  USBClock = (OSC_CLK * ((LPC_SC->PLL1STAT & 0x1F) + 1)) / __USB_DIV;
  else //pll1_clk_in = irc_clk
  USBClock = (IRC_OSC * ((LPC_SC->PLL0STAT & 0x1F) + 1)) / __USB_DIV;
</code>

where __USB_DIV is defined as follows (up around line 284):
<code>
#define __USB_DIV             (USBCLKSEL_Val & 0x1F)
</code>

Hope this helps,

0 Kudos