Date   

Blocking printk #usb #nrf52840

forum.contas@...
 

Hi to everyone:

First post.

I've a simple Zephyr RTOS program where I use USB CDC ACM to see the output of the console and also the printk output.

Everything works fine, if I connect a terminal program to see the output.

If I do not connect a terminal program at start up (power on) the thread that has the printk just blocks. All other threads continue to run fine.

If after a while I connect the terminal program I can see some buffered output, and work resumes ok.

If I wait to much the thread never recovers, by other words I get no output and it seems that the thread is hanged and non functional.

Any idea how to make the USB output non blockcable or just overrun any output buffer?


Re: Flash two firmware in flash and jump from one address to another #flash #nrf52480

Nikos Karamolegkos
 

Hello,

Update: I just want to change the boot address (or slot) before the reboot, without using MCUboot. I am looking on zephyr documentation for a mechanism like this but I can not find any utility. Any proposals/ideas?

Thank you

On 8/25/20 8:31 PM, Nikos Karamolegkos wrote:

Thank you Carles, I would prefer not to use MCUboot. However, I have already checked MCUboot code in order to take some ideas. I am looking for something MCUboot interdependent. For example a function that change the boot address before the reboot.

On 8/25/20 5:22 PM, Cufi, Carles wrote:

Hi Nikos,

 

Maybe you want to look at MCUboot, which supports this out of the box and is integrated with Zephyr?

https://mcuboot.com/

 

https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_BOOTLOADER_MCUBOOT.html#cmdoption-arg-config-bootloader-mcuboot

 

Thanks,

 

Carles

 

From: users@... <users@...> On Behalf Of Nikos Karamolegkos via lists.zephyrproject.org
Sent: 25 August 2020 15:52
To: users@...
Subject: [Zephyr-users] Flash two firmware in flash and jump from one address to another #flash #nrf52480

 

Hello, I am using nrf52840-dk module (this is not really important). I would like to write two different firmwares in my device in different addresses (slots). Lets say the first firmware is located at address 0x000 (slot 0) and the second one is located at address 0x0000C000 (slot 1). How can I flash these two firmwares in these two different addresses and how can my application jump from the one address to the other (after reboot)?

Thanks,
Nikos

-- 
Nikos Karamolegkos
R & D engineer at ICS-FORTH
Telecommunications and Networks Lab (TNL)
-- 
Nikos Karamolegkos
R & D engineer at ICS-FORTH
Telecommunications and Networks Lab (TNL)


Re: Bluetooth: Concurrent advertising

Christoph Schramm
 

Hi Vinayak,

thanks a lot for your reply.

I have always been afraid of this but always assumed there will be a solution if we actually hit this worst case. Wow. I mean, with all the Corona apps rolling out, it would be really simple (for a flat earther, anti-vaxxer, etc.) to create a device which "bruteforces" all the smartphones around to render the Corona apps useless.
However, that's out of scope for Zephyr.

Thanks, again
Chris



Am 27.08.20, 09:01 schrieb "users@... im Auftrag von Chettimada, Vinayak Kariappa via lists.zephyrproject.org" <users@... im Auftrag von vinayak.kariappa.chettimada=nordicsemi.no@...>:

Hi Chris,

Only one connectable advertising instance is supported in the zephyr controller. Multiple simultaneous connections are supported, but that is not going to help denial of service if you do not want to authenticate a connecting central.
It is normal for centrals to support multiple simultaneous connections and your rogue master would connect to all your multiple advertisings attempts.

> one might want to advertise an eddystone beacon and a sensor peripheral at the same time
You either do this by advertising connectable and then after a connection you start a non-connectable advertising. This is supported in current zephyr BT stack.
If you want simultaneous instances of advertisers with different advertising data/mode, then you need advertising extensions support.
Zephyr host has support for advertising extensions, but you will need to check if the controller you use supports it.
Zephyr open source controller for nRF52 does not (its work in progress), but Nordic's proprietary softdevice controller in the nRF Connect SDK fully supports advertising extensions.

