Is _thread supported on ESP32 with SPIRam?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am
Location: Land Down Under

Is _thread supported on ESP32 with SPIRam?

Post by EasyRider » Fri Oct 12, 2018 5:47 am

Is _Thread supported on ESP32?

Trying on SPIRam module with most recent SPIRam firmware and module crashes/reboots when initializes thread.

Code: Select all

import _thread
import time
 
def test( threadName, delay):
  
  while True:
   
    print("Hello from thread", threadName)
    time.sleep(delay)
 
_thread.start_new_thread(test, ("Thread-1", 2, ))
home/micropython/esp-idf/components/freertos/tasks.c:686 (xTaskCreateStaticPinnedToCore)- assert failed!
abort() was called at PC 0x4008e63b on core 0

User avatar
EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am
Location: Land Down Under

Re: Is _thread supported on ESP32 with SPIRam?

Post by EasyRider » Fri Oct 12, 2018 5:51 am

this is the thread initializing code, there is a typo error in earlier post.

Code: Select all

_thread.start_new_thread(test, ("Thread-1", 2))

User avatar
EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am
Location: Land Down Under

Re: Is _thread supported on ESP32 with SPIRam?

Post by EasyRider » Fri Oct 12, 2018 6:10 am

Threading and above code works on "standard" ESP32module with most recent "standard" firmware.

User avatar
EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am
Location: Land Down Under

Re: Is _thread supported on ESP32 with SPIRam?

Post by EasyRider » Fri Oct 12, 2018 6:28 am

Module is ESP32-WROVER.

This is reboot log.
Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4732
load:0x40078000,len:8256
load:0x40080400,len:6132
entry 0x4008124c
[0;32mI (446) spiram: SPI RAM mode: flash 40m sram 40m[0m
[0;32mI (446) spiram: PSRAM initialized, cache is in normal (1-core) mode.[0m
[0;32mI (447) cpu_start: Pro cpu up.[0m
[0;32mI (451) cpu_start: Single core mode[0m
[0;32mI (1320) spiram: SPI SRAM memory test OK[0m
[0;32mI (1320) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (1320) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM[0m
[0;32mI (1327) heap_init: At 3FFC51D0 len 0001AE30 (107 KiB): DRAM[0m
[0;32mI (1333) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (1339) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (1346) heap_init: At 40095384 len 0000AC7C (43 KiB): IRAM[0m
[0;32mI (1352) cpu_start: Pro cpu start user code[0m
[0;32mI (1357) spiram: Adding pool of 4096K of external SPI memory to heap allocator[0m
[0;32mI (1365) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations[0m
[0;32mI (44) cpu_start: Starting scheduler on PRO CPU.[0m
OSError: [Errno 2] ENOENT
MicroPython v1.9.4-632-g11bc38d55 on 2018-10-12; ESP32 module with ESP32
Type "help()" for more information.

>>>import gc
>>> gc.mem_free()
2811552
>>>

User avatar
EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am
Location: Land Down Under

Re: Is _thread supported on ESP32 with SPIRam?

Post by EasyRider » Sat Oct 13, 2018 2:06 pm

Anyone using ESP32 with 4MB SPIRam and latest micropython relevant firmware ?
Would appreciate to know if _Thread works or if anyone knows what the status with _Thread is or should be.

Regards

Gudbrand
Posts: 1
Joined: Tue Oct 16, 2018 7:54 pm

Re: Is _thread supported on ESP32 with SPIRam?

Post by Gudbrand » Tue Oct 16, 2018 8:01 pm

/home/micropython/esp-idf/components/freertos/tasks.c:686 (xTaskCreateStaticPinnedToCore)- assert failed!
tasks.c:686

TaskHandle_t xTaskCreateStaticPinnedToCore( TaskFunction_t pxTaskCode,
const char * const pcName,
const uint32_t ulStackDepth,
void * const pvParameters,
UBaseType_t uxPriority,
StackType_t * const puxStackBuffer,
StaticTask_t * const pxTaskBuffer,
const BaseType_t xCoreID )
{
TCB_t *pxNewTCB;
TaskHandle_t xReturn;

------> configASSERT( portVALID_TCB_MEM(pxTaskBuffer) );
-------------------------------------------------------------------------------------------
I have the same problem on WROVER (working on WROM)
Can it be related to allocating StackBuffer or TaskBuffer to spi-ram ?
The only difference between these two is WROVER allocating heap in spiRAM ?

Post Reply