cancel
Showing results for 
Search instead for 
Did you mean: 

Reduce FMC consumption current

alianvari
Associate III

I am using stm32l496, I want to use external memory CY62157EV30L, so I enable FMC in the CubeMx, but when I compile and run the project, a lot of current is consumed, about 4 mA, only with MX_FMC_Init(). how can I reduce this current?

HCLK is 2 MHz.

I attached FMC setting.

Thanks.

10 REPLIES 10

> only with MX_FMC_Init()

Step through that function and find out, at which moment does the consumption increase, that should give you a clue where is the problem.

Regardless of power consumption, does the external memory work properly?

JW

Yes, the external memory works well, but the current consumption is high.

Step through that function and find out, at which moment does the consumption increase, that should give you a clue where is the problem.

A lot of current is consumed when the I/O pins of the external memory that connected to the microcontroller FMC_D pins are inited by the microcontroller, ie in HAL_FMC_MspInit() a lot of current is consumed when the following code is executed.

/* GPIO_InitStruct */

 GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10 

             |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14 

             |GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1;

 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

 GPIO_InitStruct.Alternate = GPIO_AF12_FMC;

 HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

 /* GPIO_InitStruct */

 GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11 

             |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15 

             |GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5 

             |GPIO_PIN_7;

 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

 GPIO_InitStruct.Alternate = GPIO_AF12_FMC;

 HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

Danish1
Lead II

2mA is a lot of current if you're only clocking at 2 MHz. Is that with the stm32 accessing the external memory or not?

Are those pins (particularly the data pins) floating?

At what voltage (can you probe a data pin with a multimeter)?

Often stray capacitance will keep the pins reasonably close to Vdd or Vss, but if they are floating somewhere between those levels (particularly if you have termination resistors that keep the lines near mid-rail) then you will get class-A current consumed by any digital inputs - i.e. the stm32 data pins when they are inputs or sitting idle.

And any digital output will have to drive into the termination network, again drawing current but only during an FMC access.

As another observation, if HCLK stays at 2 MHz, I think you shouldn't be using GPIO_SPEED_FREQ_VERY_HIGH - that will lead to very sharp edges on digital outputs, causing EMC emissions.

Hope this helps,

Danish

Thank you for your help.

I connected the memory pins directly to the micro.

I have attached a schematic photo of the memory.

How are nCE1, CE2 and nWE, nOE, nBHE, nBLE of the memory connected to STM32? Did you measure signals on these pins using oscilloscope?

Is there any activity with the memory while measuring the current? Does the consumption include memory consumption? The memory has non-negligible consumption in mA range when active, see "Truth table" in the memory's datasheet.

JW

In the "Truth table" of memory, it is stated that in order for the memory to be in standby mode, pin nCE1 must be in the High state or pin CE2 must be in the Low state or nBHE and nBLE in High state.

I're just starting out with micro may you guide me in doing this.

thanks.

Connection as designed appears to be OK based on the piece of schematic you provided.

> In the "Truth table" of memory, it is stated that in order for the memory to be in standby mode,

> pin nCE1 must be in the High state or pin CE2 must be in the Low state or nBHE and nBLE in High state.

CE2 appears to be present only on the BGA version of the memory, you probably don't use that, do you.

Check the levels on the control pins, using oscilloscope/logic analyzer. Also make sure in program that nothing accesses the memory during current/signals measurement.

You may perhaps want to write a test program, which sets up FMC but then sets all control pins as GPIO output and to their idle state (high).

You have a ferrite bead in series of the memory power supply, so you can measure its current consumption - do that, so you know where those 4mA go, into mcu or into memory or elsewhere.

Also, check if all control connections are OK (no bad solder joints, no shorts).

JW