That said, again, without authentication, you can only use back-off to avoid denial of service if a central is always trying to connect to your device. There is no deny list for devices.

Regards,
Vinayak


-----Original Message-----
From: users@... <users@...> On Behalf Of Christoph Schramm via lists.zephyrproject.org
Sent: 26 August 2020 22:12
To: users@...
Subject: [Zephyr-users] Bluetooth: Concurrent advertising

Dear All,

One of our devices installed on a remote location is under some sort of „denial-of-service“ attack - well, that‘s simply meaning someone is constantly connecting to our peripheral, thus blocking other connections.
We can‘t use bonding (because of the UX impact with auth code in apps), so my only idea is to continue advertising even while a (rogue) central is connected.
I thought this would be the default for BT_LE_ADV_CONN but as it seems, it‘s not: the peripheral stops advertising and only resumes after the central disconnected.
However, I always wondered if it‘s possible to have multiple concurrent advertising „virtual“ peripherals. I can see that the ticker API is referenced a lot, so at first glance it looks like it was a common use case. But I absolutely can‘t find any documentation of how to start multiple advertisements (just to give a simple example: one might want to advertise an eddystone beacon and a sensor peripheral at the same time)

Any help is greatly appreciated

Chris


Re: Bluetooth: Concurrent advertising

Chettimada, Vinayak Kariappa
 

Hi Chris,

Only one connectable advertising instance is supported in the zephyr controller. Multiple simultaneous connections are supported, but that is not going to help denial of service if you do not want to authenticate a connecting central.
It is normal for centrals to support multiple simultaneous connections and your rogue master would connect to all your multiple advertisings attempts.

one might want to advertise an eddystone beacon and a sensor peripheral at the same time
You either do this by advertising connectable and then after a connection you start a non-connectable advertising. This is supported in current zephyr BT stack.
If you want simultaneous instances of advertisers with different advertising data/mode, then you need advertising extensions support.
Zephyr host has support for advertising extensions, but you will need to check if the controller you use supports it.
Zephyr open source controller for nRF52 does not (its work in progress), but Nordic's proprietary softdevice controller in the nRF Connect SDK fully supports advertising extensions.

That said, again, without authentication, you can only use back-off to avoid denial of service if a central is always trying to connect to your device. There is no deny list for devices.

Regards,
Vinayak


-----Original Message-----
From: users@... <users@...> On Behalf Of Christoph Schramm via lists.zephyrproject.org
Sent: 26 August 2020 22:12
To: users@...
Subject: [Zephyr-users] Bluetooth: Concurrent advertising

Dear All,

One of our devices installed on a remote location is under some sort of „denial-of-service“ attack - well, that‘s simply meaning someone is constantly connecting to our peripheral, thus blocking other connections.
We can‘t use bonding (because of the UX impact with auth code in apps), so my only idea is to continue advertising even while a (rogue) central is connected.
I thought this would be the default for BT_LE_ADV_CONN but as it seems, it‘s not: the peripheral stops advertising and only resumes after the central disconnected.
However, I always wondered if it‘s possible to have multiple concurrent advertising „virtual“ peripherals. I can see that the ticker API is referenced a lot, so at first glance it looks like it was a common use case. But I absolutely can‘t find any documentation of how to start multiple advertisements (just to give a simple example: one might want to advertise an eddystone beacon and a sensor peripheral at the same time)

Any help is greatly appreciated

Chris


Bluetooth: Concurrent advertising

Christoph Schramm
 

Dear All,

One of our devices installed on a remote location is under some sort of „denial-of-service“ attack - well, that‘s simply meaning someone is constantly connecting to our peripheral, thus blocking other connections.
We can‘t use bonding (because of the UX impact with auth code in apps), so my only idea is to continue advertising even while a (rogue) central is connected.
I thought this would be the default for BT_LE_ADV_CONN but as it seems, it‘s not: the peripheral stops advertising and only resumes after the central disconnected.
However, I always wondered if it‘s possible to have multiple concurrent advertising „virtual“ peripherals. I can see that the ticker API is referenced a lot, so at first glance it looks like it was a common use case. But I absolutely can‘t find any documentation of how to start multiple advertisements (just to give a simple example: one might want to advertise an eddystone beacon and a sensor peripheral at the same time)

