MicroPython on ESP32 with SPIRAM support

apluess
Posts: 1
Joined: Thu Apr 12, 2018 6:42 am

Re: MicroPython on ESP32 with SPIRAM support

Postby apluess » Thu Apr 12, 2018 7:38 am

Thank you for the awesome SPIRAM contribution. I like also the thread support that is needed for many of my projects. Here my question:

I create a new thread that runs in an endless while loop like

while isRunning:
---
I would like to stop this thread when I press ^C in the main REPL thread (without catching the Keyboard Interrupt exception explicitely). How can my thread know, if the REPL thread got a ^C and stop gently?

I tried the _thread.status() or _thread.list(). But the MainThread is still in state: running, even when I pressed ^C.

Thanks.
Aegidius

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: MicroPython on ESP32 with SPIRAM support

Postby loboris » Thu Apr 12, 2018 6:42 pm

There are many ways to comunicate with a thread and to end it. I would recommend to study the threads Wiki page and thread example.

A better place to discuss questions like this may be this forum.

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: MicroPython on ESP32 with SPIRAM support

Postby rudi ;-) » Sat Nov 03, 2018 5:00 am

Hi Boris

i run in a small circle:

mkrules.mk::115

Code: Select all

	$(Q)$(MPY_CROSS) -o $@ -s $(<:$(FROZEN_MPY_DIR)/%=%) $<
make[1]: /c/Users/rudi/eclipse-workspace-oxygen/7202_boris/components/micropython/mpy-cross/mpy-cross: Command not found
make[1]: *** [/c/Users/rudi/eclipse-workspace-oxygen/7202_boris/components/micropython/py/mkrules.mk:115: /c/Users/rudi/eclipse-workspace-oxygen/7202_boris/build/frozen_mpy/ak8963.mpy] Error 127
make: *** [c:/sdk32/esp-idf-7202/make/project.mk:505: component-micropython-build] Error 2


the folder mpy-cross is empty and no mpy-cross file there right?

which file i am missing? which further step is to do?
txs in advance

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: MicroPython on ESP32 with SPIRAM support

Postby loboris » Sat Nov 03, 2018 4:25 pm

@rudi

I supose you'we cloned the repository from GitHub.

After cloning, you have to run

Code: Select all

./BUILD.sh menuconfig
to unpack esp-idf and toolchain.

After that you should run

Code: Select all

./BUILD.sh all
to build the firmware.
mpy-cross will be compiled for your OS and placed in components/micropython/mpy-cross, it is not there after cloning as it has to be buit for the operating system you are running on.
For mpy-cross to cuccessfully build, you must have make and gcc for your OS installed.
If they are not installed you have to install them running (or equivalent command for your distribution):

Code: Select all

sudo apt-get install build-essential
Always use BUILD.sh script for any build/flash operation, it will enshure the build passes without errors

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: MicroPython on ESP32 with SPIRAM support

Postby rudi ;-) » Sat Nov 03, 2018 8:06 pm

@Boris
txs!.jpg
txs!.jpg (29.01 KiB) Viewed 14462 times
i must say - you did an amazing work Boris!
i did think very complex ( set IDF Path, set toolchain, used as component and and and ..) and want install it on a complex other way and run on win 7/64 in a circle with waste time. :roll:

you did a great BUILD.sh and with this one all was installed shortly without problem and runs like a clock work.
thank you for the hint and help.

now my next step is psram.c
i think i can use ( expand ) your esp-idf that was installed by BUILD right?
how is this later done with updates if the esp-idf is change?
is there a "update" function later? or is this still available and i did not see/read?

txs again Boris!
have a nice weekend!


best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: MicroPython on ESP32 with SPIRAM support

Postby loboris » Sat Nov 03, 2018 11:12 pm

rudi ;-) wrote:now my next step is psram.c
i think i can use ( expand ) your esp-idf that was installed by BUILD right?
how is this later done with updates if the esp-idf is change?
is there a "update" function later? or is this still available and i did not see/read?
I don't quite understand what you mean by "next step is psram.c". psRAM is fully supported in this MicroPython port and works very well.

