Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] zenoh-pico on openthread and esp-idf #407

Closed
giovanidiniz opened this issue May 4, 2024 · 1 comment
Closed

[Bug] zenoh-pico on openthread and esp-idf #407

giovanidiniz opened this issue May 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@giovanidiniz
Copy link

Describe the bug

I'm currently trying to use zenoh-pico on ESP32-C6 MCUs using openthread on network layer.

My network setup is as follows:
esp32-c6 -> border router - > laptop (on home wifi) running zenohd in docker (--net=host)

I have "successfully" connected the the three pieces:

  • from the esp32-c6, I can ping the laptop using the laptop's home wifi IP(v4) address
  • when I run the ot_cli example, I can use a simple tcp socket client tcpsockclient connect ipv6 7447 - for those familiar with ot_cli) and establish a connection with zenohd's 7447 address.

After these tests I tried to connect with zenohd in my code, but it's consistently crashing here:

// Initialize Zenoh Session and other parameters
    z_owned_config_t config = z_config_default();
    zp_config_insert(z_loan(config), Z_CONFIG_MODE_KEY, z_string_make(MODE));
    zp_config_insert(z_loan(config), Z_CONFIG_CONNECT_KEY, z_string_make(CONNECT));
    
    // Open Zenoh session
    ESP_LOGI(ZENOH_TAG, "Trying to open Zenoh Session...");
    z_session = z_open(z_move(config));
    sleep(3);
    ESP_LOGI(ZENOH_TAG, "Checking Zenoh router connection...");

    while (!z_check(z_session))
    {
        ESP_LOGE(ZENOH_TAG, "Unable to open session...waiting...\n");
        z_session = z_open(z_move(config));
        sleep(3);
    }

    printf("OK\n");

I have very little experience with the codebase and was hoping someone could shed some light on things to debug and help with this issue.

To reproduce

In my code I make sure that openthread is running and has established connection with the border router - by checking the openthread state and making sure it is either a child or router.

at that point, I let zenoh-pico attempt to establish connection with zenohd and I get this stderr:

Guru Meditation Error: Core  0 panic'ed (Load access fault). Exception was unhandled.

Core  0 register dump:
Stack dump detected
MEPC    : 0x42015612  RA      : 0x42011432  SP      : 0x4081d810  GP      : 0x40810704  
0x42015612: socket at /home/ubuntu/turbine/esp/esp-idf/components/lwip/include/lwip/sockets.h:48
 (inlined by) _z_open_tcp at /home/ubuntu/turbine/lib/zenoh-pico/src/system/espidf/network.c:55
0x42011432: _z_f_link_open_tcp at /home/ubuntu/turbine/lib/zenoh-pico/src/link/unicast/tcp.c:119

TP      : 0x4081daa0  T0      : 0x40022494  T1      : 0xffffffe0  T2      : 0x00000009  
0x40022494: multi_heap_internal_unlock in ROM

S0/FP   : 0x00000000  S1      : 0x4081d8fc  A0      : 0x4081d8fc  A1      : 0x00000000  
A2      : 0x00001388  A3      : 0x00000001  A4      : 0x00000000  A5      : 0x4081d8f4  
A6      : 0x00000004  A7      : 0xffffff9f  S2      : 0x4081d960  S3      : 0x00000002  
S4      : 0x40824e74  S5      : 0x00000000  S6      : 0x00000000  S7      : 0x00000000  
S8      : 0x00000000  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000  
T3      : 0x7fffffff  T4      : 0x00000000  T5      : 0x0ccccccc  T6      : 0x00000019  
MSTATUS : 0x00001881  MTVEC   : 0x40800001  MCAUSE  : 0x00000005  MTVAL   : 0x0000000c  
0x40800001: _vector_table at /home/ubuntu/turbine/esp/esp-idf/components/riscv/vectors_intc.S:54

MHARTID : 0x00000000  


Backtrace:


socket (protocol=0, type=0, domain=0) at /home/ubuntu/turbine/esp/esp-idf/components/lwip/include/lwip/sockets.h:48
48      { return lwip_socket(domain,type,protocol); }
#0  socket (protocol=0, type=0, domain=0) at /home/ubuntu/turbine/esp/esp-idf/components/lwip/include/lwip/sockets.h:48
#1  _z_open_tcp (sock=sock@entry=0x4081d8fc, rep=..., tout=5000) at /home/ubuntu/turbine/lib/zenoh-pico/src/system/espidf/network.c:55
#2  0x42011432 in _z_f_link_open_tcp (zl=0x4081d8e4) at /home/ubuntu/turbine/lib/zenoh-pico/src/link/unicast/tcp.c:116
#3  0x420108f0 in _z_open_link (zl=zl@entry=0x4081d8e4, locator=locator@entry=0x40824e74 "") at /home/ubuntu/turbine/lib/zenoh-pico/src/link/link.c:62
#4  0x4200fc58 in _z_new_transport_client (zt=0x40824d2c, locator=0x40824e74 "", local_zid=0x4081d960) at /home/ubuntu/turbine/lib/zenoh-pico/src/transport/manager.c:29
#5  0x00000000 in ?? ()
Backtrace stopped: frame did not save the PC
ELF file SHA256: 2e40677ba```



### System info

- MCU: Platfom ESP-IDF esp32-c6 - zenoh pico v0.10.1-rc
- Laptop: Ubuntu 22.04 - zenoh v0.10.1-rc
@giovanidiniz giovanidiniz added the bug Something isn't working label May 4, 2024
@giovanidiniz
Copy link
Author

Ah, for the record, I think the issue was caused by a mismatch in zenoh versions between pico and zenohd.
I'm closing this for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant