ESP32 with Zephyr RTOS

Hi,
I am struggling to run a basic example on ESP32-S3-DevkitC-1. After successful connection I receive such error:

[00:00:03.233,000] net_dhcpv4: Received: 192.168.100.205
Connected
[00:00:03.234,000] golioth_system: Starting connect
[00:00:03.252,000] golioth_system: Failed to connect: -12
[00:00:03.252,000] golioth_system: Failed to connect: -12

I cannot find a description of the error -12.
I hardcoded Golioth keys and my prj.conf looks like this:


CONFIG_GOLIOTH_SAMPLES_COMMON=y

# Application
CONFIG_LOG_BACKEND_GOLIOTH=y
CONFIG_GOLIOTH_FW=y
CONFIG_GOLIOTH_SAMPLE_WIFI_SSID="my-wifi-ssid"
CONFIG_GOLIOTH_SAMPLE_WIFI_PSK="my-wifi-psk"
CONFIG_GOLIOTH_SAMPLE_HARDCODED_PSK_ID="my-psk-id"
CONFIG_GOLIOTH_SAMPLE_HARDCODED_PSK="my-psk"
CONFIG_SETTINGS=y

Can you help me with debugging this error? I tried different ESP32 boards, but the error is the same.

Hey misiek,

Are you using Zephyr RTOS or ESP-IDF for your application?

ESP32-S3-DevkitC-1 is one of the verified boards in our Firmware SDK with ESP-IDF platform. Can you try running the golioth_basics sample and adding the wifi and Golioth credentials using the device shell?

Hi Marko,
thanks for replying. I managed to run golioth_basic_sample using ESP-IDF and it does work with Golioth Cloud.
Unfortunately it doesn’t work with Zephyr RTOS which I want to develop with. My experience with Zephyr so far is rather challenging and I found it can be tricky to find an error.
I used sample located here https://github.com/golioth/golioth-zephyr-sdk/tree/main/samples/hello
and I added hardcoded wifi and golioth credentials to the proj.conf, it didn’t work :confused:
I tried also configuration in prj.conf to allow providing credentials during runtime, but I got exactly the same behaviour error -12.

Hey misiek,

Did you add the .overlay and .conf files in the boards directory? If not, can you create esp32s3_devkitm.overlay and esp32s3_devkitm.conf files in the boards directory and copy the contents of esp32_devkitc_wroom.conf and esp32_devkitc_wroom.overlay in them?

From the Zephyr Supported Boards page, only the ESP32-S3-DevKitM-1 board is supported, not the ESP32-S3-DevKitC-1. On first glance, the only difference is in modules used (WROOM vs MINI), but they might be compatible.

Hi Marko,
I followed the steps and unfortunately it gets me to the same place: error -12.
That would be really weird if ESP32-S3-DevKitM-1 would work and wouldn’t ESP32-S3-DevKitC-1.

I could buy ESP32-S3-DevKitM-1, but I fear it would get me to the same error as chips are exactly the same and MINI has less capabilities. I wish I could debug this, do you know where I can find what the error -12 represents?

Best
Michał

A colleague tested the lightdb/get and hello samples by copy-pasting .conf and .overlay files from esp32_devkitc_wroom to esp32s3_devkitm , he then flashed the code on the ESP32-S3-DevKitC-1 and connected to Golioth without any issue. Error -12 is -ENOMEM.

Can you make a clean and a build with west build -p -b esp32s3_devkitm ?

Hi
“hello” example gives me the same error as before even after following your instructions and ligthdb/get is not connecting to the Golioth cloud for some reason so, I need to figure out what settings has to be set in prj.conf. In the meantime would you mind sharing your project files that you managed to work, preferably “hello” and also Zephyr SDK version? Maybe there are some issues introduced in newer version of the SDK?

Best
Michał

Hey,

for the hello example, create esp32s3_devkitm.conf and esp32s3_devkitm.overlay files in the boards directory.

Content of the esp32s3_devkitm.conf , (don’t forget to add Golioth and WiFi credentials):

CONFIG_WIFI=y
CONFIG_HEAP_MEM_POOL_SIZE=98304
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_DHCPV4=y
CONFIG_MBEDTLS_ENTROPY_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y
CONFIG_MBEDTLS_ECP_ALL_ENABLED=y
CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4=y
CONFIG_NET_L2_WIFI_SHELL=y
CONFIG_GOLIOTH_SAMPLE_WIFI=y

CONFIG_GOLIOTH_SAMPLE_HARDCODED_PSK_ID="my-psk-id"
CONFIG_GOLIOTH_SAMPLE_HARDCODED_PSK="my-psk"
CONFIG_GOLIOTH_SAMPLE_WIFI_SSID="my-wifi"
CONFIG_GOLIOTH_SAMPLE_WIFI_PSK="my-psk"

Content of the esp32s3_devkitm.overlay:

&wifi {
status = "okay";
};

Build with:
west build -b esp32_devkitc_wroom samples/hello

The latest Golioth Zephyr SDK is v0.8.0 and is verified with Zephyr v3.5.0.

Hi
thanks for the help, but I get the same error. I’ll try to make a clean zephyr environment installation and see if that helps.

Best,
Michał

Hi Marko,
could you tell me which SDK version of Zephyr you used? I’m using v0.16.3 currently.

Best
Michał

Hi Marko,
I tried building example with different SDKs (16.4, 16.3, 16.1, 15.2), but still the same issue. I have no clue how to fix this…
I ordered ESP32S3-DevkitM to rule out hardware issue.
What bugs me is that error 12 is ENOMEM which says:
Not enough core.
Should increasing heap size solve the issue?

Best,
Michal

Hi, in the private message as you suggested I added

CONFIG_MBEDTLS_HEAP_SIZE=65536

and it fixed the issue for ESP32-S3 based board. For ESP32 I had to use smaller heap sized - 32 kB.

Best
Michał