Any help is greatly appreciated

Chris


RFC: remove w25qxxdv flash driver from Zephyr as of 2.4.0

Peter A. Bigot
 

The spi_flash_w25qxxdv driver has been superseded by the generic spi_nor driver for over a year. The only non-refactoring change to the W25Q driver in the last 18 months was done to support a backport to 1.14.

All devices supported by spi_flash_w25qxxdv driver are expected to be supported by the spi_nor driver, using the standard jedec,spi-nor devicetree compatible. No in-tree devicetree files make use of this driver.

To reduce confusion about which driver is expected to be used for JEDEC-standard SPI NOR serial flash memories pull request 27802 proposes to remove the redundant driver from Zephyr 2.4.  (It's not practical to deprecate a driver, and the existing one will work only for winbond,w25q16 if anything.

Please raise any concerns you have with this proposal as comments/reviews on the pull request.

Peter


Re: Debugging with Eclipse and PyOCD: Uncaught Exception in pyocd.exe

Weber, Dominik <dominik.weber@...>
 

Hey Marti,

Thanks for your help. The version 0.24.0 of pyocd was in fact the problem (obviously there was a bug). I installed the latest version and it works now!

Thanks!

Best Regards,
Dominik

-----Ursprüngliche Nachricht-----
Von: Bolivar, Marti <Marti.Bolivar@...>
Gesendet: Dienstag, 11. August 2020 18:47
An: Weber, Dominik <dominik.weber@...>;
users@...
Betreff: Re: [Zephyr-users] Debugging with Eclipse and PyOCD: Uncaught
Exception in pyocd.exe

Hi, responses inline.

"Weber, Dominik via lists.zephyrproject.org"
<dominik.weber=iis.fraunhofer.de@...> writes:

Hello there,

I'm new to Zephyr and having some trouble with debugging my application
with PyOCD and Eclipse. I'm running a multithreaded application on a
nRF52840 DK. I flash and want to debug the application via the onboard
debugger on the DK. I followed the steps described in the tutorial:
https://docs.zephyrproject.org/2.3.0/application/index.html#application in
the section "Eclipse Debugging".

I use:

* Zephyr 2.3 Build 99

* Segger J-Link OB-SAM3U128-V2-NordicSemi

* Eclipse 2019-09

* Python 3.8.3

* West 0.7.2

* C compiler GNU 9.2.1

All Python dependencies for Zephyr are satisfied.
Does this mean you installed the latest pyocd? The zephyr
requirements-run-test.txt file from which pyocd comes just says:

pyocd>=0.24.0

The version of this tool is likely what is at issue.


When I try to debug the application via pyocd.exe or pyocd-gdbserver.exe I
get the following error:

0001289:CRITICAL:__main__:uncaught exception: 'JLinkProbe' object has no
attribute '_lock'
Traceback (most recent call last):
File "c:\python38\lib\site-packages\pyocd\__main__.py", line 362, in run
self._COMMANDS[self._args.cmd](self)
File "c:\python38\lib\site-packages\pyocd\__main__.py", line 680, in
do_gdbserver
with session:
File "c:\python38\lib\site-packages\pyocd\core\session.py", line 302, in
__enter__
self.open()
File "c:\python38\lib\site-packages\pyocd\core\session.py", line 420, in
open
self._board.init()
File "c:\python38\lib\site-packages\pyocd\board\board.py", line 85, in init
self.target.init()
File "c:\python38\lib\site-packages\pyocd\core\coresight_target.py", line
160, in init
seq.invoke()
File "c:\python38\lib\site-packages\pyocd\utility\sequencer.py", line 213,
in invoke
resultSequence.invoke()
File "c:\python38\lib\site-packages\pyocd\utility\sequencer.py", line 208,
in invoke
resultSequence = call()
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 359, in
power_up_debug
self.write_reg(DP_CTRL_STAT, CSYSPWRUPREQ | CDBGPWRUPREQ |
MASKLANE | TRNNORMAL)
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 348, in
write_reg
self.write_dp(addr, data)
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 528, in
write_dp
did_lock = self._set_dpbanksel(addr, True)
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 480, in
_set_dpbanksel
self.lock()
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 252, in
lock
self.probe.lock()
File "c:\python38\lib\site-packages\pyocd\probe\debug_probe.py", line
173, in lock
self._lock.acquire()
AttributeError: 'JLinkProbe' object has no attribute '_lock'

Is this a bug in the python scripts or is the debugger not supported?
This error is coming from pyocd itself. Since it's an AttributeError it
looks like there's probably a bug in the tool. Knowing the exact version
is the next step. I would try manually installing the 0.24.0 version
given in the requirements file if the latest release is buggy here.

I don't understand if "When I try to debug the application via pyocd.exe
or pyocd-gdbserver.exe" means you are using 'west debug' or 'west
debugserver', but if so, you can run in verbose mode to see the pyocd
commands under the hood:

west -v debug

Example output:

$ west -v debug
[...]
-- west debug: using runner pyocd
-- runners.pyocd: pyOCD GDB server running on port 3333
runners.pyocd: pyocd gdbserver -p 3333 -T 4444 -t nrf52840 -f 4000000
runners.pyocd: /home/mbolivar/bin/zephyr-sdk/arm-zephyr-eabi/bin/arm-
zephyr-eabi-gdb /home/mbolivar/zp/zephyr/build/zephyr/zephyr.elf -ex
'target remote :3333' -ex 'monitor halt' -ex 'monitor reset' -ex load

Thanks,
Martí


Thanks for your help!

Best Regards,
Dominik



Re: Flash two firmware in flash and jump from one address to another #flash #nrf52480

Nikos Karamolegkos
 

Thank you Carles, I would prefer not to use MCUboot. However, I have already checked MCUboot code in order to take some ideas. I am looking for something MCUboot interdependent. For example a function that change the boot address before the reboot.

On 8/25/20 5:22 PM, Cufi, Carles wrote:

Hi Nikos,

 

Maybe you want to look at MCUboot, which supports this out of the box and is integrated with Zephyr?

https://mcuboot.com/

 

https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_BOOTLOADER_MCUBOOT.html#cmdoption-arg-config-bootloader-mcuboot

 

Thanks,

 

Carles

 

From: users@... <users@...> On Behalf Of Nikos Karamolegkos via lists.zephyrproject.org
Sent: 25 August 2020 15:52
To: users@...
Subject: [Zephyr-users] Flash two firmware in flash and jump from one address to another #flash #nrf52480

 

Hello, I am using nrf52840-dk module (this is not really important). I would like to write two different firmwares in my device in different addresses (slots). Lets say the first firmware is located at address 0x000 (slot 0) and the second one is located at address 0x0000C000 (slot 1). How can I flash these two firmwares in these two different addresses and how can my application jump from the one address to the other (after reboot)?

Thanks,
Nikos

-- 
Nikos Karamolegkos
R & D engineer at ICS-FORTH
Telecommunications and Networks Lab (TNL)


Re: Flash two firmware in flash and jump from one address to another #flash #nrf52480

Carles Cufi
 

Hi Nikos,

 

Maybe you want to look at MCUboot, which supports this out of the box and is integrated with Zephyr?

https://mcuboot.com/

 

https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_BOOTLOADER_MCUBOOT.html#cmdoption-arg-config-bootloader-mcuboot

 

Thanks,

 

Carles

 

From: users@... <users@...> On Behalf Of Nikos Karamolegkos via lists.zephyrproject.org
Sent: 25 August 2020 15:52
To: users@...
Subject: [Zephyr-users] Flash two firmware in flash and jump from one address to another #flash #nrf52480

 

Hello, I am using nrf52840-dk module (this is not really important). I would like to write two different firmwares in my device in different addresses (slots). Lets say the first firmware is located at address 0x000 (slot 0) and the second one is located at address 0x0000C000 (slot 1). How can I flash these two firmwares in these two different addresses and how can my application jump from the one address to the other (after reboot)?

Thanks,
Nikos


API meeting: agenda

Carles Cufi
 


Flash two firmware in flash and jump from one address to another #flash #nrf52480

Nikos Karamolegkos
 

Hello, I am using nrf52840-dk module (this is not really important). I would like to write two different firmwares in my device in different addresses (slots). Lets say the first firmware is located at address 0x000 (slot 0) and the second one is located at address 0x0000C000 (slot 1). How can I flash these two firmwares in these two different addresses and how can my application jump from the one address to the other (after reboot)?

Thanks,
Nikos


How to Request BLE Data Length Extension? #bt #bluetooth

George Ruinelli
 

I am trying to set the Bluetooth Low Energy DLE from 27 to something higher, eg. 251.
I was able to do it manually through the nRF Connect Tool, Wireshark then confirms me that the data no longer is fragmented:


How ever I need to be able to do it directly within Zephyr.

I am aware of https://lists.zephyrproject.org/g/users/topic/data_length_extension_on/23297993 and https://lists.zephyrproject.org/g/devel/topic/30301574, but it did not help me further.

I found bt_conn_le_data_len_update() which seems to do what I need, but it doesn't have any impact.
I tried to add its call to exchange_func(), but it simply seems to be ignored:
static void exchange_func(struct bt_conn *conn, uint8_t att_err, struct bt_gatt_exchange_params *params) {
    struct bt_conn_info info = {0};
    int err;

    if (att_err == 0) {
        LOG_INF("MTU exchange successful");
        LOG_DBG("MTU: %d bytes", bt_gatt_get_mtu(conn));
    }
    else {
        LOG_ERR("MTU exchange failed!");
    }

    err = bt_conn_get_info(conn, &info);
    if (err) {
        LOG_ERR("Failed to get connection info %d\n", err);
    }


    LOG_ERR("Data Length: %d", info.le.data_len->tx_max_len); // Reports 27

    struct bt_conn_le_data_len_param param;
    param.tx_max_len = 251;
    param.tx_max_time = 2120;
    err = bt_conn_le_data_len_update(conn, &param);
    if (err) {
        LOG_ERR("Failed to Update DLE: %d\n", err);
    }

    LOG_ERR("Data Length: %d", info.le.data_len->tx_max_len); // Still reporst 27
}

Sadly searching the web for bt_conn_le_data_len_update() only reveals its documentation but no further information :(

Sincerely
George


Re: Data Length Extension on NRF52840 #nrf52840 #ble #hci

George Ruinelli
 

@Josh

Can you give some insight, how you requested Data Length Extension?
I can not find any documentation how to do this.
I was able to enable to do it manually through the nRF Connect Tool, but need to do it directly in Zephyr.

Sincerely
George


Re: Choosing the network interface for a socket

Jukka Rissanen
 

Hi Maik,

For listening socket you need to call bind() to assing the local
address. For sending socket, the local address (interface) is selected
automatically (if you have not bound the socket) according to
destination address.

Cheers,
Jukka

On Fri, 2020-08-21 at 09:27 +0200, Maik Vermeulen wrote:
Hello,

Currently I am playing with TCP sockets on a board that has both an
LTE-M modem, and an ethernet interface.

It is not clear to me how I can control whether the socket should
use
the LTE-M connection, or the ethernet interface.

Could anyone give me some pointers?

Best regards,
Maik Vermeulen




Choosing the network interface for a socket

Maik Vermeulen
 

Hello,

Currently I am playing with TCP sockets on a board that has both an LTE-M modem, and an ethernet interface.

It is not clear to me how I can control whether the socket should use the LTE-M connection, or the ethernet interface.

Could anyone give me some pointers?

Best regards,
Maik Vermeulen


HCI USB driver for Windows #ble #driver #nrf52840 #usb

todd.krein@...
 

I have the HCI USB project built and running on my nRF52840 DK board. It works if I talk to it via ubuntu running under VirtualBox on my Win 10 system, but not if I plug it into a Raspberry Pi, or my Win 10 machine directly.

Does anyone know of a Windows driver that will successfully drive the nRF52840 as a BT device under windows?


Re: How to use "Serial CAN Bus Module" #driver #uart #can

s9gosich@...
 

@Lawrence King

Thank you for the code!


@All

I tried the last few days to get it working but I don’t know how to use a second UART. I’m using the nRF52832dk board which has only “uart0” defined in the Devicetree (see ~/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts and ~/zephyr/dts/arm/nordic/nrf52832.dtsi). Since uart0 is already being used I want to define an “uart1” as was used in the code by Lawrence King for nRF52840 (which supports “uart1” in the Devicetree). But as I understand it at the moment, this is difficult without deep knowledge about the Hardware and Devicetree. 

How can I solve this? Is there an easy path I haven’t found. Something like SoftwareSerial in Arduino?

Can I define an “uart1” with an “.overlay” file in my project folder? Are there examples for this?

Do I have to edit the Devicetree files in the ~/zephyr/dts folder?

Thank you!


Re: How to Run

Kate Stewart
 

Hi Deepa,
    Best place to start is following the instructions at:
https://docs.zephyrproject.org/latest/getting_started/index.html

"Blinky Sample" is Zephyr's equivalent of hello world. 

Since you have a windows system,   click on the Windows tab
under the first step in the getting started link

Screen Shot 2020-08-18 at 9.22.31 AM.png

You can run Zephyr in a virtual environment on your computer but it's designed to 
be run on small microprocessors.    A list of the boards that support zephyr can be

Hope this helps.

Kate


On Tue, Aug 18, 2020 at 8:11 AM Deepa Lakshmi <lakshmidpa@...> wrote:
hi team
       I need to run the zephyr hello world project in my lap. please, tell me the steps.
should update my OS to zeohyr from windows ?
or 
Zephyr can be run with windows 10 itself, with supporting packages.

please, let me know soon.


Thanks & Regards,
Deepa.R
8072608604


How to Run

Deepa Lakshmi <lakshmidpa@...>
 

hi team
       I need to run the zephyr hello world project in my lap. please, tell me the steps.
should update my OS to zeohyr from windows ?
or 
Zephyr can be run with windows 10 itself, with supporting packages.

please, let me know soon.


Thanks & Regards,
Deepa.R
8072608604


Re: LWM2M client to nrf582540-DK #nrf52840 #networking

Lubos, Robert
 

Hi Nikos,

 

Unfortunately, we don’t have a step-by-step guide for the scenario you describe, but I can provide you with some guidelines.

 

OpenThread has a reference implementation of border router, which can be run on a Linux host under docker (OpenThread is a protocol that enables IP over 802.15.4):

https://openthread.io/guides/border-router/docker

 

The `lwm2m_client` does not support OpenThread out-of-the box, but it can be easily added, see this comment:

https://github.com/zephyrproject-rtos/zephyr/issues/24840#issuecomment-624717991

 

Regards,

Robert

 

From: users@... [mailto:users@...] On Behalf Of Nikos Karamolegkos via lists.zephyrproject.org
Sent: Wednesday, August 5, 2020 11:32
To: users@...
Subject: [Zephyr-users] LWM2M client to nrf582540-DK #nrf52840 #networking

 

Hi all,

I have two nrf582540-dk modules and I would like to run the lwm2m client example of the link using the leshan server. How could I implement this using real device? How my 802.15.4 device will communicate with the server running on my PC? Is there any border router? 

I really need this. Can someone point me in the right direction?

Thank you,
Nikos