Abnormally high LPCXpresso current consumption - 75 mA !?

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

Abnormally high LPCXpresso current consumption - 75 mA !?

601 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Dmitry on Fri Apr 13 03:14:47 MST 2012
Hi everyone,
I have separated the programming and microcontroller parts of the LPCXpresso with LPC1769, and trying to power the later from a battery-powered switching supply at 3.3V.

However when I measure current consumption its 75 mA, even with just a while(1) loop, running at 40 MHz. Even when I keep the micro in reset, the current consumption goes down to 25 mA which is still very high - what else could be consuming current on the board? Ethernet chip?

I connect the 3.3V supply to pin J6-28 of the board ("top right" corner)

Unfortunately I have already soldered the board underneath another PCB so can't even get to probe it :-(

Has anyone had similar experience or measured the current consumption of the board? (and I mean just the microcontroller half)?

Thanks!!!
0 Kudos
12 Replies

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Dmitry on Sat Apr 14 17:39:13 MST 2012
Great big thank you Zero!

Indeed, current consumption is much lower now, down to 30 mA in my case. Still on the high side but I can live with that.

So that's the 40 mA difference right there!

CONCLUSION: LAN8720 ON LPCXPRESSO BOARD WILL CONSUME 40 mA EVEN WHEN IT IS IDLE!!!
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Apr 14 12:18:11 MST 2012

Quote: dmitry
Do you mind attaching/emailing me code the relevant files (EMAC.c and EMAC.h)?



OMG Attaching :mad: I've to delete a few things first, my MB is full already :rolleyes:

OK, here it is -working with CMSIS2.0 and LPCXpresso 4.2.2. Consuming 55mA at 100MHz or 8mA at 12MHz :eek:
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Dmitry on Sat Apr 14 11:23:08 MST 2012
Believe it or not, the code of this file is completely different for me, even though I've imported it from that exact zip file. Also it says its for CS8900 and not LAN8720... Plus, it seems to be written for an older/different version of CMSIS.
Also, when I include it in the workspace it seems to re-define some of the peripheral definitions so the rest of my code breaks...

Do you mind attaching/emailing me code the relevant files (EMAC.c and EMAC.h)?

Thank you


I mean look how different it is:

  /* Power Up the EMAC controller. */
  LPC_SC->PCONP |= (0x1<<30);
  
  LPC_PINCON->PINSEL2 = 0x50150105;
#if MDC_MDIO_WORKAROUND
  /* LPC175x devices, use software MII management. */  
  LPC_PINCON->PINSEL4 &= ~0x000F0000;
  LPC_GPIO2->FIODIR |= MDC;
#else
  LPC_PINCON->PINSEL3 &= ~0x0000000F;
  LPC_PINCON->PINSEL3 |= 0x00000005;
