Open pavel808 opened 1 month ago
Do you have PSRAM? I doubt if a real world controller app is going to fit on S3 without extra PSRAM. The minimum 2MB is plenty.
You also need to be careful about calling recursively into CHIP and eating up huge amounts of stack. I am using messages and queues in FreeRTOS to allow the stack to unroll.
Did you also run Thread BR on ESP32-S3? If you enable Thread BR on ESP32-S3 with the matter controller feature, we suggest you add PSRAM for S3. Note that we are calling the pairing_code_thread in CHIP task in our example, you can also post it to CHIP task.
Do you have PSRAM? I doubt if a real world controller app is going to fit on S3 without extra PSRAM. The minimum 2MB is plenty.
You also need to be careful about calling recursively into CHIP and eating up huge amounts of stack. I am using messages and queues in FreeRTOS to allow the stack to unroll.
Hi @jonsmirl It appears that S3 has PSRAM. I am developing on the ESP Thread BR device. Quad PSRAM had already been enabled according to the menuconfig settings. Any specific settings I should apply for PSRAM that may help?
Do you have some examples of using messages and queues in FreeRTOS for this, instead of recursively calling into CHIP to commission the device? Thanks.
Did you also run Thread BR on ESP32-S3? If you enable Thread BR on ESP32-S3 with the matter controller feature, we suggest you add PSRAM for S3. Note that we are calling the pairing_code_thread in CHIP task in our example, you can also post it to CHIP task.
Hi @wqx6 Yes I am also running Thread BR on S3. I clearly need PSRAM. How do I enable this?
What's the best way to post this to CHIP task as you mentioned? I couldn't find examples. Thanks.
Make sure the PSRAM is enabled in menuconfig. If is enabled correctly the bootlog will print the size of it when the chip first boots.
Then enable these: CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y CONFIG_ESP_MATTER_MEM_ALLOC_MODE_EXTERNAL=y CONFIG_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y
Make sure the PSRAM is enabled in menuconfig. If is enabled correctly the bootlog will print the size of it when the chip first boots.
Then enable these: CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y CONFIG_ESP_MATTER_MEM_ALLOC_MODE_EXTERNAL=y CONFIG_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y
@jonsmirl Ah yes. PSRAM shows 2MB in the bootlog. I enabled those then as you mentioned, and now I no longer get a stack overflow crash on calling pairing_code_thread
. Thanks.
However, commissioning fails no matter what with Error on commissioning step 'ThreadNetworkSetup': 'Error CHIP:0x000000AC'
, but that's a different story of course.
I am using the esp_mater_controller in my application to hopefully be able to commission and control devices.
My application is running on an ESP32-S3 on a Thread Border Router device.
Whenever I call
esp_matter::controller::pairing_code_thread
out of context I get a stack overflow. I started by trying to call it within a HTTP post handler. I then moved this into a separate thread as follows :Here is how the thread is created from the main function. If I try and increase the stack size to something bigger than the default, say 8000, then the thread can't be created and fails with ENOMEM.
Any recommendations on how to solve this?
Also I saw it mentioned elsewhere to use
DeviceLayer::PlatformMgr().ScheduleWork()
instead.Are there any examples of how to use that for commissioning? Thanks in advance.