Date   

Re: getting increased power consumption on nrf52840 when upgrading from zephyr 2.4 to 3.1

Volker Leeb (Extern)
 

I am currently making some kind of strange observation:

When using a J-Link debugging probe (using Segger Ozone) and placing a breakpoint into the function nrf_uarte_disable(), located in the nrf_uarte.h file, then the power consumption goes down to the expected 130 uA after suspending the uart device with pm_device_action_run( uart0Device, PM_DEVICE_ACTION_SUSPEND );

When switching off the power supply and switching on again … doing a startup without breakpoint … the power consumption ends up at about 550 uA.

 

For me this seems to be some kind of race-condition, but I am using only the one main thread. Up to now I was not able to investigate if there are some other zephyr initialization/startup threads, which might get scheduled in a different order, when debugger is in play.

 

I would appreciate any suggestion or tip, of how I should/can proceed to investigate this further!?

 

Volker

 

 

 

Von: users@... <users@...> Im Auftrag von Volker Leeb (Extern) via lists.zephyrproject.org
Gesendet: Montag, 11. Juli 2022 08:29
An: Jeremy Herbert <jeremy.006@...>
Cc: users@...
Betreff: Re: [Zephyr-users] getting increased power consumption on nrf52840 when upgrading from zephyr 2.4 to 3.1

 

Hi Jeremy,

thank you for this suggestion.

A compiler warning showed me, that the old kind of pin-configuration is now deprecated and then I found out, that I have to use pin-control now. But unfortunately this did not help.

Volker

 

 

 

 

Von: Jeremy Herbert <jeremy.006@...>
Gesendet: Samstag, 9. Juli 2022 02:59
An: Volker Leeb (Extern) <
v.leeb@...>
Cc:
users@...
Betreff: Re: [Zephyr-users] getting increased power consumption on nrf52840 when upgrading from zephyr 2.4 to 3.1

 

Hi Volker,

 

I’m no expert, but this may be something to do with pinctrl.dts: 

https://docs.zephyrproject.org/latest/hardware/pinctrl/index.html which I don’t think was used in 2.4. This is now what is used to change the UART pins into and out of the sleep state in order to save current.

 

Thanks,

Jeremy

 

On Sat, 9 Jul 2022 at 12:47 am, Volker Leeb (Extern) <v.leeb@...> wrote:

Hi,

 

I am working on a custom hardware containing a nrf52840 and some peripherals.

I am now upgrading from zephyr 2.4 to zephyr 3.1 and experiencing a significant power consumption increase.

When using zephyr 2.4 I was able to reduce the overall idle power consumption to about 70 uA while still doing periodic Bluetooth-le broadcasting.

After upgrading to zephyr 3.1 the idle power consumption is now at about 550 uA.

To track down to the root-cause I removed all application code, now having a main loop which is doing only sleep calls.

When removing all configured components I was able to reduce to 130 uA. But as soon as I add the Uart to the config (CONFIG_SERIAL=y) the power consumption goes up to 550 uA. Even when actively trying to put it into suspended mode.

 

Can anybody give me some advice of how to investigate where the increased power consumption comes from?

 

Regards,

 

Volker

 


Re: Socket connect was not happening with TLS.

Lubos, Robert
 

Hi,

 

From the logs its seems that the underlying `send()` call on the TCP socket failed – oddly enough, it takes place in the middle of the handshake, so it doesn’t seem to be a problem with your qemu internet connection. Unfortunately I’m not able to reproduce the issue on my side.