#endif

  /* Reset all EMAC internal modules. */
  LPC_EMAC->MAC1 = MAC1_RES_TX | MAC1_RES_MCS_TX | MAC1_RES_RX | MAC1_RES_MCS_RX |
             MAC1_SIM_RES | MAC1_SOFT_RES;
  LPC_EMAC->Command = CR_REG_RES | CR_TX_RES | CR_RX_RES;

  /* A short delay after reset. */
  for (tout = 100; tout; tout--);

  /* Initialize MAC control registers. */
  LPC_EMAC->MAC1 = MAC1_PASS_ALL;
  LPC_EMAC->MAC2 = MAC2_CRC_EN | MAC2_PAD_EN;
  LPC_EMAC->MAXF = ETH_MAX_FLEN;
  LPC_EMAC->CLRT = CLRT_DEF;
  LPC_EMAC->IPGR = IPGR_DEF;

  /* Enable Reduced MII interface. */
  LPC_EMAC->Command = CR_RMII | CR_PASS_RUNT_FRM;

  /* Reset Reduced MII Logic. */
  LPC_EMAC->SUPP = SUPP_RES_RMII;
  for (tout = 100; tout; tout--);
  LPC_EMAC->SUPP = 0;

  /* Put the DP83848C in reset mode */
  write_PHY (PHY_REG_BMCR, 0x8000);

  /* Wait for hardware reset to end. */
  for (tout = 0; tout < 0x100000; tout++) {
    regv = read_PHY (PHY_REG_BMCR);
    if (!(regv & 0x8000)) {
      /* Reset complete */
      break;
    }
  }

  /* Check if this is a DP83848C PHY. */
  id1 = read_PHY (PHY_REG_IDR1);
  id2 = read_PHY (PHY_REG_IDR2);
  if (((id1 << 16) | (id2 & 0xFFF0)) == DP83848C_ID) {
    /* Configure the PHY device */

    /* Use autonegotiation about the link speed. */
    write_PHY (PHY_REG_BMCR, PHY_AUTO_NEG);
    /* Wait to complete Auto_Negotiation. */
    for (tout = 0; tout < 0x100000; tout++) {
      regv = read_PHY (PHY_REG_BMSR);
      if (regv & 0x0020) {
        /* Autonegotiation Complete. */
        break;
      }
    }
  }

  /* Check the link status. */
  for (tout = 0; tout < 0x10000; tout++) {
    regv = read_PHY (PHY_REG_STS);
    if (regv & 0x0001) {
      /* Link is on. */
      break;
    }
  }

  /* Configure Full/Half Duplex mode. */
  if (regv & 0x0004) {
    /* Full duplex is enabled. */
    LPC_EMAC->MAC2    |= MAC2_FULL_DUP;
    LPC_EMAC->Command |= CR_FULL_DUP;
    LPC_EMAC->IPGT     = IPGT_FULL_DUP;
  }
  else {
    /* Half duplex mode. */
    LPC_EMAC->IPGT = IPGT_HALF_DUP;
  }

  /* Configure 100MBit/10MBit mode. */
  if (regv & 0x0002) {
    /* 10MBit mode. */
    LPC_EMAC->SUPP = 0;
  }
  else {
    /* 100MBit mode. */
    LPC_EMAC->SUPP = SUPP_SPEED;
  }

  /* Set the Ethernet MAC Address registers */
  LPC_EMAC->SA0 = (MYMAC_6 << 8) | MYMAC_5;
  LPC_EMAC->SA1 = (MYMAC_4 << 8) | MYMAC_3;
  LPC_EMAC->SA2 = (MYMAC_2 << 8) | MYMAC_1;

  /* Initialize Tx and Rx DMA Descriptors */
  rx_descr_init ();
  tx_descr_init ();

  /* Receive Broadcast and Perfect Match Packets */
  LPC_EMAC->RxFilterCtrl = RFC_BCAST_EN | RFC_PERFECT_EN;

  /* Enable EMAC interrupts. */
  LPC_EMAC->IntEnable = INT_RX_DONE | INT_TX_DONE;

  /* Reset all interrupts */
  LPC_EMAC->IntClear  = 0xFFFF;

  /* Enable receive and transmit mode of MAC Ethernet core */
  LPC_EMAC->Command  |= (CR_RX_EN | CR_TX_EN);
  LPC_EMAC->MAC1     |= MAC1_REC_EN;
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Apr 14 10:37:09 MST 2012
In LPCXpresso176x_cmsis2.zip samples there's a project LPCX176x_cmsis2_EasyWeb with ethmac.h / ethmac.c

In it's init you can init and power down your PHY:

void Init_EthMAC(void)
{
  unsigned int value;
  volatile unsigned int loop;
  // Set Ethernet power/clock control bit
  LPC_SC->PCONP |= PCENET; 
  //Enable Ethernet pins through PINSEL registers
  LPC_PINCON->PINSEL2 = ENET_PINSEL2_CONFIG; 
  LPC_PINCON->PINSEL3 = (LPC_PINCON->PINSEL3 & ~(ENET_PINSEL3_MASK)) | ENET_PINSEL3_CONFIG;

  // Set up MAC Configuration Register 1
  LPC_EMAC->MAC1 = MAC1_RES_TX | MAC1_RES_MCS_TX | MAC1_RES_RX |
         MAC1_RES_MCS_RX |MAC1_SIM_RES | MAC1_SOFT_RES;
  // Set up MAC Command Register
  LPC_EMAC->Command = CR_REG_RES | CR_TX_RES | CR_RX_RES | CR_PASS_RUNT_FRM;
  // Short delay
  for (loop = 100; loop; loop--);
  // Set up MAC Configuration Register 1 to pass all receive frames
  LPC_EMAC->MAC1 = 0;// MAC1_PASS_ALL;
  // Set up MAC Configuration Register 2 to append CRC and pad out frames
  LPC_EMAC->MAC2 = MAC2_CRC_EN | MAC2_PAD_EN;
  // Set Ethernet Maximum Frame Register
  LPC_EMAC->MAXF = ETH_MAX_FLEN;
  // Set Collision Window / Retry Register
  LPC_EMAC->CLRT = CLRT_DEF;
  // Set Non Back-to-Back Inter-Packet-Gap Register
  LPC_EMAC->IPGR = IPGR_DEF;
/* Enable Reduced MII interface. */
  LPC_EMAC->MCFG = MCFG_CLK_DIV64 | MCFG_RES_MII;
  for (loop = 100; loop; loop--);
  LPC_EMAC->MCFG = MCFG_CLK_DIV64;
   // Set MAC Command Register to enable Reduced MII interface
   // and prevent runt frames being filtered out
  LPC_EMAC->Command = CR_RMII | CR_PASS_RUNT_FRM;// | CR_PASS_RX_FILT;
  // Put DP83848C PHY into reset mode
  WriteToPHY (PHY_REG_BMCR, 0x8000);
  // Loop until hardware reset completes
  for (loop = 0; loop < 0x100000; loop++) {
    value = ReadFromPHY (PHY_REG_BMCR);
    if (!(value & 0x8000)) {
      // Reset has completed
      break;
    }
  }
 [COLOR=Red] WriteToPHY (PHY_REG_BMCR, 1<<11);        //power down[/COLOR]
}
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Dmitry on Sat Apr 14 10:26:15 MST 2012