esp-idf is included as an archive in the repository because couple of patches were needed for some special functions in MicroPython. It is updated regularly and when you do git pull, if changed in the repository, it will be updated. BUILD.sh can detect the changed esp-idf archive and replaces the old unpacked directory (<base_dir>/Tools/esp-idf/) with the new one. The same is true for ESP32 toolchain.

BTW, you can post any question or suggestion also on the dedicated forum.
Also the GitHub repository Wiki pages gives quite a lot of information specific to this MicroPython port.

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: MicroPython on ESP32 with SPIRAM support

Postby rudi ;-) » Sun Nov 04, 2018 5:15 am

loboris wrote:
I don't quite understand what you mean by "next step is psram.c". psRAM is fully supported in this MicroPython port and works very well.
sry for confuse
i mean the pico-d4-v4 pico-d4-v4.1 psram theme on PicoD4

i played just in time with the spiram_psram.c and Kconfig a little likewise

spiram_psram.c

Code: Select all

// PICOD4 Support by custom change
// see customer rudi 29.August 2017
// https://www.esp32.com/viewtopic.php?f=2&t=2713&start=30#p13380
// proposal to do:
// change for menuconfig work later to set the right esp32 modul
// or let it do this auto mode by chip package identify
// comes later as patch
// #define WROVER 1
#ifdef CONFIG_PSRAM_PICO_D4_V4
#define PICO 1
#endif
#ifdef CONFIG_PSRAM_WROVER
#define WROVER 1
#endif

#ifdef PICO
#define FLASH_CLK_IO       6 //Psram clock is a delayed version of this in 40MHz mode
#define FLASH_CS_IO       16 // 11
#define PSRAM_CLK_IO      10 // 17
#define PSRAM_CS_IO        9 // 16
#define PSRAM_SPIQ_IO     17 // 7
#define PSRAM_SPID_IO      8
#define PSRAM_SPIWP_IO     7 // 10
#define PSRAM_SPIHD_IO    11 // 9
#endif
#ifdef WROVER
#define FLASH_CLK_IO       6 //Psram clock is a delayed version of this in 40MHz mode
#define FLASH_CS_IO       11
#define PSRAM_CLK_IO      17
#define PSRAM_CS_IO       16
#define PSRAM_SPIQ_IO     7
#define PSRAM_SPID_IO     8
#define PSRAM_SPIWP_IO    10
#define PSRAM_SPIHD_IO    9
#endif
Kconfig

Code: Select all

menuconfig PSRAMMODULES
    bool "PSRAMMODUL"
    default n
    help
        Select this option to enable a PSRAMMODUL.

choice PSRAMMODUL_SELECT
    prompt "Select the ESP_PSRAM_MODUL you want used for PSRAM"
	default CONFIG_PSRAM_PICO_D4_V4
	depends on PSRAMMODULES
	help
		PSRAM_WROVER 			Wrover Modul (all)
		PSRAM_PICO_D4_V4		PICO D4 V4 Modul

		You can select here a Modul you want use for PSRAM.

config PSRAM_WROVER
    bool "WROVER Modul (all)"
    help
        Select this: Wrover Modul (all)

config PSRAM_PICO_D4_V4
    bool "PICO D4 V4"
    help
        Select this: PICO D4 V4 Modul

endchoice
and solder on week start a single psram on pico d4 v4 board directly for a test.

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: MicroPython on ESP32 with SPIRAM support

Postby loboris » Sun Nov 04, 2018 10:16 am

I understand now. I've just saw that post.
Great, as I don't have a PICO board, I can't test it. I hope you'll succeed...

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: MicroPython on ESP32 with SPIRAM support

Postby rudi ;-) » Sun Nov 04, 2018 9:42 pm

loboris wrote:I understand now. I've just saw that post.
Great, as I don't have a PICO board, I can't test it. I hope you'll succeed...
hi boris
thank you for the many efforts and work you put into the project.
Maybe I could contribute a small part and help you with it.

pSRAM works on Pico-D4-V4 Board after Mod on the Board and add pSRAM

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: MicroPython on ESP32 with SPIRAM support

Postby rudi ;-) » Tue Jan 15, 2019 7:56 pm

@loboris
good new year boris, check (official pico psram support) it out.. :)

kconfig configurable #CS


best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: No registered users and 39 guests