I’d try to log the actual `errno` value returned by the `send()` call when the failure takes place (https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/net/lib/sockets/sockets_tls.c#L847) – that should give some brief information about the reason of the failure.

I would also recommend checking the packet flow with Wireshark (you can monitor the `tap0` interface) – maybe the server decided to abruptly close the connection for some reason.

 

Regards,

Robert

 

From: users@... <users@...> On Behalf Of gianluca torta via lists.zephyrproject.org
Sent: poniedziałek, 11 lipca 2022 10:53
To: Mariappan N <nmarijoe@...>
Cc: users@...
Subject: Re: [Zephyr-users] Socket connect was not happening with TLS.

 

just a note, here are the mbedtls return codes:

 

and not surprisingly it says that:

0x004E NET - Sending information through the socket failed

 

Gianluca

 

 

On Sun, Jul 10, 2022 at 3:30 PM Mariappan N <nmarijoe@...> wrote:

Hello Team,

 

I'm new to zephyr RTOS, tried the samples to understand the https with the Zephyr & mbedtls. I've taken the http_get sample, compiled for qemu_x86 and ran but it failed to work. 

 

As per zephyr doc, followed "qemu for networking" page & ran loop-socat.sh, sudo loop-slip-tap.sh & sudo dnsmasq.sh in separate terminals before running the program.

 

Followed the below command to build and ran the program:

 

cd ~/zephyrproject/zephyr

west build -b qemu_x86 samples/net/sockets/http_get -p -- -DCONF_FILE="prj.conf overlay-tls.conf"

west build -t run

 

After ran the program got the below error:

Error: connect(sock, res->ai_addr, res->ai_addrlen)
exit

 

Attached the detail log. PFA.

 

Am unable to debug further from here. I would like to have REST API communication from zephyr. If there any pointer on this, would be helpful.

 

Thanks,

Mariappan

 

 

 


Re: Socket connect was not happening with TLS.

gianluca torta
 

just a note, here are the mbedtls return codes:

and not surprisingly it says that:
0x004E NET - Sending information through the socket failed

Gianluca


On Sun, Jul 10, 2022 at 3:30 PM Mariappan N <nmarijoe@...> wrote:
Hello Team,

I'm new to zephyr RTOS, tried the samples to understand the https with the Zephyr & mbedtls. I've taken the http_get sample, compiled for qemu_x86 and ran but it failed to work. 

As per zephyr doc, followed "qemu for networking" page & ran loop-socat.sh, sudo loop-slip-tap.sh & sudo dnsmasq.sh in separate terminals before running the program.

Followed the below command to build and ran the program:

cd ~/zephyrproject/zephyr
west build -b qemu_x86 samples/net/sockets/http_get -p -- -DCONF_FILE="prj.conf overlay-tls.conf"
west build -t run

After ran the program got the below error:
Error: connect(sock, res->ai_addr, res->ai_addrlen)
exit

Attached the detail log. PFA.

Am unable to debug further from here. I would like to have REST API communication from zephyr. If there any pointer on this, would be helpful.

Thanks,
Mariappan




Re: getting increased power consumption on nrf52840 when upgrading from zephyr 2.4 to 3.1

Volker Leeb (Extern)
 

Hi Jeremy,

thank you for this suggestion.

A compiler warning showed me, that the old kind of pin-configuration is now deprecated and then I found out, that I have to use pin-control now. But unfortunately this did not help.

Volker

 

 

 

 

Von: Jeremy Herbert <jeremy.006@...>
Gesendet: Samstag, 9. Juli 2022 02:59
An: Volker Leeb (Extern) <v.leeb@...>
Cc: users@...
Betreff: Re: [Zephyr-users] getting increased power consumption on nrf52840 when upgrading from zephyr 2.4 to 3.1

 

Hi Volker,

 

I’m no expert, but this may be something to do with pinctrl.dts: 

https://docs.zephyrproject.org/latest/hardware/pinctrl/index.html which I don’t think was used in 2.4. This is now what is used to change the UART pins into and out of the sleep state in order to save current.

 

Thanks,

Jeremy

 

On Sat, 9 Jul 2022 at 12:47 am, Volker Leeb (Extern) <v.leeb@...> wrote:

Hi,

 

I am working on a custom hardware containing a nrf52840 and some peripherals.

I am now upgrading from zephyr 2.4 to zephyr 3.1 and experiencing a significant power consumption increase.

When using zephyr 2.4 I was able to reduce the overall idle power consumption to about 70 uA while still doing periodic Bluetooth-le broadcasting.

After upgrading to zephyr 3.1 the idle power consumption is now at about 550 uA.

To track down to the root-cause I removed all application code, now having a main loop which is doing only sleep calls.

When removing all configured components I was able to reduce to 130 uA. But as soon as I add the Uart to the config (CONFIG_SERIAL=y) the power consumption goes up to 550 uA. Even when actively trying to put it into suspended mode.

 

Can anybody give me some advice of how to investigate where the increased power consumption comes from?

 

Regards,

 

Volker

 


Socket connect was not happening with TLS.

Mariappan N <nmarijoe@...>
 

Hello Team,

I'm new to zephyr RTOS, tried the samples to understand the https with the Zephyr & mbedtls. I've taken the http_get sample, compiled for qemu_x86 and ran but it failed to work. 

As per zephyr doc, followed "qemu for networking" page & ran loop-socat.sh, sudo loop-slip-tap.sh & sudo dnsmasq.sh in separate terminals before running the program.

Followed the below command to build and ran the program:

cd ~/zephyrproject/zephyr
west build -b qemu_x86 samples/net/sockets/http_get -p -- -DCONF_FILE="prj.conf overlay-tls.conf"
west build -t run

After ran the program got the below error:
Error: connect(sock, res->ai_addr, res->ai_addrlen)
exit

Attached the detail log. PFA.

Am unable to debug further from here. I would like to have REST API communication from zephyr. If there any pointer on this, would be helpful.

Thanks,
Mariappan




Re: getting increased power consumption on nrf52840 when upgrading from zephyr 2.4 to 3.1

Jeremy Herbert
 

Hi Volker,

I’m no expert, but this may be something to do with pinctrl.dts: 
https://docs.zephyrproject.org/latest/hardware/pinctrl/index.html which I don’t think was used in 2.4. This is now what is used to change the UART pins into and out of the sleep state in order to save current.

Thanks,
Jeremy

On Sat, 9 Jul 2022 at 12:47 am, Volker Leeb (Extern) <v.leeb@...> wrote:

Hi,

 

I am working on a custom hardware containing a nrf52840 and some peripherals.

I am now upgrading from zephyr 2.4 to zephyr 3.1 and experiencing a significant power consumption increase.

When using zephyr 2.4 I was able to reduce the overall idle power consumption to about 70 uA while still doing periodic Bluetooth-le broadcasting.

After upgrading to zephyr 3.1 the idle power consumption is now at about 550 uA.

To track down to the root-cause I removed all application code, now having a main loop which is doing only sleep calls.

When removing all configured components I was able to reduce to 130 uA. But as soon as I add the Uart to the config (CONFIG_SERIAL=y) the power consumption goes up to 550 uA. Even when actively trying to put it into suspended mode.

 

Can anybody give me some advice of how to investigate where the increased power consumption comes from?

 

Regards,

 

Volker

 


getting increased power consumption on nrf52840 when upgrading from zephyr 2.4 to 3.1

Volker Leeb (Extern)
 

Hi,

 

I am working on a custom hardware containing a nrf52840 and some peripherals.

I am now upgrading from zephyr 2.4 to zephyr 3.1 and experiencing a significant power consumption increase.

When using zephyr 2.4 I was able to reduce the overall idle power consumption to about 70 uA while still doing periodic Bluetooth-le broadcasting.

After upgrading to zephyr 3.1 the idle power consumption is now at about 550 uA.

To track down to the root-cause I removed all application code, now having a main loop which is doing only sleep calls.

When removing all configured components I was able to reduce to 130 uA. But as soon as I add the Uart to the config (CONFIG_SERIAL=y) the power consumption goes up to 550 uA. Even when actively trying to put it into suspended mode.

 

Can anybody give me some advice of how to investigate where the increased power consumption comes from?

 

Regards,

 

Volker

 


Re: ST BLE Sensor Demo problem #bluetooth

Erwan Gouriou
 

Hi Ivo,

Not sure what could be the issue. Dont hesitate to raise an issue in github and we'll have a look.

Thanks
Erwan 

Le mar. 5 juil. 2022, 20:25, Ivo <ivo.hora@...> a écrit :
Dear all,

I tried to run ST BLE Sensor DEMO for Zephyr located here:
https://docs.zephyrproject.org/latest/samples/bluetooth/st_ble_sensor/README.html
I build the example for nrf52840dongle_nrf52840, I can see the device in the list of dongles in ST BLE Android app, but I cannot connect to the dongle to see advertised services.
Another person is experiencing simmlar problem here:
https://community.st.com/s/question/0D53W00000spgphSAA/does-the-stblesensor-example-work-with-zephyr-260-with-the-nucleowb55rg-board
Does anyone know what the problem might be?
Thank you
Ivo


ST BLE Sensor Demo problem #bluetooth

Ivo
 

Dear all,

I tried to run ST BLE Sensor DEMO for Zephyr located here:
https://docs.zephyrproject.org/latest/samples/bluetooth/st_ble_sensor/README.html
I build the example for nrf52840dongle_nrf52840, I can see the device in the list of dongles in ST BLE Android app, but I cannot connect to the dongle to see advertised services.
Another person is experiencing simmlar problem here:
https://community.st.com/s/question/0D53W00000spgphSAA/does-the-stblesensor-example-work-with-zephyr-260-with-the-nucleowb55rg-board
Does anyone know what the problem might be?
Thank you
Ivo


ST BLE Sensor Demo problem #bluetooth

Ivo
 

Dear all,

I tried to run ST BLE Sensor DEMO for Zephyr located here:
https://docs.zephyrproject.org/latest/samples/bluetooth/st_ble_sensor/README.html
I build the example for nrf52840dongle_nrf52840, I can see the device in the list of dongles in ST BLE Android app, but I cannot connect to the dongle to see advertised services.
Another person is experiencing simmlar problem here:
https://community.st.com/s/question/0D53W00000spgphSAA/does-the-stblesensor-example-work-with-zephyr-260-with-the-nucleowb55rg-board
Does anyone know what the problem might be?
Thank you
Ivo


Re: About protection for Zephyr

William Fish
 

It may be easier to direct your questions to the solution provider. 

Billy..


About protection for Zephyr

Ofir Levy <ofir8584@...>
 

Hello,
We started evaluating a security solution (https://www.sternumiot.com/) that integrates with Zephyr and provides protection of the code including the Zephyr itself against software vulnerabilities like memory overflows, unallowed code execution etc. It shows the alerts from our device on a nice cloud dashboard.

I'm not sure how to evaluate that the solution does what it says it does in terms of security. The visibility part of the Zephyr is pretty impressive but I don't know how to verify that the code is protected. Can you please share with me how you have tested security before or ideas how I can evaluate this?

Thanks,
Ofir


Re: log timestamp formatting

Carles Cufi
 

I don’t think you need to create your own backend if you are willing to send a PR or carry an out-of-tree patch. As long as your backed of choice is using log_output_msg_process():

 

From what I can tell you would need to modify timestamp_print() in log_output.c. You could propose a patch to reformat the timestamp based on Kconfig options.

If you don’t want to send a patch upstream you can probably just modify that function yourself locally.

 

Carles

 

From: users@... <users@...> On Behalf Of Gordon Klaus via lists.zephyrproject.org
Sent: 01 July 2022 16:50
To: Chruściński, Krzysztof <Krzysztof.Chruscinski@...>; users@...
Subject: Re: [Zephyr-users] log timestamp formatting

 

Thanks for your reply.  I guess what you are saying is: yes, I must implement my own backend?

Is there an example of a minimal backend?  The ones I saw seemed quite involved.


From: Chruściński, Krzysztof <Krzysztof.Chruscinski@...>
Sent: Friday, July 1, 2022 4:14:40 PM
To: Gordon Klaus <gordon@...>; users@... <users@...>
Subject: RE: log timestamp formatting

 

Hi,

 

Log_output module has timestamp formatting functionality. It is a helper module that is used by most of the backends. Processing function accepts flags and one is LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP. If you want different formatting then you can try to extend log_output or implement it directly in your own backend.

 

Regards,

Krzysztof

 

From: users@... <users@...> On Behalf Of Gordon Klaus via lists.zephyrproject.org
Sent: Friday, July 1, 2022 4:08 PM
To: users@...
Subject: [Zephyr-users] log timestamp formatting

 

Hello!

 

Is it really necessary to implement an entire logging backend just to achieve custom timestamp formatting?

I was hopeful when I came across CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP.  But this is just a boolean, not a format string.

I want my log messages to be prefixed with date and time.  Now I wonder, is it a bad idea?  Why else would such functionality be missing?

 

Cheers,

Gordon


Re: log timestamp formatting

Gordon Klaus <gordon@...>
 

Thanks for your reply.  I guess what you are saying is: yes, I must implement my own backend?
Is there an example of a minimal backend?  The ones I saw seemed quite involved.


From: Chruściński, Krzysztof <Krzysztof.Chruscinski@...>
Sent: Friday, July 1, 2022 4:14:40 PM
To: Gordon Klaus <gordon@...>; users@... <users@...>
Subject: RE: log timestamp formatting
 

Hi,

 

Log_output module has timestamp formatting functionality. It is a helper module that is used by most of the backends. Processing function accepts flags and one is LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP. If you want different formatting then you can try to extend log_output or implement it directly in your own backend.

 

Regards,

Krzysztof

 

From: users@... <users@...> On Behalf Of Gordon Klaus via lists.zephyrproject.org
Sent: Friday, July 1, 2022 4:08 PM
To: users@...
Subject: [Zephyr-users] log timestamp formatting

 

Hello!

 

Is it really necessary to implement an entire logging backend just to achieve custom timestamp formatting?

I was hopeful when I came across CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP.  But this is just a boolean, not a format string.

I want my log messages to be prefixed with date and time.  Now I wonder, is it a bad idea?  Why else would such functionality be missing?

 

Cheers,

Gordon


Re: log timestamp formatting

Chruściński, Krzysztof
 

Hi,

 

Log_output module has timestamp formatting functionality. It is a helper module that is used by most of the backends. Processing function accepts flags and one is LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP. If you want different formatting then you can try to extend log_output or implement it directly in your own backend.

 

Regards,

Krzysztof

 

From: users@... <users@...> On Behalf Of Gordon Klaus via lists.zephyrproject.org
Sent: Friday, July 1, 2022 4:08 PM
To: users@...
Subject: [Zephyr-users] log timestamp formatting

 

Hello!

 

Is it really necessary to implement an entire logging backend just to achieve custom timestamp formatting?

I was hopeful when I came across CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP.  But this is just a boolean, not a format string.

I want my log messages to be prefixed with date and time.  Now I wonder, is it a bad idea?  Why else would such functionality be missing?

 

Cheers,

Gordon


log timestamp formatting

Gordon Klaus <gordon@...>
 

Hello!

 

Is it really necessary to implement an entire logging backend just to achieve custom timestamp formatting?

I was hopeful when I came across CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP.  But this is just a boolean, not a format string.

I want my log messages to be prefixed with date and time.  Now I wonder, is it a bad idea?  Why else would such functionality be missing?

 

Cheers,

Gordon


Is it possible to configure MCLK frequency in I2S devicetree node

Jason Bens <jason.bens@...>
 

Hi all,

 

Exactly as the subject line says, is it possible to configure the master clock frequency of an I2S peripheral in the device tree?  I’m using an nRF5340.  I can see that there’s a clock-source property in nordic,nrf-i2s, which I can set to ‘ACLK’, and then configure the frequency of that clock in the nordic,nrf-clock node, but I’m stumped after this.  It seems like there’s no place to set the prescaler value .mck_setup for nrfx_i2s_config_t.  Is there any way to control this property as well from devicetree, or is this all better suited as a kconfig option.

 

Thanks,

 

  • Jason


Re: Error when getting started with zephyr on Windows Subsystem for Linux

Jason Bens <jason.bens@...>
 

Hi Nash,

 

Is this a new installation of WSL Ubuntu, or one that’s been used for other purposes for a while?  I ask because I believe the errors you’re seeing are due to those packages already existing on your system but at a different, incompatible version number.  Pip is refusing to upgrade or downgrade these packages as it doesn’t want to break other applications that listed these packages as dependencies.

 

Rather than using the “install globally” instructions, you could try using a python virtual environment (“install with virtual environment”, on the getting started page).  Essentially, venv creates a directory at the root of your project and looks there for site-packages first.  Now, when you install packages through pip, they should get installed there instead of replacing the packages already installed in your normal python site-packages directory.  Remember to activate the virtual environment (.venv/bin/activate) when you want to do any work on this project, or you’ll end up using the wrong packages, and that could cause your build to fail.  My personal recommendation is to use a virtual environment for any project that requires packages from pip.

 

Another, less recommended option, would be to loosen the version number restrictions in requirements.txt.  It looks like most of your errors are caused by pip complaining that your currently-installed packages are too new.  You can open up the requirements.txt file and modify the required min and max version numbers there.  Note that this is probably a bad idea in the long run, especially if you relax the minimum version requirements, but may get you up and running in the short term.

 

Hopefully that helps you get started,

 

  • Jason

 

From: users@... <users@...> On Behalf Of Nash S.
Sent: June 29, 2022 4:42 AM
To: users@...
Subject: [Zephyr-users] Error when getting started with zephyr on Windows Subsystem for Linux

 

External Email:

Hello,

 

I am trying to install zephyr on WSL Ubuntu (20.04.4), using this guide: https://docs.zephyrproject.org/latest/develop/getting_started/index.html

 

I am able to get up to the command: 

pip3 install --user -r ~/zephyrproject/zephyr/scripts/requirements.txt

 

When I execute this command, I get the error shown in the screenshot attached to this email. 

 

Can you please guide me on how I would go about installing zephyr properly? I am new to this and so I do not have experience with zephyr. Any help would be appreciated.

 

Thank you,

Nash 


Error when getting started with zephyr on Windows Subsystem for Linux

Nash S. <nashsth@...>
 

Hello,

I am trying to install zephyr on WSL Ubuntu (20.04.4), using this guide: https://docs.zephyrproject.org/latest/develop/getting_started/index.html

I am able to get up to the command: 
pip3 install --user -r ~/zephyrproject/zephyr/scripts/requirements.txt

When I execute this command, I get the error shown in the screenshot attached to this email. 

Can you please guide me on how I would go about installing zephyr properly? I am new to this and so I do not have experience with zephyr. Any help would be appreciated.

Thank you,
Nash 


Re: build ROM library

Lawrence King
 

Hi Jacob:

Yes you can use the Zephyr build system to build a library. Just put a CMakeLists.txt file in the subdirectory where you have your library (the atmel crypto library in  my case). Here is the CMakeLists.txt file
cmake_minimum_required(VERSION 3.13.1)
set (CMAKE_C_FLAGS "-Wall -Wextra -Wcast-align -fstack-usage -fwrapv -fno-strict-aliasing -O1 -pedantic -Wall -Wextra -fmessage-length=0 -ffunction-sections -fdata-sections -Wstrict-prototypes --save-temps -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -I $ENV{ZEPHYR_BASE}/../modules/crypto/tinycrypt/lib/include " CACHE INTERNAL "")
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
add_subdirectory(lib)

To build the library I have this bash script in the directory above
# rebuild the atmel library
cd atmel_crypto/; rm -rf build; west build; cd ..

To link the prebuilt libraries into the zephyr build, it is just a latter of telling CMakeLists.txt where the libraries are, add something like this to your CMakeLists.txt
target_sources(app PRIVATE ${app_sources})
include_directories(./atmel_crypto/lib)
# add the prebuilt library
find_library(ATMEL_LIB libcryptoauth.a PATHS ./atmel_crypto/build/lib/)
target_link_libraries(zephyr INTERFACE "${ATMEL_LIB}")


The part I haven't done is forcing the libraries to link to a specific location (your ROM), maybe someone else can tell you how to do that.

On Wed, May 25, 2022 at 9:03 AM Jacob Avraham <jacob.avraham@...> wrote:
Hi,
I'm planning to build a couple of libraries that will reside in ROM, and call them from a Zephyr application.
The nature of these libraries is that I don't have control of their source code and their APIs, so calling them
indirectly using a function pointers table is not a route I'd like to go.
The ROM code could be some standard compression library, or maybe portions of commonly used libc functions, and it will not make calls to external code, like OS or other libraries.
 
The questions are:
1. Can I use Zephyr's build infrastructure to build a library (preferred ELF format) that does not contain the Zephyr OS and is not an application? I figure I'll probably need to relocate the data section of this library from ROM to RAM during boot.
2. How can I link a Zephyr application with this library so that all the calls will be resolved?

Thanks,
Jacob