Quote:


  WriteToPHY (PHY_REG_BMCR, 1<<11);        //power down and save >40mA



Which project/file do I need to include to get this function? I've tried the EMAC and EASYWEB but I couldn't see it there...
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Sat Apr 14 02:42:28 MST 2012

Quote: Rob65
Kayoda should also have quoted this from my other post



I'm sorry, I was confused about calculating your experience :confused:

This is a your 2011 post:

Quote:

...and about 25 years of experience in embedded programming and hardware development.

So I wasn't aware that it's 30+ one year later. I must have overlooked leapyear last year :)
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Fri Apr 13 22:52:07 MST 2012
Has anyone actually measured on the LAN8720A chip?

Kayoda should also have quoted this from my other post:

Quote:

I have 30+ years of hands-on in hardware design and embedded systems programming


and from all this experience I know that datasheets are often right, but it might take some time trying to figure out how to reach this mode. The sensor chips that I was working on lately also consumes more power than I at first expected but then I figured out that I actually had to initialize the chip before it reached that low power mode.

Does anyone have access to a system where we could measure current consumption on the LAN8720A chip? It would be nice to see what it actually consumes in different modes.

Rob
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Fri Apr 13 12:10:03 MST 2012

Quote: Rob65
So I would not expect the LAN chip to consume that much power when not being used.



Don't expect :eek:


Quote:

You might be a good 'victim'  for testing out a "Programming microcontrollers for Dummies (using LPCXpresso)" :rolleyes:

0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Fri Apr 13 11:50:27 MST 2012

Quote: Zero
OK, I'll risk a second attempt:

[B][COLOR=Red]IT'S YOUR LAN8720A :eek:
[/COLOR][/B]
It doesn't care if you initialize it or not, it's consuming power :rolleyes:


Yet in your previous post you stated the LAN chip consumes 41 mA in 100 BASE-[B]TX mode/w TRAFFIC[/B]. This does make sense - the chip uses lots of power [B]with traffic[/B] (and 41 mA is even the min. value, max is specified as 49 mA) but in idle mode or in power down mode it takes way less current.
That is clearly written on the page just before the note that you quoted.

In power down (yes - the LAN chip can be placed in power down mode) the LAN8720A takes 2.3 mA (typical). So I would not expect the LAN chip to consume that much power when not being used.

Regards,
[INDENT]Rob
[/INDENT]
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Apr 13 10:57:41 MST 2012
OK, I'll risk a second attempt:

[B][COLOR=Red]IT'S YOUR LAN8720A :eek:
[/COLOR][/B]
It doesn't care if you initialize it or not, it's consuming power :rolleyes:

Either you solder it out or you initialize it and power it down

  WriteToPHY (PHY_REG_BMCR, 1<<11);        //power down and save >40mA
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Dmitry on Fri Apr 13 07:59:30 MST 2012
Well, there is absolutely nothing connected to it (Ethernet chip) and its not even initialised, so its certainly not operating in 100BASE_TX mode! Still, it does not explain the total power consumption. From LPC1769 datasheet its consumption should be around 15-20 mA at this clock speed.

Any ideas/contributions welcome!
0 Kudos

526 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Apr 13 05:15:17 MST 2012

Quote:
Ethernet chip?

Datasheet LAN8720A:

Quote:

Note: Current measurements do not include power applied to the magnetics or the optional external LEDs. The Ethernet component current is typically [COLOR=Red]41mA[/COLOR] in 100BASE-TX mode and 100mA in 10BASE-T mode, independent of the 2.5 or 3.3V supply rail of the transformer.

0 Kudos