Giter Site home page Giter Site logo

loboris / micropython_esp32_psram_lobo Goto Github PK

View Code? Open in Web Editor NEW
815.0 80.0 341.0 1.04 GB

MicroPython for ESP32 with psRAM support

License: Other

Yacc 0.02% Shell 0.45% Makefile 0.84% C 89.85% CMake 0.36% C++ 4.97% Perl 0.25% Visual Basic 0.11% Assembly 0.03% Python 2.64% HTML 0.03% CSS 0.01% Roff 0.26% Objective-C 0.18%
esp32 esp-idf micropython display tft libcurl gsm pppos

micropython_esp32_psram_lobo's Introduction

MicroPython for ESP32

with support for 4MB of psRAM


This repository can be used to build MicroPython for ESP32 boards/modules with psRAM as well as for ESP32 boards/modules without psRAM.

Building on Linux, MacOS and Windows (including Linux Subsystem on Windows 10) is supported.

MicroPython works great on ESP32, but the most serious issue is still (as on most other MicroPython boards) limited amount of free memory.
This repository contains all the tools and sources necessary to build working MicroPython firmware which can fully use the advantages of 4MB (or more) of psRAM.
It is huge difference between MicroPython running with less than 100KB of free memory and running with 4MB of free memory.


ESP32 can use external SPIRAM (psRAM) to expand available RAM up to 16MB.

Currently, there are several modules & development boards which incorporates 4MB of psRAM:


Wiki pages with detailed documentation specific to this MicroPython port are available.

Some examples can be found in modules_examples directory.


This repository contains all the tools and sources necessary to build working MicroPython firmware which can fully use the advantages of 4MB (or more) of psRAM

It is huge difference between MicroPython running with less than 100KB of free memory and running with 4MB of free memory.


The MicroPython firmware is built as esp-idf component

This means the regular esp-idf menuconfig system can be used for configuration. Besides the ESP32 configuration itself, many MicroPython options can also be configured via menuconfig.

This way many features not available in standard ESP32 MicroPython are enabled, like unicore/dualcore, all Flash speed/mode options etc. No manual sdkconfig.h editing and tweaking is necessary.


