GrumpyOldPizza / ArduinoCore-stm32l0

Arduino Core for STM32L0
125 stars 67 forks source link

I Nucleo LRWAN1 standalone. #31

Closed pbecchi closed 6 years ago

pbecchi commented 6 years ago

I am new to STM32 world! But I am interested to port a Sprinkler controller SW to USI Lorawan module.

The code is now written for Arduino uno and a Semteck module. I think that using your core library , porting should be easy. Now I don't use LORAWAN but point to point RadioHead library to communicate between modules. I can probably move to LORAWAN or port the RadioHead library to STM32...booth are valid alternatives!

To have a good low power profile is a must.I have now an average drain of 500uA. To minimize power I need to use the I NUCLEO LRWAN1 as a standalone unit, final device will be based upon USI module.

GrumpyOldPizza commented 6 years ago

I-NUCLEO-LRWAN1 is not supported. STM32L052 has not enough FLASH or SRAM for a LoRaWAN stack and an application. Hence there is no point of supporting the USI Module at this point.

On Fri, Aug 10, 2018, 11:21 AM pbecchi notifications@github.com wrote:

I am new to STM32 world! But I am interested to port a Sprinkler controller SW to USI Lorawan module.

The code is now written for Arduino uno and a Semteck module. I think that using your core library , porting should be easy. Now I don't use LORAWAN but point to point RadioHead library to communicate between modules. I can probably move to LORAWAN or port the RadioHead library to STM32...booth are valid alternatives!

To have a good low power profile is a must.I have now an average drain of 500uA. To minimize power I need to use the I NUCLEO LRWAN1 as a standalone unit, final device will be based upon USI module.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfDBg4y84qwBBn9uCveldvnkOJS54ks5uPVCVgaJpZM4V33bN .

pbecchi commented 6 years ago

Thanks for your fast and clear answer! Anyhow, since my first instance is to use RadioHead library and the actual application fit in an Arduino Uno, I should be able to use your core (or the STM official one) without the use of LoraWAN libraries.

Am I right?

GrumpyOldPizza commented 6 years ago

I really have no idea. We are about to release a library that allows direct LoRa communication similar to RadioHead. But that is based off the internal SX1272/SX1276 driver that is also in use for LoRaWAN. It's also not complicated to make that all work on the USI module, there is just not enough FLASH/SRAM to do anything but have a hardcoded AT-Modem command set.

Please note that the soul of this Arduino Core is low power and LoRaWAN, as well as USB CDC, HID & MSC support. So there is a certain bias to have a solid feature set, which comes at a FLASH/SRAM consumption price. That does not compare in any way to a Arduino Uno.

Last time I checked, the USI module was more expensive than the Murata module. Is there any specific reason (technical) to use the USI module ?

On Fri, Aug 10, 2018 at 6:29 AM, pbecchi notifications@github.com wrote:

Thanks for your fast and clear answer! Anyhow, since my first instance is to use RadioHead library and the actual application fit in an Arduino Uno, I should be able to use your core (or the ATM official one) without the use of LoraWAN libraries.

Am I right?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-412067667, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfNIJQRya8iDCeVa_Jk0DcPM_KZh9ks5uPXyXgaJpZM4V33bN .

pbecchi commented 6 years ago

Thanks again..... I will investigate your suggestion on Murata module......the only reason for thinking to the USI one was because I had this breakout board (I NUCLEO LRWAN1)available!
Do you know of any cheap breakout board with the Murata module?

I never used before the STM32 arduino core, therefore I have no experience on the "core" minimum flash size. Of course on a Uno, a small point to point Lora example will be around 10K ,but with other cores will be quite different.... Coming to LORAWAN i have another question : my application is basically a server that listen and execute incoming commands. I use a so called LoRa CAD mode, where the MCU wake up every 500ms to check incoming messages. For this kind of use LORAWAN class A seems not to be the right choice.

Is class B available right now? Is class C usable for a battery powered device? Or I have any other choice?

GrumpyOldPizza commented 6 years ago

Can we take this discussion offline ?

grumpyoldpizza@gmail.com

On Sat, Aug 11, 2018, 1:58 AM pbecchi notifications@github.com wrote:

Thanks again..... I will investigate your suggestion on Murata module......the only reason for thinking to the USI one was because I had this breakout board (I NUCLEO LRWAN1)available! Do you know of any cheap breakout board with the Murata module?

I never used before the STM32 arduino core, therefore I have no experience on the "core" minimum flash size. Of course on a Uno, a small point to point Lora example will be around 10K ,but with other cores will be quite different.... Coming to LORAWAN i have another question : my application is basically a server that listen and execute incoming commands. I use a so called LoRa CAD mode, where the MCU wake up every 500ms to check incoming messages. For this kind of use LORAWAN class A seems not to be the right choice.

Is class B available right now? Is class C usable for a battery powered device? Or I have any other choice?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-412259033, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfLrycRyO6xKDMdz7Pf20x0X3Xu0nks5uPo6LgaJpZM4V33bN .

pbecchi commented 5 years ago

Hi Thomas Happy New Year! I have finally a working example of a LoRa point to point CAD receiver. The power drain in Cad mode is highly reduced, but not enought! I have to learn better how to work with low power sleep mode of STM32L0xx, i havent found any documentation and i am spending a lot of time trying the various stm32l0_sleep() parameters. Can you tell me any place where i can find documentation on various stm32l0_system.h and stm32l0_rtc.h routines ?

Thanks

Paolo

---- On lun, 13 ago 2018 15:11:58 +0200 notifications@github.com wrote ----

Closed #31.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

There is no documentation ... my weak point.

You should not use the system layer directly. Especially as that part is likely to change.

The concept of the current code is actually half way simple:

define STM32L0_SYSTEM_POLICY_NONE 0

define STM32L0_SYSTEM_POLICY_RUN 1

define STM32L0_SYSTEM_POLICY_SLEEP 2

define STM32L0_SYSTEM_POLICY_STOP 3

extern uint32_t stm32l0_system_policy(uint32_t policy); extern void stm32l0_system_sleep(uint32_t policy, uint32_t timeout); extern void stm32l0_system_wakeup(void);

