2023-05-22 06:56 PM - edited 2023-11-20 04:52 AM
I want to know how to show how to use the energy harvesting feature based on the ST25DV-I2C-04K in combination with an STM32L476 MCU.I have noticed that there is a code named EH energy collection, can you power L476 to make it run normally?
void MX_NFC7_EH_Init(void)
{
ST25DVxxKC_EN_STATUS_E value_eh_dyn;
ST25DVxxKC_EH_MODE_STATUS_E value_eh_mode;
/* Configuration of X-NUCLEO-NFC07A1 */
/******************************************************************************/
/* Init of the Leds on X-NUCLEO-NFC07A1 board */
NFC07A1_LED_Init(GREEN_LED );
NFC07A1_LED_Init(BLUE_LED );
NFC07A1_LED_Init(YELLOW_LED );
NFC07A1_LED_On( GREEN_LED );
HAL_Delay( 300 );
NFC07A1_LED_On( BLUE_LED );
HAL_Delay( 300 );
NFC07A1_LED_On( YELLOW_LED );
HAL_Delay( 300 );
/* Init ST25DVxxKC driver */
while( NFC07A1_NFCTAG_Init(NFC07A1_NFCTAG_INSTANCE) != NFCTAG_OK );
/* Init User button to allow user to change EH configuration */
BSP_PB_Init( BUTTON_KEY, BUTTON_MODE_GPIO );
/* Init done */
NFC07A1_LED_Off( GREEN_LED );
HAL_Delay( 300 );
NFC07A1_LED_Off( BLUE_LED );
HAL_Delay( 300 );
NFC07A1_LED_Off( YELLOW_LED );
HAL_Delay( 300 );
/* Check status of Energy Harvesting static configuration */
NFC07A1_NFCTAG_ReadEHMode(NFC07A1_NFCTAG_INSTANCE, &value_eh_mode );
if( value_eh_mode == ST25DVXXKC_EH_ACTIVE_AFTER_BOOT )
{
/* Energy Harvesting is set after each boot, LED 1 is on */
NFC07A1_LED_On( GREEN_LED );
}
else
{
/* Energy Harvesting is reset after each boot, LED 1 is off */
NFC07A1_LED_Off( GREEN_LED );
}
/* Check status of Energy Harvesting static configuration */
NFC07A1_NFCTAG_GetEHENMode_Dyn(NFC07A1_NFCTAG_INSTANCE, &value_eh_dyn );
if( value_eh_dyn == ST25DVXXKC_DISABLE )
{
/* Energy Harvesting is disabled, LED 2 is on */
NFC07A1_LED_Off( BLUE_LED );
}
else
{
/* Energy Harvesting is activated, LED 2 is on */
NFC07A1_LED_On( BLUE_LED );
}
}
/**
* @brief Process of the NFC7 EH application
* @retval None
*/
void MX_NFC7_EH_Process(void)
{
ST25DVxxKC_PASSWD_t passwd;
ST25DVxxKC_EN_STATUS_E value_eh_dyn;
ST25DVxxKC_EH_MODE_STATUS_E value_eh_mode;
ST25DVxxKC_I2CSSO_STATUS_E i2csso;
uint32_t tick_start;
uint32_t tick_end;
/*Detect button press*/
if(BSP_PB_GetState( BUTTON_KEY ) == BUTTON_PRESSED)
{
tick_start = HAL_GetTick();
/* Debouncing */
HAL_Delay(50);
do
{
tick_end = HAL_GetTick();
} while ((BSP_PB_GetState( BUTTON_KEY ) == BUTTON_PRESSED) && (tick_end - tick_start) <= 1000);
if((tick_end - tick_start) > 1000)
{
/* Long Button press */
/* Wait until the button is released */
while ((BSP_PB_GetState( BUTTON_KEY ) == BUTTON_PRESSED));
/* Debouncing */
HAL_Delay(50);
/* When user button is released after 1s, toggle Energy Harvesting static configuration */
/* You need to present password to change static configuration */
NFC07A1_NFCTAG_ReadI2CSecuritySession_Dyn(NFC07A1_NFCTAG_INSTANCE, &i2csso );
if( i2csso == ST25DVXXKC_SESSION_CLOSED )
{
/* if I2C session is closed, present password to open session */
passwd.MsbPasswd = 0;
passwd.LsbPasswd = 0;
NFC07A1_NFCTAG_PresentI2CPassword(NFC07A1_NFCTAG_INSTANCE, passwd );
}
/* Toggle static configuration */
NFC07A1_NFCTAG_ReadEHMode(NFC07A1_NFCTAG_INSTANCE, &value_eh_mode );
if( value_eh_mode == ST25DVXXKC_EH_ACTIVE_AFTER_BOOT )
{
/* Let the user activate energy harvesting */
value_eh_mode = ST25DVXXKC_EH_ON_DEMAND;
NFC07A1_NFCTAG_WriteEHMode(NFC07A1_NFCTAG_INSTANCE, value_eh_mode );
NFC07A1_LED_Off( GREEN_LED );
}
else
{
/* Energy harvesting activated after Power On Reset */
value_eh_mode = ST25DVXXKC_EH_ACTIVE_AFTER_BOOT;
NFC07A1_NFCTAG_WriteEHMode(NFC07A1_NFCTAG_INSTANCE, value_eh_mode );
NFC07A1_LED_On( GREEN_LED );
}
}
else
{
/* Short Button press */
/* Button already released */
/* Debouncing */
HAL_Delay(50);
/* When user button is pressed, toggle Energy Harvesting dynamic configuration */
NFC07A1_NFCTAG_GetEHENMode_Dyn(NFC07A1_NFCTAG_INSTANCE, &value_eh_dyn );
if( value_eh_dyn == ST25DVXXKC_DISABLE )
{
/* Enable energy harvesting */
NFC07A1_NFCTAG_SetEHENMode_Dyn(NFC07A1_NFCTAG_INSTANCE);
NFC07A1_LED_On( BLUE_LED );
}
else
{
/* Disable energy harvesting */
NFC07A1_NFCTAG_ResetEHENMode_Dyn(NFC07A1_NFCTAG_INSTANCE);
NFC07A1_LED_Off( BLUE_LED );
}
}
}
}
#ifdef __cplusplus
}
#endif
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Solved! Go to Solution.
2023-06-20 02:32 AM
Hello,
I think 47.1mW could be too much power, and you also have to add the power requiered by the STM32.
If you look at the curves in the application note a I recommended in a previous post, you can see that EH will not deliver more than 30mW in best conditions.
But I think the best is for you to try. Maybe the MAX6675 is consuming less than the 47mW (this may be a maximum in some high temp conditions).
Best regards.
2023-05-24 12:38 AM
Hello,
Yes, it would be possible to power a STM32L476, but with some conditions.
ST25DV is able to deliver at best 20mW of EH, and only in best conditions.
Best conditions means a good coupling between readers antenna and tag antenna (larger antennas are better). The reader need to be powerful enough (don't expect to do this with a smartphone, a dedicated reader is needed like ST25R3911 or ST25R3916).
Usually, a tank capacitor of a few uF helps a lot with current surge peak.
The STM32 must be configured to consume the less power possible and Vdd should be as low as possible (1.8V is ok).
Best regards.
2023-05-24 11:21 PM
Hi,@JL. Lebon_O
At first, thank you for your answer.I'm a beginner and I want to know what the EH example code means. I want use X-Nucleo-NFC07A1 to continuously power STM32L476RG MCU without pressing buttons,so I must set the energy harvesting mode to dynamic to keep the MCU working,what should I do?
2023-05-25 12:20 AM
Hello,
There are two modes for EH:
EH on boot means that the power will be delivered on the VEH pin as soon as the ST25DV is powered by the reader (assuming the reader is delivering enough power for both the ST25DV and the external device). It is started automatically and requires no action.
EH on demand means that power is delivered on the VEH pin only when enabled by a command (write in a dynamic register). It is a temporary setting (needs to be re-enabled after each boot).
In your case if you don't want to press any button, you would probably go for EH on boot.
In the code, it is also called "EH static configuration". If you long press the button, it should activate EH at boot. This setting is no-volatile, so once it is done, it will resist to reboots.
Best regards.
2023-05-25 06:44 AM
Hi,@JL. Lebon_O
Like you said, if I wanted the power will be delivered on the VEH pin as soon as the ST25DV is powered by the reader,I only need to press the button for more than 1 second, will it activate EH continuously and make STM32L4 work?
Best regards
2023-05-27 06:45 PM
As far as I know, the EH initialization function contains two modes, which need buttons to switch. I want to know which button is the key, and then how to judge which mode of energy collection is currently in?
2023-05-29 01:35 AM
Hi @帅 罗,
What you want is just activate the EH at boot which will deliver EH on VEH pin, to do that you just have to reset the EH_MODE register. Please have a look on the Datasheet to understand this feature.
To do that you have 2 possibilities, by RF command or through I²C bus.
The code example proposed with the NFC7 package uses the button to demonstrate both state for the EH MODE (static or dynamic), you can use only one configuration for your purpose:
For example this part is sufficient for what you want to do :
/* You need to present password to change static configuration */
NFC07A1_NFCTAG_ReadI2CSecuritySession_Dyn(NFC07A1_NFCTAG_INSTANCE, &i2csso );
if( i2csso == ST25DVXXKC_SESSION_CLOSED )
{
/* if I2C session is closed, present password to open session */
passwd.MsbPasswd = 0;
passwd.LsbPasswd = 0;
NFC07A1_NFCTAG_PresentI2CPassword(NFC07A1_NFCTAG_INSTANCE, passwd );
}
/* Energy harvesting activated after Power On Reset */
value_eh_mode = ST25DVXXKC_EH_ACTIVE_AFTER_BOOT;
NFC07A1_NFCTAG_WriteEHMode(NFC07A1_NFCTAG_INSTANCE, value_eh_mode );
As it is a static register you need to do it only once to activate this feature until you change it (Of course for new tags you'll need to perform again this configuration to activate it).
I hope this can help you.
Kind Regards.
2023-05-30 09:00 PM
Hi,@Rene Lenerve
I understand what you mean,and please help me point out which button I need to press to activate RF power supply mode, so that EH function can power STM32L476RG.
Kind Regards.
2023-05-31 12:26 AM
Hi @帅 罗,
If you run the example on the STM32L476 nucleo board and NFC07 expansion board, you will have the information with the Green Led and Blue Led. If the Green Led is on it means the EH is always available even after a Power ON. If the Green Led is off the EH is only available when the blue Led is on.
To activate the EH at boot (Green Led on), press the User button (blue button) on the Nucleo STM32L476 board for more than 2 seconds.
To activate the EH on demand only (Blue Led on), press the User button (blue button) on the Nucleo STM32L476 board for less than 2 seconds.
Another way to check is to read the EH_MODE register, through I²C or through RF (Smartphone).
I hope this will help you.
Kind Regards.
2023-05-31 04:52 AM
Hi,@Rene Lenerve
OK,So do I need to use wire to connect EH in ST1? I noticed that the blue button in STM32 is named B1, how does he control the switch between EH functions?
Kind Regards.