Features

  • MicroPython core based on latest build from main Micropython repository
  • added changes needed to build for ESP32 with psRAM
  • Default configuration has 2MB of MicroPython heap, 20KB of MicroPython stack, ~200KB of free DRAM heap for C modules and functions
  • MicroPython can be built in unicore (FreeRTOS & MicroPython task running only on the first ESP32 core, or dualcore configuration (MicroPython task running on ESP32 App core)
  • ESP32 Flash can be configured in any mode, QIO, QOUT, DIO, DOUT
  • BUILD.sh script is provided to make building MicroPython firmware as easy as possible
  • Internal Fat filesystem is built with esp-idf wear leveling driver, so there is less danger of damaging the flash with frequent writes.
  • SPIFFS filesystem is supported and can be used instead of FatFS in SPI Flash. Configurable via menuconfig
  • Flexible automatic and/or manual filesystem configuration
  • sdcard support is included which uses esp-idf sdmmc driver and can work in SD mode (1-bit and 4-bit) or in SPI mode (sd card can be connected to any pins). For imformation on how to connect sdcard see the documentation.
  • Files timestamp is correctly set to system time both on internal fat filesysten and on sdcard
  • Native ESP32 VFS support for spi Flash & sdcard filesystems.
  • RTC Class is added to machine module, including methods for synchronization of system time to ntp server, deepsleep, wakeup from deepsleep on external pin level, ...
  • Time zone can be configured via menuconfig and is used when syncronizing time from NTP server
  • Built-in ymodem module for fast transfer of text/binary files to/from host
  • Some additional frozen modules are added, like pye editor, urequests, functools, logging, ...
  • Btree module included, can be Enabled/Disabled via menuconfig
  • _threads module greatly improved, inter-thread notifications and messaging included
  • Neopixel module using ESP32 RMT peripheral with many new features
  • DHT module implemented using ESP32 RMT peripheral
  • 1-wire module implemented using ESP32 RMT peripheral
  • i2c module uses ESP32 hardware i2c driver
  • spi module uses ESP32 hardware spi driver
  • adc module improved, new functions added
  • pwm module, ESP32 hardware based
  • timer module improved, new timer types and features
  • curl module added, many client protocols including FTP and eMAIL
  • ssh module added with sftp/scp support and exec function to execute program on server
  • display module added with full support for spi TFT displays
  • mqtt module added, implemented in C, runs in separate task
  • mDNS module added, implemented in C, runs in separate task
  • telnet module added, connect to REPL via WiFi using telnet protocol
  • ftp server module added, runs as separate ESP32 task
  • GSM/PPPoS support, connect to the Internet via GSM module
  • OTA Update supported, various partitions layouts
  • Eclipse project files included. To include it into Eclipse goto File->Import->Existing Projects into Workspace->Select root directory->[select MicroPython_BUILD directory]->Finish. Rebuild index.

How to Build


Detailed instructions on MicroPython building process are available in the Wiki.


Using file systems

Detailed information about using MicroPython file systems are available in the Wiki.


Some examples

Using new machine methods and RTC:

import machine

rtc = machine.RTC()

rtc.init((2017, 6, 12, 14, 35, 20))

rtc.now()

rtc.ntp_sync(server="<ntp_server>" [,update_period=])
  # <ntp_server> can be empty string, then the default server is used ("pool.ntp.org")

rtc.synced()
  # returns True if time synchronized to NTP server

rtc.wake_on_ext0(Pin, level)
rtc.wake_on_ext1(Pin, level)
  # wake up from deepsleep on pin level

machine.deepsleep(10000)
ESP32: DEEP SLEEP

# ...
# ...

Reset reason: Deepsleep wake-up
Wakeup source: RTC wake-up
    uPY stack: 19456 bytes
     uPY heap: 3073664/5664/3068000 bytes (in SPIRAM using malloc)

MicroPython ESP32_LoBo_v3.1.0 - 2017-01-03 on ESP32 board with ESP32
Type "help()" for more information.

machine.wake_reason()
  # returns tuple with reset & wakeup reasons
machine.wake_description()
  # returns tuple with strings describing reset & wakeup reasons

Using sdcard module:

import uos

uos.mountsd()
uos.listdir('/sd')

Working directory can be changed to root of the sd card automatically on mount:

>>> import uos
>>> uos.mountsd(True)
---------------------
 Mode:  SD (4bit)
 Name: NCard
 Type: SDHC/SDXC
Speed: default speed (25 MHz)
 Size: 15079 MB
  CSD: ver=1, sector_size=512, capacity=30881792 read_bl_len=9
  SCR: sd_spec=2, bus_width=5

>>> uos.listdir()
['overlays', 'bcm2708-rpi-0-w.dtb', ......
>>>

Tested on ESP-WROVER-KIT v3 Tested on


Example terminal session

I (0) cpu_start: App cpu up.
I (1569) spiram: SPI SRAM memory test OK
I (1570) heap_init: Initializing. RAM available for dynamic allocation:
D (1570) heap_init: New heap initialised at 0x3ffae6e0
I (1575) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (1581) heap_init: New heap initialised at 0x3ffc1a00
I (1586) heap_init: At 3FFC1A00 len 0001E600 (121 KiB): DRAM
I (1593) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (1599) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (1606) heap_init: New heap initialised at 0x4009d70c
I (1611) heap_init: At 4009D70C len 000028F4 (10 KiB): IRAM
I (1617) cpu_start: Pro cpu start user code
I (1622) spiram: Adding pool of 4096K of external SPI memory to heap allocator
I (1630) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
D (1646) clk: RTC_SLOW_CLK calibration value: 3305242
D (89) intr_alloc: Connected src 46 to int 2 (cpu 0)
D (90) intr_alloc: Connected src 57 to int 3 (cpu 0)
D (90) intr_alloc: Connected src 24 to int 9 (cpu 0)
I (95) cpu_start: Starting scheduler on PRO CPU.
D (0) intr_alloc: Connected src 25 to int 2 (cpu 1)
I (4) cpu_start: Starting scheduler on APP CPU.
D (119) heap_init: New heap initialised at 0x3ffe0440
D (125) heap_init: New heap initialised at 0x3ffe4350
D (130) intr_alloc: Connected src 16 to int 12 (cpu 0)
D (145) nvs: nvs_flash_init_custom partition=nvs start=9 count=4
D (178) intr_alloc: Connected src 34 to int 3 (cpu 1)
D (187) intr_alloc: Connected src 22 to int 4 (cpu 1)

Internal FS (SPIFFS): Mounted on partition 'internalfs' [size: 1048576; Flash address: 0x2D0000]
----------------
Filesystem size: 956416 B
           Used: 512 B
           Free: 955904 B
----------------

FreeRTOS running on BOTH CORES, MicroPython task running on both cores.
Running from partition at 10000, type 10 [MicroPython_1].

 Reset reason: Power on reset
    uPY stack: 19456 bytes
     uPY heap: 3073664/5664/3068000 bytes (in SPIRAM using malloc)

MicroPython ESP32_LoBo_v3.1.0 - 2017-01-03 on ESP32 board with ESP32
Type "help()" for more information.
>>> 
>>> import micropython, machine
>>> 
>>> micropython.mem_info()
stack: 752 out of 19456
GC: total: 3073664, used: 5904, free: 3067760
 No. of 1-blocks: 19, 2-blocks: 7, max blk sz: 325, max free sz: 191725
>>> 
>>> machine.heap_info()
Heap outside of MicroPython heap:
---------------------------------
              Free: 239920
         Allocated: 52328
      Minimum free: 233100
      Total blocks: 85
Largest free block: 113804
  Allocated blocks: 79
       Free blocks: 6

SPIRAM info:
------------
              Free: 1048532
         Allocated: 3145728
      Minimum free: 1048532
      Total blocks: 2
Largest free block: 1048532
  Allocated blocks: 1
       Free blocks: 1
>>>

micropython_esp32_psram_lobo's People

Contributors

loboris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

micropython_esp32_psram_lobo's Issues

DNS server ?

I need to do an IoT project that has a configuration mode. In this mode, the ESP32 would:

  • spawn a WIFI access point (OK),
  • serve HTML for doing configuration of the connected thing - like WIFI (OK),
  • act as DNS server (catching all requests from connected WIFI client) (KO).
    I have seen that before with ESP8266, is there a possibility to integrate this function ?
    I know there is mDNS but I would rather use standard DNS service. Do you think it is overkill ?

Telnet in AP

Hi Boris,

You have set the FTP to work for both AP and STA. Can you do the same for Telnet ?

Also, would it be possible to send to the FTP or the Telnet on which WLAN we want it to connect. We cannot have both STA and AP work at the same time and have the FTP and Telnet. That would be great to have this optional argument.

Tested with previous (OLD, 2.0.6) version. I will check later with the new version.

Regards,
Benoit

RTC timezone : not applied ?

Hello Loboris,
I set timezone to Europe/Paris in menuconfig.
Time is NTP synced.

>>> utime.gmtime()
(2018, 1, 29, 15, 40, 52, 2, 29)
>>> utime.localtime()
(2018, 1, 29, 15, 40, 58, 2, 29)

It seems that timezone is not applied (it replies the same between gmttime and localtime, and both are not GMT+1 as they should be in France) ?

xtensa tool chain appears to be 32-bit on 64-bit system

I certainly may be doing something wrong but when I cloned the new directory, I appear to get the 32-bit xtensa tool chain and not the 64-bit tool chain although I am running on 64-bit Ubuntu 17.10. I believe this is the reason that I am getting build errors, which were initially file not found but after installing 32-bit architecture components the file not found goes away but still getting build errors.

When I looked into the deactivated repository, the xtensa tool chain was 64-bit.

Secure boot and flash encryption

Is there any example of working with flash-encryption? For example, I need to write to the internal memory a file that could be read from the python script's, but it's impossible to read it using ampy etc.

Are there any way to protect or close access to the uart console after the device is burned?

Documentation : compile

For information with Debian 9 I had to install those packages :
libncurses5-dev
flex
bison
gperf

time.ticks_ms, us return negative values

The new 64-bit versions of ticks_ms and ticks_us return negative values.

This is inconvenient in code that checks for a period to expire. E.g.

`python
import time

last_time = 0

while True:
# do this every 100ms
while (time.ticks_ms()-last_time) < 100:
# let's wait until 100ms passed
pass
last_time = time.ticks_ms()
print("do this every 100ms!")
`

Possible fixes are to initialize last_time to a very large negative value, or compute the abs value of the time difference in the inner while loop.

Still, it would be better if ticks_XX always returned positive values (consistent with standard MicroPython).

Makefile:324: recipe for target 'zconf.hash.c' failed

This is my first, failed attempt to build MicroPython_ESP32_psRAM_LoBo on Xubuntu LTS 16.04.
I followed all Wiki instructions.

$ ./BUILD.sh
make[1]: Entering directory '/home/opt/loboris/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/tools/kconfig'
sed -E "s/\\x0D$//" zconf.gperf | gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$' -p -t
Makefile:324: recipe for target 'zconf.hash.c' failed
make[1]: Leaving directory '/home/opt/loboris/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/tools/kconfig'
make[1]: Entering directory '/home/opt/loboris/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/tools/kconfig'
sed -E "s/\\x0D$//" zconf.gperf | gperf -t --output-file zconf.hash.c -a -C -E -g -k '1,3,$' -p -t
Makefile:324: recipe for target 'zconf.hash.c' failed
make[1]: Leaving directory '/home/opt/loboris/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/tools/kconfig'
/home/opt/loboris/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/make/project_config.mk:20: recipe for target '/home/opt/loboris/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/tools/kconfig/mconf' failed

===========================================
Error creatimg 'sdkconfig', cannot continue
===========================================


---------------------
MicroPython for ESP32
---------------------

grep: sdkconfig: No such file or directory
grep: sdkconfig: No such file or directory
grep: sdkconfig: No such file or directory
grep: sdkconfig: No such file or directory
grep: sdkconfig: No such file or directory
'sdkconfig' NOT FOUND, RUN ./BUILD.sh menuconfig FIRST.

'make all' FAILED!

ILI9341 and invrot parameter for M5Stack

I am unable to find the correct invrot parameter with M5Stack which uses ILI9341. Closes one to work is 1 but it causes mirrored display which also is portrait instead of landscape.

tft = display.TFT()
tft.init(
    tft.ILI9341,
    width=320,
    height=240,
    mosi=m5stack.TFT_MOSI_PIN,
    miso=m5stack.TFT_MISO_PIN,
    clk=m5stack.TFT_CLK_PIN,
    cs=m5stack.TFT_CS_PIN,
    dc=m5stack.TFT_DC_PIN,
    rst_pin=m5stack.TFT_RST_PIN,
    backl_pin=m5stack.TFT_LED_PIN,
    backl_on=1,
    speed=2600000,
    invrot=1,
    bgr=True
)

It has been a while when I last read the specsheet but IIRC mirroring was affected by MADCTL. I had similar problem with MicroPython driver but with trial and error figured out correct value for M5Stack being 0x08.

Am I missing something obvious?

Should pwm.duty() accept a float?

I am trying to contol a hobby servo with pwm:
from machine import PWM
pwm=PWM(27, freq=50)

pwm.duty(1.5)
Traceback (most recent call last):
File "", line 1, in
TypeError: can't convert float to in

Should be seeing 15 bit resolution, with (0-100)% seeing less than 7.
Perhaps I am missing something?

MicroWebSrv : update please ?

Hello, sorry, I do a lot of issue entry.
I am discovering your Micropython flavour and it is really interesting !
I found that method IsStarted() is not present in the static module you have done with MicroWebSrv.
Maybe it is just an update to do ?
Anyway thank you for all your work !

Burn firmware

Hi boris,

I'm using esptool to burn the firmware in a ESP32 DEV module, after burn it, the device keeps in an infinite loop showing:

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (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:0x3f400020,len:316164
ets Jun  8 2016 00:22:57

This is how I use esptool

esptool.py --port COMX --chip esp32 --baud 460800 write_flash -z 0x1000 MicroPython.bin 2>&1

I've searched info in the wiki, but I didn't find any reference.
Can you confirm the command is correct?

EDIT: The other micropython firmware runs, without problem with the same command

Can't use import gsm

Boris,

Can't use GSM with MicroPython ESP32_LoBo_v3.1.14 - 2017-01-29 on ESP32 board with ESP32

import gsm
Traceback (most recent call last):
File "", line 1, in
ImportError: no module named 'gsm'

What is wrong?
I've flashed my ESP32Dev with esp32_all firmware.

Thanks again!

Djair

build error when power management is enabled

I enabled power management and getting a compilation error.
component config->power management->support for power management
(all other options on that panel remained disabled)

CC build/driver/spi_master_utils.o
In file included from /home/bill/esp32/LoBo/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/driver/include/driver/spi_master_utils.h:20:0,
from /home/bill/esp32/LoBo/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/driver/./spi_master_utils.c:21:
/home/bill/esp32/LoBo/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/driver/include/driver/spi_master_internal.h:55:5: error: unknown type name 'esp_pm_lock_handle_t'
esp_pm_lock_handle_t pm_lock;
/home/bill/esp32/LoBo/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/driver/./spi_master_utils.c: In function 'spi_set_speed':
/home/bill/esp32/LoBo/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/components/driver/./spi_master_utils.c:447:9: warning: unused variable 'effclk' [-Wunused-variable]
int effclk=handle->clk_cfg.eff_clk;

Thread function from class

For example:
Class my: _inti(self): def start(self):
my_test = my()
How run in _thread : _thread.start_new_thread("MY", my.start, ()) argument problem.

With navite micropython it work:
_thread.start_new_thread(my.start, ())

Change client_id (network.mqtt)

Hi,

I am trying to change my client_id as per the example and I have a
"extra keyword arguments given"
If I have two boards with the same client_id, I have the old one disconnected.

Regards,
Benoit

Only 4 PWM channels available

Note:
The updated machine.PWM module raises "ValueError: out of PWM channels".

This is since the modified code assigns a new timer to every PWM object. Since the ESP32 has only 4 ledc timers but 8 ledc channels, only 4 channels can be used, all with different frequencies and duty cycles.

Many applications require several PWM channels all at the same frequency but with different duty cycles. Then the full 8 channels can be useful.

For now I do not need more than 4 channels. But ultimately probably a change is in order, and that may break the existing API.

_thread.kill problem

>>> import ftp
>>> ftp=_thread.start_new_thread("FTP", ftp.ftpserver, ())
>>> FTP Server started on  192.168.10.115

>>>
>>>
>>> _thread.list()
ID=1073536484, Name: FTP, State: running, Stack=3072, MaxUsed=1796, Type: PYTHON
ID=1073447696, Name: MainThread, State: running, Stack=20480, MaxUsed=3456, Type: MAIN
>>> _thread.kill(1073536484)
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
 - mp_task (CPU 1)
Tasks currently running:
CPU 0: IDLE
CPU 1: IDLE
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
 - mp_task (CPU 1)
Tasks currently running:
CPU 0: IDLE
CPU 1: IDLE
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
 - mp_task (CPU 1)
Tasks currently running:
CPU 0: IDLE
CPU 1: IDLE

ntp_sync() stack overflow with v3.1.4

Getting a stack overflow when using ntp_sync() with v3.1.4.

>>> import os
>>> os.uname()
(sysname='esp32', nodename='esp32', release='3.1.4', version='ESP32_LoBo_v3.1.4 on 2017-01-14', machine='ESP32 board with ESP32')
>>> import machine
>>> rtc = machine.RTC()
>>> rtc.ntp_sync('')
>>>
>>> ***ERROR*** A stack overflow in task SNTP has been detected.
abort() was called at PC 0x4008d0b8 on core 0

Backtrace: 0x4008cfd4:0x3ffc2bf0 0x4008d09f:0x3ffc2c10 0x4008d0b8:0x3ffc2c30 0x40089d9b:0x3ffc2c50 0x4008b974:0x3ffc2c70 0x4008b92a:0x00000000

CPU halted.

Binary Image: Partition table is wrong

The binary version of the pre-built partition table shows a size of 64k for the app. That's a little bit too small.
Edit: Fixing that with a binary editor worked, setting the partition size to 0x160000, and the offset of the next partition to 0x200000

Raspberry Pi Setup Contribution

Hi,

I would like to write about how to configure a Raspberry Pi to use your firmware. How can I contribute to your Wiki ?

As soon as I finish and it's working I will post a link for the binary toolchain (latest version to match yours) and a step by step from a brand new RPi3.

Regards,
Benoit

Flash fails on osx

Running a ./BUILD.sh fails with the following error:

=========================================
Flashing MicroPython firmware to ESP32...
=========================================
Building partitions from /Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/partitions_mpy.csv...
MPY /Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/micropython/esp32/modules/logging.py
'make flash' FAILED!

Running a make flash directly outputs:

hermes:MicroPython_BUILD matt$ make flash
/Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/micropython/py/mkenv.mk:59: warning: undefined variable `HOST_PLATFORM'
/Users/matt/esp/esp-idf/make/component_wrapper.mk:180: warning: overriding commands for target `libmicropython.a'
/Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/micropython/py/mkrules.mk:132: warning: ignoring old commands for target `libmicropython.a'
/Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/micropython/py/mkrules.mk:113: warning: undefined variable `MPY_CROSS_FLAGS'
MPY /Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/micropython/esp32/modules/logging.py
make[1]: /Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/micropython/mpy-cross/mpy-cross: No such file or directory
make[1]: *** [/Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/build/frozen_mpy/logging.mpy] Error 1
make: *** [component-micropython-build] Error 2

Could this be related to:
micropython/micropython#2825

cd /Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/mpy_cross_build/mpy-cross
make

Followed by

ln -s /Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/mpy_cross_build/mpy-cross/mpy-cross /Users/matt/git/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/micropython/mpy-cross/

Seemed to resolve the problem for me. Maybe I missed a step in the instructions?

Problem with UART : UART event queue full

Hello,
I am trying to use UART2. For this, I try this code:
import machine import time uart = machine.UART(2, tx=16, rx=17) uart.init(115200, bits=8, parity=None, stop=1, timeout=10000) uart.readline()

After having run this code, I print "hello" three times with a connected software (putty on /dev/ttyS0, connected to a CP2102 USB to UART Bridge Controller, connected to TX2 and RX2 Pins).

This is what I get on the REPL:
`MicroPython ESP32_LoBo_v3.1.14 - 2017-01-29 on ESP32 board with ESP32
Type "help()" for more information.

import machine
import time
uart = machine.UART(2, tx=16, rx=17)
uart.init(115200, bits=8, parity=None, stop=1, timeout=10000)
uart.readline()
W (14588) uart: UART event queue full
W (14692) uart: UART event queue full
W (15597) uart: UART event queue full
W (15821) uart: UART event queue full
W (15989) uart: UART event queue full
W (16125) uart: UART event queue full
W (16293) uart: UART event queue full
W (16453) uart: UART event queue full
Task watchdog got triggered. The following tasks did not reset the watchdog in time:

  • mp_task (CPU 0/1)
    Tasks currently running:
    CPU 0: Telnet
    CPU 1: IDLE
    b'hello\rhello\rhello\r'

`

I think I am missing something or maybe there is a problem in the firmware because:

  • readline() doesn't seems to work as expected (returns the full buffer instead of returning only one line)
  • UART event queue doesn't seems to be consumed.

Please help Boris ?
Thank you, Gautier.

os.listdir() BUG

>>> os.listdir()
['boot.py', 'lib', 'file1.py']
>>> os.listdir('lib')
['file2.py', 'dir1/file2.py', 'dir1/file1.py', 'dir1/dir2', 'dir1/dir2/file3.py', 'dir1/dir3', 'dir1']
>>> os.listdir('lib/dir1')
['file2.py', 'file1.py', 'dir2', 'dir2/file3.py', 'dir3']
>>> 

Modules not presents

Hi and first thanks for this for of micropython that is really impressive !
I've made an update this morning from the version 2.0.8 to the versoin 3.1.0 and some of the modules I used were not present. ds18x20 or onwire for exemple.
Here is the output of help('modules') for official micropython 1.9.3

MicroPython v1.9.3-238-g42c4dd09 on 2018-01-02; ESP32 module with ESP32
Type "help()" for more information.
>>> help('modules')
__main__          framebuf          re                upip
_boot             gc                select            upip_utarfile
_onewire          hashlib           socket            upysh
_thread           heapq             ssl               urandom
apa106            inisetup          struct            ure
array             io                sys               urequests
binascii          json              time              uselect
btree             machine           ubinascii         usocket
builtins          math              ucollections      ussl
cmath             micropython       uctypes           ustruct
collections       neopixel          uerrno            utime
dht               network           uhashlib          utimeq
ds18x20           ntptime           uheapq            uzlib
errno             onewire           uio               websocket
esp               os                ujson             zlib
flashbdev         random            uos
Plus any modules on the filesystem
>>>

Here is the output of help('modules') for Loboris_Micropython 2.0.8

MicroPython ESP32_LoBo_v2.0.8 - 2017-11-04 on ESP32 board with ESP32
Type "help()" for more information.
>>> help('modules')
__main__          heapq             socket            upip
_onewire          io                ssd1306           upip_utarfile
_thread           json              ssl               upysh
array             logging           struct            urandom
binascii          machine           sys               ure
builtins          math              time              urequests
cmath             microWebSrv       tpcalib           uselect
collections       microWebTemplate  ubinascii         usocket
display           micropython       ucollections      ussl
ds18x20           network           uctypes           ustruct
errno             onewire           uerrno            utime
framebuf          os                uftpserver        utimeq
freesans20        pye               uheapq            uzlib
functools         random            uio               writer
gc                re                ujson             ymodem
hashlib           select            uos               zlib
Plus any modules on the filesystem
>>>

Here is the output of help('modules') for Loboris_Micropython 3.1.0

MicroPython ESP32_LoBo_v3.1.0 - 2017-01-03 on ESP32 board with ESP32
Type "help()" for more information.
>>> help('modules')
__main__          io                ssl               upysh
_thread           json              struct            urandom
array             logging           sys               ure
binascii          machine           time              urequests
btree             math              tpcalib           uselect
builtins          microWebSrv       ubinascii         usocket
cmath             microWebTemplate  ucollections      ussl
collections       micropython       uctypes           ustruct
display           network           uerrno            utime
errno             os                uftpserver        utimeq
framebuf          pye               uheapq            uzlib
freesans20        random            uio               websocket
functools         re                ujson             writer
gc                select            uos               ymodem
hashlib           socket            upip              zlib
heapq             ssd1306           upip_utarfile
Plus any modules on the filesystem
>>>

SPI SD conflict with display SPI

Hi lobo, thank you so much for this for micropython that is best version of ESP32.
My SPI SD card used same SPI pinout with display SPI ,but different CS pin, it not work togerther well.

>>> os.mountsd()
D (102335) sdspi_host: sdspi_host_init_slot: SPI2 miso=19 mosi=23 sck=18 cs=4 cd=-1 wp=-1, dma_ch=1
D (102336) spi: SPI1 use gpio matrix.
D (102338) intr_alloc: Connected src 30 to int 9 (cpu 1)
D (102343) spi_master: SPI1: New device added, external CS0, effective clock: 20000kHz
I (102351) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
D (102361) sdmmc_cmd: sdmmc_card_init
D (102407) sdmmc_cmd: SDHC/SDXC card
D (102407) sdspi_host: data CRC set=1
D (102407) sdmmc_cmd: host_ocr=0x40ff8000 card_ocr=0x80ff8000
D (102409) sdmmc_cmd: sdmmc_card_init: host_ocr=40ff8000, card_ocr=80ff8000
D (102417) sdmmc_cmd: switching to DS bus mode
D (102420) sdspi_host: Setting card clock to 20000 kHz
D (102426) spi_master: SPI1: New device added, external CS0, effective clock: 20000kHz
D (102434) vfs_fat_sdmmc: using pdrv=0
---------------------
 Mode: SPI
 Name: SD   
 Type: SDSC
Speed: default speed (25 MHz)
 Size: 948 MB
  CSD: ver=0, sector_size=512, capacity=1941504 read_bl_len=9
  SCR: sd_spec=2, bus_width=5

>>> 
>>> os.listdir('/sd')
['hk', 'System Volume Information', 'dirtest']
>>> 
>>> tft.clear()
>>> os.listdir('/sd')
D (146528) sdspi_host: poll_data_token: timeout
E (146528) sdspi_host: sdspi_host_start_command: cmd=17 error=0x107
D (146529) sdmmc_cmd: sdmmc_req_run returned 0x107
E (146533) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x107
E (146541) diskio_sdmmc: sdmmc_read_blocks failed (263)
D (146547) vfs_fat: vfs_fat_readdir_r: fresult=1
[]
>>> os.listdir('/sd')
['hk', 'System Volume Information', 'dirtest']
>>>

SSH?

I've built an image with the SSH module included, but
it's not obvious how to access it.

License and source code ?

Hello Loboris and congratulations for your work !
I have a question concerning your work. Do you provide the source code ? On which license do you produce your code ? For example for uftpserver, I didn't found the source.

Thank you,
BR

network connecting to non-existent wifi hangs

This worked in the previous version, but since the big update hangs with a stack overflow:

MicroPython ESP32_LoBo_v3.1.1 - 2017-01-07 on ESP32 with ESP32
Type "help()" for more information.
>>> sta_if = network.WLAN(network.STA_IF)
>>> sta_if.active(True)
True
>>> sta_if.connect("nonexistent","nothing")
>>> no AP found
no AP found
***ERROR*** A stack overflow in task eventTask has been detected.
abort() was called at PC 0x40090c90 on core 0

Backtrace: 0x40090b84:0x3ffc93b0 0x40090c77:0x3ffc93d0 0x40090c90:0x3ffc93f0 0x4008d584:0x3ffc9410 0x4008f1f8:0x3ffc9430 0x4008f1ae:0x00000000

CPU halted.

Works fine with an actual SSID, and worked fine without an actual SSID in previous version.

OTA (ota.set_bootpart(partition))

Hi,

I was able to create partition with flash -a [size in kb] each time I flash, if I am not using this option, it is 64 KB only for both partition ... Very strange (not 1 MB). I did not tried yet the 3 partitions version.

Also, I cannot access the function set_bootpart. Like if the partition was not accessible whatever the name (MicroPython, MicroPython_1, MicroPython_2). So I tried the start pointed to the example server. I was able to update and boot.

Let's hope it is a simple modification.

Regards,
Benoit

RTC irq module missing?

Should be able to enter deep sleep and wake up on a timer?
http://docs.micropython.org/en/v1.9.2/esp8266/esp8266/tutorial/powerctrl.html

import machine
rtc = machine.RTC()
dir(rtc)
['init', 'now', 'ntp_sync', 'ntp_state', 'synced', 'wake_on_ext0', 'wake_on_ext1', 'write', 'read', 'clear', 'write_string', 'read_string']
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'RTC' object has no attribute 'irq'

network.LAN support

Hi lobo, first of all thank you so much

New firmware doesn't have network.LAN module or I can't activate. can you help me about this issue

network.LAN(id = None, mdc = Pin(23), mdio = Pin(18), power = Pin(14), phy_addr = 1, phy_type = network.PHY_LAN8720)

AttributeError: 'module' object has no attribute 'LAN'

Thanks for your help king regards

Populate the WIFI event.

Hi Boris,
Since the old MicroPython_ESP32_psRAM_LoBo Issues diapered,
Is the WIFI events/call back had been implemented ?
To notify user code for:

typedef enum {
SYSTEM_EVENT_WIFI_READY = 0, /< ESP32 WiFi ready */
SYSTEM_EVENT_SCAN_DONE, /
< ESP32 finish scanning AP */
SYSTEM_EVENT_STA_START, /< ESP32 station start */
SYSTEM_EVENT_STA_STOP, /
< ESP32 station stop */
SYSTEM_EVENT_STA_CONNECTED, /< ESP32 station connected to AP */
SYSTEM_EVENT_STA_DISCONNECTED, /
< ESP32 station disconnected from AP */
SYSTEM_EVENT_STA_AUTHMODE_CHANGE, /< the auth mode of AP connected by ESP32 station changed */
SYSTEM_EVENT_STA_GOT_IP, /
< ESP32 station got IP from connected AP */
SYSTEM_EVENT_STA_LOST_IP, /< ESP32 station lost IP and the IP is reset to 0 */
SYSTEM_EVENT_STA_WPS_ER_SUCCESS, /
< ESP32 station wps succeeds in enrollee mode */
SYSTEM_EVENT_STA_WPS_ER_FAILED, /< ESP32 station wps fails in enrollee mode */
SYSTEM_EVENT_STA_WPS_ER_TIMEOUT, /
< ESP32 station wps timeout in enrollee mode */
SYSTEM_EVENT_STA_WPS_ER_PIN, /< ESP32 station wps pin code in enrollee mode */
SYSTEM_EVENT_AP_START, /
< ESP32 soft-AP start */
SYSTEM_EVENT_AP_STOP, /< ESP32 soft-AP stop */
SYSTEM_EVENT_AP_STACONNECTED, /
< a station connected to ESP32 soft-AP */
SYSTEM_EVENT_AP_STADISCONNECTED, /< a station disconnected from ESP32 soft-AP */
SYSTEM_EVENT_AP_PROBEREQRECVED, /
< Receive probe request packet in soft-AP interface */
SYSTEM_EVENT_GOT_IP6, /< ESP32 station or ap or ethernet interface v6IP addr is preferred */
SYSTEM_EVENT_ETH_START, /
< ESP32 ethernet start */
SYSTEM_EVENT_ETH_STOP, /< ESP32 ethernet stop */
SYSTEM_EVENT_ETH_CONNECTED, /
< ESP32 ethernet phy link up */
SYSTEM_EVENT_ETH_DISCONNECTED, /< ESP32 ethernet phy link down */
SYSTEM_EVENT_ETH_GOT_IP, /
< ESP32 ethernet got IP from connected AP */
SYSTEM_EVENT_MAX
} system_event_id_t;

mDNS Example - start method needed

mdns = network.mDNS()
mdns.start ("ESP32Dev", "ESP32") #<<< Needed, or else I got an error.
_ = mdns.addService('_ftp', '_tcp', 21, "ESP32Dev", {"board": "ESP32", "service":  "FTP File transfer", "passive": "True"})
_ = mdns.addService('_telnet', '_tcp', 23, "ESP32Dev", {"board": "ESP32", "service": "Telnet REPL"})
_ = mdns.addService('_http', '_tcp', 80, "ESP32Dev", {"board": "ESP32", "service": "Servidor Web"})

ftp server pwd and cwd commands don't work

And assuming I have the right code, I can see why. local cwd is not set for the pwd and I think it should be os.listdir rather than uos.

elif command == "PWD": cl.sendall('257 "{}"\r\n'.format(cwd)) elif command == "CWD": try: files = uos.listdir(path) cwd = path cl.sendall(msg_250_OK) except: cl.sendall(msg_550_fail)

Tested by using the ftp CLI on OSX.

mDNS Module wiki example with an error

Where it reads:
_ = mdns.addService('_http', '_tcp', 80, "MicroPython", {"board": "ESP32", "service": "mPy Web server"))

should be:
_ = mdns.addService('_http', '_tcp', 80, "MicroPython", {"board": "ESP32", "service": "mPy Web server"}) #replace the parentheses with braces

utime.ticks_diff(): Overflow error

ticks_diff() raises an overflow error, if its arguments are >= 2**31 (2147483648). utime.ticks_us() and utime.ticks_ms() may return such values. As long as these values do not overflow, which takes a while with 64 bit values, the need for ticks_diff() is questionable, since it simply calculates the difference.

wiki mqtt mqtt.status()

mqtt.status()

Returns the status of mqtt client task.

The status is returned as tuple: (num_stat, description).
Possible values are:
(0, "Connected")
(1, "Disconnected")
(2, "Stopping")
(3, "Stopped")

Connected and Disconnected are reversed

'component-quickmail-build' failed

It normal ?

/esp32/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/quickmail/./quickmail.c:29:
/esp32/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/components/micropython/./py/qstr.h:42:39: fatal error: genhdr/qstrdefs.generated.h: No such file or directory
compilation terminated.
/esp32/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/make/component_wrapper.mk:273: recipe for target 'quickmail.o' failed
make[1]: *** [quickmail.o] Error 1
/esp32/MicroPython_ESP32_psRAM_LoBo/Tools/esp-idf/make/project.mk:451: recipe for target 'component-quickmail-build' failed
make: *** [component-quickmail-build] Error 2
make: *** Waiting for unfinished jobs....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.