So with stm32l0_system_policy() you set a system wide policy (STM32L0_SYSTEM_POLICY_NONE is used to just return the current one). It defines really what the max sleep state is the system can enter. Default is STOP, but for debugging, or for segments of code where you want to trade of latency vs. power you might want to use SLEEP. The "policy" parameter you pass into stm32l0_system_sleep() along with your system policy is what decides when you currently intend to use. So basically the min out of both. If one says SLEEP and the other says STOP, it will pick SLEEP. The "timeout" is simple millisconds timeout, which is routed essentially throu the RTC WAKEUP timer logic (not fully proper, as the limit is 2^17 seconds).

Now to the key routine, stm32l0_system_wakeup(). STM32L0 can wakeup from STOP more or less just like from SLEEP. So if you have a ISR attached to a GPIO, it will wake up internally in both cases. But you don't really want to have your application code woken up all the time. Another good example is the SX1276/LoRaWAN code, where SX1276 might switch the TCXO on, while your app wants to sleep. No reason to wake it up before SX1276 is done with RX/TX. The sleep()/wakeup() logic is simple. "wakeup()" sets a 1 bit flag, and "sleep()" clears it. If it is set at the beginning of "sleep()", or during "sleep()" (say by an ISR fireing), then "sleep()" returns.

Internally stm32l0_system_sleep() can cycle throu a sequence of SLEEP / STOP, depending upon internal state. Suppose you have a I2C transaction in the background. Then STM32L0 cannot enter STOP mode. So it stays in SLEEP mode, till the transaction is done. If the transaction callback decides to call stm32l0_system_wakeup(), then stm32l0_system_sleep() returns, otherwise it just might enter STOP mode. As you can see with this example, the I2C ISR internally might fire a bunch of times before the the transaction callback gets called.

All of this at the moment is exposed via STM32L0.sleep() and STM32L0.stop(). The plan is to move this into a more abstract "LowPower" class, and have the STM32L0.stop() API only really do STOP mode, and just return with a "false" if STOP mode was not possible.

The "LowPower" class right now might look like this:

LowPower.enablePowerSave(); LowPower.disablePowerSave(); LowPower.wait(); LowPower.sleep(timeout); LowPower.wakeup(); LowPower.deepSleep(timeout);

Idea is that "::wait()" is a wrapper for "WFE" (plus WARs for STM32L4). "::enablePowerSave()" will per default enable STOP mode for "::sleep()" and "delay()", while "::disablePowerSave()" will only allow SLEEP mode for "::sleep()" and "delay()". "::deepSleep()" will bypass that and always try to go into STOP mode.

I do like this naming way better, as mostly there is no such a thing as SLEEP or STOP, but dozens of variants (FLASH powered on/off, SRAM powered on/off ... STOP0/STOP1/STOP2 for STM32L4). So in reality what you say is that you really want to trade off latency for power or not. The system then needs to decide how to achieve that picking the best settings in a given scenario.

Hope that helped, or confused enough ...

pbecchi commented 5 years ago

Thanks Thomas

I believe I have understood most of your explanations…..I hope!

But this is power consumption I get from a using stm32l0_systems_sleep :

          stm32l0_system_sleep(0, 5000);         //0.75 mA
Serial.println("Wake 5s sleep 0");
stm32l0_system_sleep(1, 5000);          //1.39mA
Serial.println("Wake 5s sleep 1");
stm32l0_system_sleep(3, 5000);          //0.75mA
Serial.println("Wake 5s sleep 3");
stm32l0_system_sleep(2, 5000);          //0.85mA
Serial.println("Wake 5s sleep 2");

This is not the current i was expecting to read, what I may be doing wrong?

Paolo

Sent from Mail for Windows 10

