nRF7002dk nrf5340 bus fault after shutting down interface

Hello,

I am working on a low power sensor logging project using the nRF7002dk. So far, I have updated the main loop in the wifi/sta sample and in place of the:

k_sleep(K_FOREVER);

I have added:

status = net_mgmt(NET_REQUEST_WIFI_DISCONNECT, iface, NULL, 0);
status = net_if_down(iface); 
k_sleep(K_SECONDS(2)); // will be longer in production, shortened for testing
status = net_if_up(iface);
k_sleep(K_SECONDS(2)); // allow the interface time to come up

I also have code verifying the statuses are returned as 0, but haven't posted that here to simplify my post.

I find that after a few connections, there is a kernel panic when trying to bring the interface back up.

[00:04:56.560,913] <inf> sta: State: SCANNING
[00:04:56.861,053] <inf> sta: ==================
[00:04:56.861,083] <inf> sta: State: SCANNING
[00:04:57.150,177] <err> os: ***** BUS FAULT *****
[00:04:57.150,177] <err> os: Precise data bus error
[00:04:57.150,207] <err> os: BFAR Address: 0x40000b08
[00:04:57.150,207] <err> os: r0/a1: 0x20000200 r1/a2: 0x20000580 r2/a3: 0x20000289
[00:04:57.150,207] <err> os: r3/a4: 0x20000588 r12/ip: 0x2003cca0 r14/lr: 0x200006a8
[00:04:57.150,238] <err> os: xpsr: 0x01000000
[00:04:57.150,238] <err> os: Faulting instruction address (r15/pc): 0x0003e97a
[00:04:57.150,268] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
[00:04:57.150,299] <err> os: Current thread: 0x20003470 (unknown)

The kernel panics stop if I add a 1 second delay between the net_mgmt and net_if_up calls. 

It appears that I can not shut down the interface immediately after disconnecting or something is not cleaned up that causes issues when bringing the interface back up. Obviously in production code, I would like to replace the delay with a check to ensure the disconnect has completed in case it takes longer than 1 second. How can I determine when it is safe to shut down the interface?

Parents
  • Hi,

    I have added your modifications to the wifi sta sample from NCS v2.4.2. I tested this modified sample on nrf7002-dk board, but I could not reproduce your issue. In my case, the sample behaved as expected.

    If you experience some congestion in your environment, you could try to increase the value of CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT in the prj.conf file.

    Best regards,
    Dejan

Reply
  • Hi,

    I have added your modifications to the wifi sta sample from NCS v2.4.2. I tested this modified sample on nrf7002-dk board, but I could not reproduce your issue. In my case, the sample behaved as expected.

    If you experience some congestion in your environment, you could try to increase the value of CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT in the prj.conf file.

    Best regards,
    Dejan

Children
  • Hello,

    Thank you for looking into this so quickly. I apologize, I forgot to mention that I am using the main branch. I have not tested this issue specifically in the NCS v2.4.2 release.

    Idle power consumption is extremely high in the NCS v2.4.2 release, so it is not suitable for our application.

  • Hi,

    bcornell said:
    I forgot to mention that I am using the main branch. I have not tested this issue specifically in the NCS v2.4.2 release.

    Could you please test with NCS v2.4.2? Is there any difference in result compared to main branch?

    bcornell said:
    Idle power consumption is extremely high in the NCS v2.4.2 release, so it is not suitable for our application.

    Could you elaborate on this? How do you measure current? What is the difference between idle current values when you use NCS v2.4.2 vs main branch?

    bcornell said:
    it is not suitable for our application

    Could you provide more information about your application and its requirements?

    Best regards,
    Dejan

  • Could you please test with NCS v2.4.2? Is there any difference in result compared to main branch?

    Today, I tested in v2.4.2 and found, as you did, that the code I posted above code works fine in the stable branch.

    Could you elaborate on this? How do you measure current? What is the difference between idle current values when you use NCS v2.4.2 vs main branch?

    I have another post where I have been trying to get help with power consumption issues here:
    https://devzone.nordicsemi.com/f/nordic-q-a/100338/nrf7002dk-nrf5340-power-consumption
    To summarize my problem: I have found that simply adding the WIFI options into the proj.conf of a Bluetooth sample for the nRF7002dk, results in higher power consumption measured at P22. The stable versions of NCS (including v2.4.2) have over 1mA current draw when WiFi is disconnected, the interface is off and the main loop is sleeping forever. The main branch has significantly lower power consumption in the same scenario (~160uA). This is a battery powered device, WiFi will be off most of the time, 1mA of current draw is unacceptable when not using WiFi.
     

  • Hi,

    Thank you for additional information.

    Could you try using NCS v2.4.99-dev1 and v2.4.99-dev2? What are the results?

    Best regards,
    Dejan

  • Could you try using NCS v2.4.99-dev1 and v2.4.99-dev2? What are the results?

    I tested both versions as described in my first post. In v2.4.99-dev1 everything works fine for 5-10 minutes before crashing. v2.4.99-dev2 behaves much more like the main branch and crashes in less than 5 minutes.

    I did not monitor the power consumption during these tests.

Related