From: Thomas Roell Sent: giovedì 24 gennaio 2019 14:26 To: GrumpyOldPizza/ArduinoCore-stm32l0 Cc: pbecchi; Author Subject: Re: [GrumpyOldPizza/ArduinoCore-stm32l0] I Nucleo LRWAN1 standalone.(#31)

There is no documentation ... my weak point. You should not use the system layer directly. Especially as that part is likely to change. The concept of the current code is actually half way simple:

define STM32L0_SYSTEM_POLICY_NONE 0

define STM32L0_SYSTEM_POLICY_RUN 1

define STM32L0_SYSTEM_POLICY_SLEEP 2

define STM32L0_SYSTEM_POLICY_STOP 3

extern uint32_t stm32l0_system_policy(uint32_t policy); extern void stm32l0_system_sleep(uint32_t policy, uint32_t timeout); extern void stm32l0_system_wakeup(void); So with stm32l0_system_policy() you set a system wide policy (STM32L0_SYSTEM_POLICY_NONE is used to just return the current one). It defines really what the max sleep state is the system can enter. Default is STOP, but for debugging, or for segments of code where you want to trade of latency vs. power you might want to use SLEEP. The "policy" parameter you pass into stm32l0_system_sleep() along with your system policy is what decides when you currently intend to use. So basically the min out of both. If one says SLEEP and the other says STOP, it will pick SLEEP. The "timeout" is simple millisconds timeout, which is routed essentially throu the RTC WAKEUP timer logic (not fully proper, as the limit is 2^17 seconds). Now to the key routine, stm32l0_system_wakeup(). STM32L0 can wakeup from STOP more or less just like from SLEEP. So if you have a ISR attached to a GPIO, it will wake up internally in both cases. But you don't really want to have your application code woken up all the time. Another good example is the SX1276/LoRaWAN code, where SX1276 might switch the TCXO on, while your app wants to sleep. No reason to wake it up before SX1276 is done with RX/TX. The sleep()/wakeup() logic is simple. "wakeup()" sets a 1 bit flag, and "sleep()" clears it. If it is set at the beginning of "sleep()", or during "sleep()" (say by an ISR fireing), then "sleep()" returns. Internally stm32l0_system_sleep() can cycle throu a sequence of SLEEP / STOP, depending upon internal state. Suppose you have a I2C transaction in the background. Then STM32L0 cannot enter STOP mode. So it stays in SLEEP mode, till the transaction is done. If the transaction callback decides to call stm32l0_system_wakeup(), then stm32l0_system_sleep() returns, otherwise it just might enter STOP mode. As you can see with this example, the I2C ISR internally might fire a bunch of times before the the transaction callback gets called. All of this at the moment is exposed via STM32L0.sleep() and STM32L0.stop(). The plan is to move this into a more abstract "LowPower" class, and have the STM32L0.stop() API only really do STOP mode, and just return with a "false" if STOP mode was not possible. The "LowPower" class right now might look like this: LowPower.enablePowerSave(); LowPower.disablePowerSave(); LowPower.wait(); LowPower.sleep(timeout); LowPower.wakeup(); LowPower.deepSleep(timeout); Idea is that "::wait()" is a wrapper for "WFE" (plus WARs for STM32L4). "::enablePowerSave()" will per default enable STOP mode for "::sleep()" and "delay()", while "::disablePowerSave()" will only allow SLEEP mode for "::sleep()" and "delay()". "::deepSleep()" will bypass that and always try to go into STOP mode. I do like this naming way better, as mostly there is no such a thing as SLEEP or STOP, but dozens of variants (FLASH powered on/off, SRAM powered on/off ... STOP0/STOP1/STOP2 for STM32L4). So in reality what you say is that you really want to trade off latency for power or not. The system then needs to decide how to achieve that picking the best settings in a given scenario. Hope that helped, or confused enough ... — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

What is your CPU speed ?

What other components on the board are powered ?

On Thu, Jan 24, 2019 at 11:38 AM pbecchi notifications@github.com wrote:

Thanks Thomas

I believe I have understood most of your explanations…..I hope!

But this is power consumption I get from a using stm32l0_systems_sleep :

stm32l0_system_sleep(0, 5000); //0.75 mA Serial.println("Wake 5s sleep 0"); stm32l0_system_sleep(1, 5000); //1.39mA Serial.println("Wake 5s sleep 1"); stm32l0_system_sleep(3, 5000); //0.75mA Serial.println("Wake 5s sleep 3"); stm32l0_system_sleep(2, 5000); //0.85mA Serial.println("Wake 5s sleep 2");

This is not the current i was expecting to read, what I may be doing wrong?

Paolo

Sent from Mail for Windows 10

From: Thomas Roell Sent: giovedì 24 gennaio 2019 14:26 To: GrumpyOldPizza/ArduinoCore-stm32l0 Cc: pbecchi; Author Subject: Re: [GrumpyOldPizza/ArduinoCore-stm32l0] I Nucleo LRWAN1 standalone.(#31)

There is no documentation ... my weak point. You should not use the system layer directly. Especially as that part is likely to change. The concept of the current code is actually half way simple:

define STM32L0_SYSTEM_POLICY_NONE 0

define STM32L0_SYSTEM_POLICY_RUN 1

define STM32L0_SYSTEM_POLICY_SLEEP 2

define STM32L0_SYSTEM_POLICY_STOP 3

extern uint32_t stm32l0_system_policy(uint32_t policy); extern void stm32l0_system_sleep(uint32_t policy, uint32_t timeout); extern void stm32l0_system_wakeup(void); So with stm32l0_system_policy() you set a system wide policy (STM32L0_SYSTEM_POLICY_NONE is used to just return the current one). It defines really what the max sleep state is the system can enter. Default is STOP, but for debugging, or for segments of code where you want to trade of latency vs. power you might want to use SLEEP. The "policy" parameter you pass into stm32l0_system_sleep() along with your system policy is what decides when you currently intend to use. So basically the min out of both. If one says SLEEP and the other says STOP, it will pick SLEEP. The "timeout" is simple millisconds timeout, which is routed essentially throu the RTC WAKEUP timer logic (not fully proper, as the limit is 2^17 seconds). Now to the key routine, stm32l0_system_wakeup(). STM32L0 can wakeup from STOP more or less just like from SLEEP. So if you have a ISR attached to a GPIO, it will wake up internally in both cases. But you don't really want to have your application code woken up all the time. Another good example is the SX1276/LoRaWAN code, where SX1276 might switch the TCXO on, while your app wants to sleep. No reason to wake it up before SX1276 is done with RX/TX. The sleep()/wakeup() logic is simple. "wakeup()" sets a 1 bit flag, and "sleep()" clears it. If it is set at the beginning of "sleep()", or during "sleep()" (say by an ISR fireing), then "sleep()" returns. Internally stm32l0_system_sleep() can cycle throu a sequence of SLEEP / STOP, depending upon internal state. Suppose you have a I2C transaction in the background. Then STM32L0 cannot enter STOP mode. So it stays in SLEEP mode, till the transaction is done. If the transaction callback decides to call stm32l0_system_wakeup(), then stm32l0_system_sleep() returns, otherwise it just might enter STOP mode. As you can see with this example, the I2C ISR internally might fire a bunch of times before the the transaction callback gets called. All of this at the moment is exposed via STM32L0.sleep() and STM32L0.stop(). The plan is to move this into a more abstract "LowPower" class, and have the STM32L0.stop() API only really do STOP mode, and just return with a "false" if STOP mode was not possible. The "LowPower" class right now might look like this: LowPower.enablePowerSave(); LowPower.disablePowerSave(); LowPower.wait(); LowPower.sleep(timeout); LowPower.wakeup(); LowPower.deepSleep(timeout); Idea is that "::wait()" is a wrapper for "WFE" (plus WARs for STM32L4). "::enablePowerSave()" will per default enable STOP mode for "::sleep()" and "delay()", while "::disablePowerSave()" will only allow SLEEP mode for "::sleep()" and "delay()". "::deepSleep()" will bypass that and always try to go into STOP mode. I do like this naming way better, as mostly there is no such a thing as SLEEP or STOP, but dozens of variants (FLASH powered on/off, SRAM powered on/off ... STOP0/STOP1/STOP2 for STM32L4). So in reality what you say is that you really want to trade off latency for power or not. The system then needs to decide how to achieve that picking the best settings in a given scenario. Hope that helped, or confused enough ... — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457308364, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfPBaJ6To6l5oh8S3CsxshcYeJAMZks5vGf2UgaJpZM4V33bN .

pbecchi commented 5 years ago

I haven t set cpu speed. I dont know how to change it! I use an I NUCLEO LRWAN1 all jumpers dusconnected. This is before LoraRadio.init, so i guess lora transeiver shoud not draw any current. Thanks Paolo

---- On gio, 24 gen 2019 19:48:29 +0100 notifications@github.com wrote ----

What is your CPU speed ?

What other components on the board are powered ?

On Thu, Jan 24, 2019 at 11:38 AM pbecchi notifications@github.com wrote:

Thanks Thomas

I believe I have understood most of your explanations…..I hope!

But this is power consumption I get from a using stm32l0_systems_sleep :

stm32l0_system_sleep(0, 5000); //0.75 mA Serial.println("Wake 5s sleep 0"); stm32l0_system_sleep(1, 5000); //1.39mA Serial.println("Wake 5s sleep 1"); stm32l0_system_sleep(3, 5000); //0.75mA Serial.println("Wake 5s sleep 3"); stm32l0_system_sleep(2, 5000); //0.85mA Serial.println("Wake 5s sleep 2");

This is not the current i was expecting to read, what I may be doing wrong?

Paolo

Sent from Mail for Windows 10

From: Thomas Roell Sent: giovedì 24 gennaio 2019 14:26 To: GrumpyOldPizza/ArduinoCore-stm32l0 Cc: pbecchi; Author Subject: Re: [GrumpyOldPizza/ArduinoCore-stm32l0] I Nucleo LRWAN1 standalone.(#31)

There is no documentation ... my weak point. You should not use the system layer directly. Especially as that part is likely to change. The concept of the current code is actually half way simple:

define STM32L0_SYSTEM_POLICY_NONE 0

define STM32L0_SYSTEM_POLICY_RUN 1

define STM32L0_SYSTEM_POLICY_SLEEP 2

define STM32L0_SYSTEM_POLICY_STOP 3

extern uint32_t stm32l0_system_policy(uint32_t policy); extern void stm32l0_system_sleep(uint32_t policy, uint32_t timeout); extern void stm32l0_system_wakeup(void); So with stm32l0_system_policy() you set a system wide policy (STM32L0_SYSTEM_POLICY_NONE is used to just return the current one). It defines really what the max sleep state is the system can enter. Default is STOP, but for debugging, or for segments of code where you want to trade of latency vs. power you might want to use SLEEP. The "policy" parameter you pass into stm32l0_system_sleep() along with your system policy is what decides when you currently intend to use. So basically the min out of both. If one says SLEEP and the other says STOP, it will pick SLEEP. The "timeout" is simple millisconds timeout, which is routed essentially throu the RTC WAKEUP timer logic (not fully proper, as the limit is 2^17 seconds). Now to the key routine, stm32l0_system_wakeup(). STM32L0 can wakeup from STOP more or less just like from SLEEP. So if you have a ISR attached to a GPIO, it will wake up internally in both cases. But you don't really want to have your application code woken up all the time. Another good example is the SX1276/LoRaWAN code, where SX1276 might switch the TCXO on, while your app wants to sleep. No reason to wake it up before SX1276 is done with RX/TX. The sleep()/wakeup() logic is simple. "wakeup()" sets a 1 bit flag, and "sleep()" clears it. If it is set at the beginning of "sleep()", or during "sleep()" (say by an ISR fireing), then "sleep()" returns. Internally stm32l0_system_sleep() can cycle throu a sequence of SLEEP / STOP, depending upon internal state. Suppose you have a I2C transaction in the background. Then STM32L0 cannot enter STOP mode. So it stays in SLEEP mode, till the transaction is done. If the transaction callback decides to call stm32l0_system_wakeup(), then stm32l0_system_sleep() returns, otherwise it just might enter STOP mode. As you can see with this example, the I2C ISR internally might fire a bunch of times before the the transaction callback gets called. All of this at the moment is exposed via STM32L0.sleep() and STM32L0.stop(). The plan is to move this into a more abstract "LowPower" class, and have the STM32L0.stop() API only really do STOP mode, and just return with a "false" if STOP mode was not possible. The "LowPower" class right now might look like this: LowPower.enablePowerSave(); LowPower.disablePowerSave(); LowPower.wait(); LowPower.sleep(timeout); LowPower.wakeup(); LowPower.deepSleep(timeout); Idea is that "::wait()" is a wrapper for "WFE" (plus WARs for STM32L4). "::enablePowerSave()" will per default enable STOP mode for "::sleep()" and "delay()", while "::disablePowerSave()" will only allow SLEEP mode for "::sleep()" and "delay()". "::deepSleep()" will bypass that and always try to go into STOP mode. I do like this naming way better, as mostly there is no such a thing as SLEEP or STOP, but dozens of variants (FLASH powered on/off, SRAM powered on/off ... STOP0/STOP1/STOP2 for STM32L4). So in reality what you say is that you really want to trade off latency for power or not. The system then needs to decide how to achieve that picking the best settings in a given scenario. Hope that helped, or confused enough ... — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457308364, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfPBaJ6To6l5oh8S3CsxshcYeJAMZks5vGf2UgaJpZM4V33bN .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

That does not make sense then.

The default CPU clock is 32MHz. With that SLEEP mode has 1700mA. You are not seeing that.

I have never looked into the power consumption of the module on I-NUCLEO-LRWAN1, nor do I understand what other power consumers are on there (lie the analog RF switch).

On Thu, Jan 24, 2019 at 11:54 AM pbecchi notifications@github.com wrote:

I haven t set cpu speed. I dont know how to change it! I use an I NUCLEO LRWAN1 all jumpers dusconnected. This is before LoraRadio.init, so i guess lora transeiver shoud not draw any current. Thanks Paolo

---- On gio, 24 gen 2019 19:48:29 +0100 notifications@github.com wrote

What is your CPU speed ?

What other components on the board are powered ?

On Thu, Jan 24, 2019 at 11:38 AM pbecchi notifications@github.com wrote:

Thanks Thomas

I believe I have understood most of your explanations…..I hope!

But this is power consumption I get from a using stm32l0_systems_sleep :

stm32l0_system_sleep(0, 5000); //0.75 mA Serial.println("Wake 5s sleep 0"); stm32l0_system_sleep(1, 5000); //1.39mA Serial.println("Wake 5s sleep 1"); stm32l0_system_sleep(3, 5000); //0.75mA Serial.println("Wake 5s sleep 3"); stm32l0_system_sleep(2, 5000); //0.85mA Serial.println("Wake 5s sleep 2");

This is not the current i was expecting to read, what I may be doing wrong?

Paolo

Sent from Mail for Windows 10

From: Thomas Roell Sent: giovedì 24 gennaio 2019 14:26 To: GrumpyOldPizza/ArduinoCore-stm32l0 Cc: pbecchi; Author Subject: Re: [GrumpyOldPizza/ArduinoCore-stm32l0] I Nucleo LRWAN1 standalone.(#31)

There is no documentation ... my weak point. You should not use the system layer directly. Especially as that part is likely to change. The concept of the current code is actually half way simple:

define STM32L0_SYSTEM_POLICY_NONE 0

define STM32L0_SYSTEM_POLICY_RUN 1

define STM32L0_SYSTEM_POLICY_SLEEP 2

define STM32L0_SYSTEM_POLICY_STOP 3

extern uint32_t stm32l0_system_policy(uint32_t policy); extern void stm32l0_system_sleep(uint32_t policy, uint32_t timeout); extern void stm32l0_system_wakeup(void); So with stm32l0_system_policy() you set a system wide policy (STM32L0_SYSTEM_POLICY_NONE is used to just return the current one). It defines really what the max sleep state is the system can enter. Default is STOP, but for debugging, or for segments of code where you want to trade of latency vs. power you might want to use SLEEP. The "policy" parameter you pass into stm32l0_system_sleep() along with your system policy is what decides when you currently intend to use. So basically the min out of both. If one says SLEEP and the other says STOP, it will pick SLEEP. The "timeout" is simple millisconds timeout, which is routed essentially throu the RTC WAKEUP timer logic (not fully proper, as the limit is 2^17 seconds). Now to the key routine, stm32l0_system_wakeup(). STM32L0 can wakeup from STOP more or less just like from SLEEP. So if you have a ISR attached to a GPIO, it will wake up internally in both cases. But you don't really want to have your application code woken up all the time. Another good example is the SX1276/LoRaWAN code, where SX1276 might switch the TCXO on, while your app wants to sleep. No reason to wake it up before SX1276 is done with RX/TX. The sleep()/wakeup() logic is simple. "wakeup()" sets a 1 bit flag, and "sleep()" clears it. If it is set at the beginning of "sleep()", or during "sleep()" (say by an ISR fireing), then "sleep()" returns. Internally stm32l0_system_sleep() can cycle throu a sequence of SLEEP / STOP, depending upon internal state. Suppose you have a I2C transaction in the background. Then STM32L0 cannot enter STOP mode. So it stays in SLEEP mode, till the transaction is done. If the transaction callback decides to call stm32l0_system_wakeup(), then stm32l0_system_sleep() returns, otherwise it just might enter STOP mode. As you can see with this example, the I2C ISR internally might fire a bunch of times before the the transaction callback gets called. All of this at the moment is exposed via STM32L0.sleep() and STM32L0.stop(). The plan is to move this into a more abstract "LowPower" class, and have the STM32L0.stop() API only really do STOP mode, and just return with a "false" if STOP mode was not possible. The "LowPower" class right now might look like this: LowPower.enablePowerSave(); LowPower.disablePowerSave(); LowPower.wait(); LowPower.sleep(timeout); LowPower.wakeup(); LowPower.deepSleep(timeout); Idea is that "::wait()" is a wrapper for "WFE" (plus WARs for STM32L4). "::enablePowerSave()" will per default enable STOP mode for "::sleep()" and "delay()", while "::disablePowerSave()" will only allow SLEEP mode for "::sleep()" and "delay()". "::deepSleep()" will bypass that and always try to go into STOP mode. I do like this naming way better, as mostly there is no such a thing as SLEEP or STOP, but dozens of variants (FLASH powered on/off, SRAM powered on/off ... STOP0/STOP1/STOP2 for STM32L4). So in reality what you say is that you really want to trade off latency for power or not. The system then needs to decide how to achieve that picking the best settings in a given scenario. Hope that helped, or confused enough ... — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457308364 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfPBaJ6To6l5oh8S3CsxshcYeJAMZks5vGf2UgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457313922, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfDvnOK9Vc864elp8q94plE5kMVhnks5vGgFygaJpZM4V33bN .

GrumpyOldPizza commented 5 years ago

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

pbecchi commented 5 years ago

Ok thanks... I will trst tye way you suggest.

My multimeter is ok: it a long time i measure low power currents with Atmega 328 and with NRF52832. I also have a Nordic lowpower shield to measure current versus time.

I will be let you know soon... Thanks. Paolo

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote ----

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

pbecchi commented 5 years ago

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote ----

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN .

pbecchi commented 5 years ago

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote ----

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN .

pbecchi commented 5 years ago

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote ----

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN .

pbecchi commented 5 years ago

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote ----

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN .

pbecchi commented 5 years ago

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote ----

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

Could all be. You got the source. wmsgsm42-board.c is the file to mess around with.

On Fri, Jan 25, 2019 at 9:20 AM pbecchi notifications@github.com wrote:

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457627833, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfOnSZjZ_Y_4jKoWNwmrpp4Vq2c5Pks5vGy6wgaJpZM4V33bN .

pbecchi commented 5 years ago

Hi Thomas Is this routine called at startup? void WMSGSM42_Initialize( void ) { SX127xRadio = &SX1272Radio;

stm32l0_gpio_pin_configure(RADIO_NSS, (STM32L0_GPIO_PARK_HIZ | STM32L0_GPIO_PUPD_NONE | STM32L0_GPIO_OSPEED_HIGH | STM32L0_GPIO_OTYPE_PUSHPULL | STM32L0_GPIO_MODE_OUTPUT));
stm32l0_gpio_pin_write(RADIO_NSS, 1);

stm32l0_spi_create(&RADIO_SPI, &RADIO_SPI_PARAMS);
stm32l0_spi_enable(&RADIO_SPI);

SX1272Reset( );

}

Coud this be the reason?

Paolo

---- On ven, 25 gen 2019 17:48:39 +0100 notifications@github.com wrote ----

Could all be. You got the source. wmsgsm42-board.c is the file to mess around with.

On Fri, Jan 25, 2019 at 9:20 AM pbecchi notifications@github.com wrote:

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457627833, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfOnSZjZ_Y_4jKoWNwmrpp4Vq2c5Pks5vGy6wgaJpZM4V33bN .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

pbecchi commented 5 years ago

Thomas Just an update! The good news is that i took out the 2 0ohm resistors on power line of cpu and rf and used header to measure current there. The current is dropped from 750u to 150u ....it is evident that additional 600 drain come from I nucleo board and not from the module.

Good news since i am going to use just the modules on my application.... I have now a Cad receive mode that draw only 200uA average , about 50 times less that normal receive mode.

Thanks for your help Paolo

---- On ven, 25 gen 2019 17:48:39 +0100 notifications@github.com wrote ----

Could all be. You got the source. wmsgsm42-board.c is the file to mess around with.

On Fri, Jan 25, 2019 at 9:20 AM pbecchi notifications@github.com wrote:

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457627833, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfOnSZjZ_Y_4jKoWNwmrpp4Vq2c5Pks5vGy6wgaJpZM4V33bN .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

Which resistor ? I only see SB36 and SB37 in this path.

On Mon, Jan 28, 2019 at 1:27 AM pbecchi notifications@github.com wrote:

Thomas Just an update! The good news is that i took out the 2 0ohm resistors on power line of cpu and rf and used header to measure current there. The current is dropped from 750u to 150u ....it is evident that additional 600 drain come from I nucleo board and not from the module.

Good news since i am going to use just the modules on my application.... I have now a Cad receive mode that draw only 200uA average , about 50 times less that normal receive mode.

Thanks for your help Paolo

---- On ven, 25 gen 2019 17:48:39 +0100 notifications@github.com wrote

Could all be. You got the source. wmsgsm42-board.c is the file to mess around with.

On Fri, Jan 25, 2019 at 9:20 AM pbecchi notifications@github.com wrote:

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457627833 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfOnSZjZ_Y_4jKoWNwmrpp4Vq2c5Pks5vGy6wgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458036935, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfIW36BY1ajeE0BefyHO_x3wSA6Y1ks5vHrSMgaJpZM4V33bN .

pbecchi commented 5 years ago

Yes i have replaced r37 and r37 with 2 jumpers where i can measure current to Mcu amd to Rf.

---- On lun, 28 gen 2019 13:19:42 +0100 notifications@github.com wrote ----

Which resistor ? I only see SB36 and SB37 in this path.

On Mon, Jan 28, 2019 at 1:27 AM pbecchi notifications@github.com wrote:

Thomas Just an update! The good news is that i took out the 2 0ohm resistors on power line of cpu and rf and used header to measure current there. The current is dropped from 750u to 150u ....it is evident that additional 600 drain come from I nucleo board and not from the module.

Good news since i am going to use just the modules on my application.... I have now a Cad receive mode that draw only 200uA average , about 50 times less that normal receive mode.

Thanks for your help Paolo

---- On ven, 25 gen 2019 17:48:39 +0100 notifications@github.com wrote

Could all be. You got the source. wmsgsm42-board.c is the file to mess around with.

On Fri, Jan 25, 2019 at 9:20 AM pbecchi notifications@github.com wrote:

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi notifications@github.com wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457627833 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfOnSZjZ_Y_4jKoWNwmrpp4Vq2c5Pks5vGy6wgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458036935, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfIW36BY1ajeE0BefyHO_x3wSA6Y1ks5vHrSMgaJpZM4V33bN .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

Ok, 3rd attempt. Put in our loop only "STM32L0.stop()" (and #include "STM32L0.h"). And measure then.

On Mon, Jan 28, 2019 at 5:59 AM pbecchi notifications@github.com wrote:

Yes i have replaced r37 and r37 with 2 jumpers where i can measure current to Mcu amd to Rf.

---- On lun, 28 gen 2019 13:19:42 +0100 notifications@github.com wrote

Which resistor ? I only see SB36 and SB37 in this path.

On Mon, Jan 28, 2019 at 1:27 AM pbecchi notifications@github.com wrote:

Thomas Just an update! The good news is that i took out the 2 0ohm resistors on power line of cpu and rf and used header to measure current there. The current is dropped from 750u to 150u ....it is evident that additional 600 drain come from I nucleo board and not from the module.

Good news since i am going to use just the modules on my application.... I have now a Cad receive mode that draw only 200uA average , about 50 times less that normal receive mode.

Thanks for your help Paolo

---- On ven, 25 gen 2019 17:48:39 +0100 notifications@github.com wrote

Could all be. You got the source. wmsgsm42-board.c is the file to mess around with.

On Fri, Jan 25, 2019 at 9:20 AM pbecchi notifications@github.com wrote:

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi < notifications@github.com> wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457627833

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfOnSZjZ_Y_4jKoWNwmrpp4Vq2c5Pks5vGy6wgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458036935 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfIW36BY1ajeE0BefyHO_x3wSA6Y1ks5vHrSMgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458121627, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfHhp-WMiD_-j9gsL8E9ysDkGCVTlks5vHvQ-gaJpZM4V33bN .

pbecchi commented 5 years ago

I have tested as you suggest and measuring at the Mcu jumper with STM32L0.sleep() 193 uA with STM32L0.stop() 1.5 uA. If i measure at the board 3.3v input still get previous high reading. Just for my understanding ...how do i match sleep stop or stm32l0_system_sleep first parameter (0 to 3) to the low power modes of this table in the attachement?

---- On lun, 28 gen 2019 16:07:16 +0100 notifications@github.com wrote ----

Ok, 3rd attempt. Put in our loop only "STM32L0.stop()" (and #include "STM32L0.h"). And measure then.

On Mon, Jan 28, 2019 at 5:59 AM pbecchi notifications@github.com wrote:

Yes i have replaced r37 and r37 with 2 jumpers where i can measure current to Mcu amd to Rf.

---- On lun, 28 gen 2019 13:19:42 +0100 notifications@github.com wrote

Which resistor ? I only see SB36 and SB37 in this path.

On Mon, Jan 28, 2019 at 1:27 AM pbecchi notifications@github.com wrote:

Thomas Just an update! The good news is that i took out the 2 0ohm resistors on power line of cpu and rf and used header to measure current there. The current is dropped from 750u to 150u ....it is evident that additional 600 drain come from I nucleo board and not from the module.

Good news since i am going to use just the modules on my application.... I have now a Cad receive mode that draw only 200uA average , about 50 times less that normal receive mode.

Thanks for your help Paolo

---- On ven, 25 gen 2019 17:48:39 +0100 notifications@github.com wrote

Could all be. You got the source. wmsgsm42-board.c is the file to mess around with.

On Fri, Jan 25, 2019 at 9:20 AM pbecchi notifications@github.com wrote:

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi notifications@github.com wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi < notifications@github.com> wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457627833

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfOnSZjZ_Y_4jKoWNwmrpp4Vq2c5Pks5vGy6wgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458036935 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfIW36BY1ajeE0BefyHO_x3wSA6Y1ks5vHrSMgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458121627, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfHhp-WMiD_-j9gsL8E9ysDkGCVTlks5vHvQ-gaJpZM4V33bN .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

Please do not use the system layer for now. It will change due to other requirements.

1.3uA is not that bad ;-)

On Mon, Jan 28, 2019 at 10:41 AM pbecchi notifications@github.com wrote:

I have tested as you suggest and measuring at the Mcu jumper with STM32L0.sleep() 193 uA with STM32L0.stop() 1.5 uA. If i measure at the board 3.3v input still get previous high reading. Just for my understanding ...how do i match sleep stop or stm32l0_system_sleep first parameter (0 to 3) to the low power modes of this table in the attachement?

---- On lun, 28 gen 2019 16:07:16 +0100 notifications@github.com wrote

Ok, 3rd attempt. Put in our loop only "STM32L0.stop()" (and #include "STM32L0.h"). And measure then.

On Mon, Jan 28, 2019 at 5:59 AM pbecchi notifications@github.com wrote:

Yes i have replaced r37 and r37 with 2 jumpers where i can measure current to Mcu amd to Rf.

---- On lun, 28 gen 2019 13:19:42 +0100 notifications@github.com wrote

Which resistor ? I only see SB36 and SB37 in this path.

On Mon, Jan 28, 2019 at 1:27 AM pbecchi notifications@github.com wrote:

Thomas Just an update! The good news is that i took out the 2 0ohm resistors on power line of cpu and rf and used header to measure current there. The current is dropped from 750u to 150u ....it is evident that additional 600 drain come from I nucleo board and not from the module.

Good news since i am going to use just the modules on my application.... I have now a Cad receive mode that draw only 200uA average , about 50 times less that normal receive mode.

Thanks for your help Paolo

---- On ven, 25 gen 2019 17:48:39 +0100 notifications@github.com wrote

Could all be. You got the source. wmsgsm42-board.c is the file to mess around with.

On Fri, Jan 25, 2019 at 9:20 AM pbecchi notifications@github.com wrote:

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi < notifications@github.com> wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi < notifications@github.com> wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457627833

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfOnSZjZ_Y_4jKoWNwmrpp4Vq2c5Pks5vGy6wgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458036935

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfIW36BY1ajeE0BefyHO_x3wSA6Y1ks5vHrSMgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458121627 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfHhp-WMiD_-j9gsL8E9ysDkGCVTlks5vHvQ-gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458229282, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfOPIWTz0iaIQgLOTdLQ5K20_crKFks5vHzZHgaJpZM4V33bN .

pbecchi commented 5 years ago

Thomas Any advice to reduce flash size of the code.....i am a little over 64k!

Thanks

Paolo

---- On lun, 28 gen 2019 18:53:22 +0100 notifications@github.com wrote ----

Please do not use the system layer for now. It will change due to other requirements.

1.3uA is not that bad ;-)

On Mon, Jan 28, 2019 at 10:41 AM pbecchi notifications@github.com wrote:

I have tested as you suggest and measuring at the Mcu jumper with STM32L0.sleep() 193 uA with STM32L0.stop() 1.5 uA. If i measure at the board 3.3v input still get previous high reading. Just for my understanding ...how do i match sleep stop or stm32l0_system_sleep first parameter (0 to 3) to the low power modes of this table in the attachement?

---- On lun, 28 gen 2019 16:07:16 +0100 notifications@github.com wrote

Ok, 3rd attempt. Put in our loop only "STM32L0.stop()" (and #include "STM32L0.h"). And measure then.

On Mon, Jan 28, 2019 at 5:59 AM pbecchi notifications@github.com wrote:

Yes i have replaced r37 and r37 with 2 jumpers where i can measure current to Mcu amd to Rf.

---- On lun, 28 gen 2019 13:19:42 +0100 notifications@github.com wrote

Which resistor ? I only see SB36 and SB37 in this path.

On Mon, Jan 28, 2019 at 1:27 AM pbecchi notifications@github.com wrote:

Thomas Just an update! The good news is that i took out the 2 0ohm resistors on power line of cpu and rf and used header to measure current there. The current is dropped from 750u to 150u ....it is evident that additional 600 drain come from I nucleo board and not from the module.

Good news since i am going to use just the modules on my application.... I have now a Cad receive mode that draw only 200uA average , about 50 times less that normal receive mode.

Thanks for your help Paolo

---- On ven, 25 gen 2019 17:48:39 +0100 notifications@github.com wrote

Could all be. You got the source. wmsgsm42-board.c is the file to mess around with.

On Fri, Jan 25, 2019 at 9:20 AM pbecchi notifications@github.com wrote:

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi notifications@github.com wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi < notifications@github.com> wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi < notifications@github.com> wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457627833

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfOnSZjZ_Y_4jKoWNwmrpp4Vq2c5Pks5vGy6wgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458036935

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfIW36BY1ajeE0BefyHO_x3wSA6Y1ks5vHrSMgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458121627 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfHhp-WMiD_-j9gsL8E9ysDkGCVTlks5vHvQ-gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458229282, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfOPIWTz0iaIQgLOTdLQ5K20_crKFks5vHzZHgaJpZM4V33bN .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GrumpyOldPizza commented 5 years ago

There is no good advise there, other than to switch the module you are using.

All things considered, 64K FLASH is just not enough. It's not enough to get the LoRaWAN stack on there and have space for anything else, nor is it enough for any more involved application, even if you limit yourself to only using SX1272/SX1276 directly.

I do have zero interest on trying to squeeze out code size at the expense of functionality. In fact it is very likely that the code size requirement for the core arduino platform handling will increase.

On Wed, Jan 30, 2019 at 9:10 AM pbecchi notifications@github.com wrote:

Thomas Any advice to reduce flash size of the code.....i am a little over 64k!

Thanks

Paolo

---- On lun, 28 gen 2019 18:53:22 +0100 notifications@github.com wrote

Please do not use the system layer for now. It will change due to other requirements.

1.3uA is not that bad ;-)

On Mon, Jan 28, 2019 at 10:41 AM pbecchi notifications@github.com wrote:

I have tested as you suggest and measuring at the Mcu jumper with STM32L0.sleep() 193 uA with STM32L0.stop() 1.5 uA. If i measure at the board 3.3v input still get previous high reading. Just for my understanding ...how do i match sleep stop or stm32l0_system_sleep first parameter (0 to 3) to the low power modes of this table in the attachement?

---- On lun, 28 gen 2019 16:07:16 +0100 notifications@github.com wrote

Ok, 3rd attempt. Put in our loop only "STM32L0.stop()" (and #include "STM32L0.h"). And measure then.

On Mon, Jan 28, 2019 at 5:59 AM pbecchi notifications@github.com wrote:

Yes i have replaced r37 and r37 with 2 jumpers where i can measure current to Mcu amd to Rf.

---- On lun, 28 gen 2019 13:19:42 +0100 notifications@github.com wrote

Which resistor ? I only see SB36 and SB37 in this path.

On Mon, Jan 28, 2019 at 1:27 AM pbecchi notifications@github.com wrote:

Thomas Just an update! The good news is that i took out the 2 0ohm resistors on power line of cpu and rf and used header to measure current there. The current is dropped from 750u to 150u ....it is evident that additional 600 drain come from I nucleo board and not from the module.

Good news since i am going to use just the modules on my application.... I have now a Cad receive mode that draw only 200uA average , about 50 times less that normal receive mode.

Thanks for your help Paolo

---- On ven, 25 gen 2019 17:48:39 +0100 notifications@github.com wrote

Could all be. You got the source. wmsgsm42-board.c is the file to mess around with.

On Fri, Jan 25, 2019 at 9:20 AM pbecchi notifications@github.com wrote:

Jumpers are out! Could not be the SPI NSS since need to be high for the Sx1278 to work?

I have not found any place the USI module schematics, i may try to ask dirdctely USI , very unlikely they give any answer!!

Paolo

---- On ven, 25 gen 2019 17:12:07 +0100 notifications@github.com wrote

The pullups should not be the reason. I can also not see any LED on the schematics that usually would consume around 200uA.

I'd also assume you removed JP1, JP3 and JP4 ? This was LSM303AGR, LPS22HB and HTS221 would not be powered.

Other than this, no idea. SX1272 is set to SLEEP mode (it's lowest power mode) following a reset. The SPI bus is properly released.

The only other option would be the RF switch in the module. I do not know which one that is, but both, the TX and RX GPIO are not driven ... So that should be a low power state.

On Fri, Jan 25, 2019 at 8:55 AM pbecchi notifications@github.com wrote:

As a matter of fact it is set to 4.2 mHz!! As possible reason for external 600uA current i see only a pull up resistor to SDA an SCL line (4k7). Could this be the reason?

Paolo

---- On ven, 25 gen 2019 15:45:30 +0100 notifications@github.com wrote

As stated before there is a menu option in the IDE.

On Fri, Jan 25, 2019 at 7:23 AM pbecchi < notifications@github.com> wrote:

How can i check/change clock speed?

---- On ven, 25 gen 2019 15:20:20 +0100 notifications@github.com wrote

Those are not my estimates, those are the numbers from the datasheet for STM32L052.

The numbers that you are seeing do not make sense. The Arduino IDE allows you to select 32MHz, 16MHz and 4.2MHz. None of those according to Table 29 (MSI and HSI16) and Table 33 (MSI and HSI16, FLASH on) come close to what you are measuring. The closest is 4.2MHz (which you stated was not selected) with 620uA/150uA, which means there is a constant other current of about 600uA. It says that there is a STOP current of about 0.5uA. In a previouse comment you stated that STOP mode gave you 0.75mA, and SLEEP 0.85mA. So that would fit together with about 600uA of current from somewhere else.

But then again you stated that you did not change anything from the defaults, which would make the software use a 32MHz clock ...

On Fri, Jan 25, 2019 at 6:55 AM pbecchi < notifications@github.com> wrote:

These are my results: Empty skecth 1.2mA. Empty skecth with __WFE. 0.78 mA

All numbers are less than your estimates!

Paolo

---- On ven, 25 gen 2019 14:29:34 +0100 notifications@github.com wrote

__WFE() is an inline in the CMSIS include files.

Or you could use:

asm volatile ("wfe");

On Fri, Jan 25, 2019 at 6:23 AM pbecchi < notifications@github.com> wrote:

What library is VFE() in?

---- On ven, 25 gen 2019 13:34:41 +0100 notifications@github.com wrote

Ok, let's try this again. What if you just use a empty "setup()" and a empty "loop()" and measure power then ?

SX1272 should be powered down to about 100uA. The CPU should consume maximum power, which according to the datasheet should be about 6.25 mA typical, 7mA max (it says a while(1) { } is 5.2mA, but that is not what "loop()" really does).

The 2nd test is about bypassing all the other logic to establish a baseline for SLEEP mode. In this test, you have an empty "setup()", and "loop()" only contains a "__WFE();". With this you should be at 1750uA.

If your measurement diverge too much, you have either a measurement problem, or something else consumes power. The latter one you can figure out by a constant offset from the expected numbers, especially the one from the 2nd test.

N.b. that power measurement is tricky, and you need good equipment for that. I either use a Fluke 17B+ for min/max analysis, or a X-NUCLEO-LPM01A if the expected power is below 50mA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457571321

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfFKjf-2V0nidXLXXVWZNtMBuBLRNks5vGwVsgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457579779

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfJBH7CeIeILT5gzACE8CcXTg3Mlnks5vGwy7gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457587698

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfLH_F8XNxZNMwFQPlj1jpG9oceH0ks5vGxNGgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457619106

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfEnDxpQ4yU4JsBeAyvQ77ywXF0vxks5vGyjcgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-457627833

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfOnSZjZ_Y_4jKoWNwmrpp4Vq2c5Pks5vGy6wgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458036935

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfIW36BY1ajeE0BefyHO_x3wSA6Y1ks5vHrSMgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <

https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458121627

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AG4QfHhp-WMiD_-j9gsL8E9ysDkGCVTlks5vHvQ-gaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub < https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-458229282 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AG4QfOPIWTz0iaIQgLOTdLQ5K20_crKFks5vHzZHgaJpZM4V33bN

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/31#issuecomment-459002896, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfN3S7Ej5SAP4fZGb018tfQ5OJllVks5vIcPugaJpZM4V33bN .