Git Product home page Git Product logo

esp82xx's Introduction

esp82xx

Useful ESP8266/ESP8285 C Environment. Includes libraries and some basic functionality such as a Web-GUI, flashing firmware and changing the UI over network as well as basic GPIO functions.

You can use it as a template for your own ESP8266/ESP8285 projects. Just include it as sub-module in derivate projects.

NOTE: If you are starting from another environment or from the factory, you should execute make erase initdefault this will set the flash up in a way compatible with the newer ESP NONOS SDK 2.x's.

Contributors, please read the notes closely before you start (e.g. Branches and Include Binaries). Make changes in the dev branch!

List of projects using esp82xx

Usage / Install

Requirements

Most of this is written having a Debian-like Linux distribution in mind. You will need to use your imagination, if you want to build on other platforms. People have done it on OSX and Win 7/8. Look at open and closed issues and internet resources on the SDK such as the esp-forum to find help.

You will need the following:

  • Espressif toolchain for the esp82xx-series chips
  • Libusb 1.0 (sudo apt-get install libusb-1.0-0-dev)
  • GNUMake
  • GNU Compiler Collection and build essentials
  • Possible more

Install the Prerequisites and SDK.

Prerequisites (Windows (WSL))

sudo apt update
sudo apt install python make
  • Proceed with normal prerequisites and project.

Prerequisites (Debian, Mint, Ubuntu):

sudo apt-get update
sudo apt-get install -y make gcc g++ gperf install-info gawk libexpat-dev python2-dev python2 python2-serial sed git unzip bash wget bzip2 libtool-bin

Note: Some platforms do not have python-serial, or any version of Python 2 for that matter (since it has reached its end of life on Jan 1, 2020 and all tooling and hosting is dropping support for it). If they don't have pip, but do still have python 2, do this:

curl  https://github.com/pypa/get-pip/raw/5f38681f7f5872e4032860b54e9cc11cf0374932/get-pip.py --output get-pip.py
sudo python2 get-pip.py
pip install pyserial

Otherwise, you have to use a distribution that has Python 2 packaged, compile it and the missing dependencies yourself, from source, or wait until the tools used here are ported to Python 3.

Install

This will install the SDK to ~/esp8266 - the default location for the ESP8266 SDK. This only works on 64-bit x86 systems, and has only been verified in Linux Mint and Ubuntu. Installation is about 18MB and requires about 90 MB of disk space.

mkdir -p ~/esp8266
cd ~/esp8266
wget https://github.com/cnlohr/esp82xx_bin_toolchain/raw/master/esp-open-sdk-x86_64-20200810.tar.xz
tar xJvf esp-open-sdk-x86_64-20200810.tar.xz

Several esp82xx projects use the offical Espressif nonos SDK instead of the bundled one here. You should probably install that to your home folder using the following commands:

cd ~/esp8266
git clone https://github.com/espressif/ESP8266_NONOS_SDK --recurse-submodules

Optional: Add your user to the dialout group:

sudo usermod -aG dialout cnlohr

Caveat: On Windows Subsystem for Linux, you will need to find your serial port. You will need to alter PORT= in user.cfg in the tool you are building.

See Appendix A and B for alternate options (if you are on non-64-bit x86 systems)

Some versions of the SDK are somewhat problematic, e.g. with SDK versions greater than 1.5.2, Espressif changed the IRAM management, so some projects began to hit size restrictions and would not compile. Also some SDKs use different initial data (the flash has to have some SDK-related settings stored that are not userspace and aren't flashed along with the firmware). For that reason, the Makefile is set up to use a customized version of the SDK and ships with proven initial data.

Specify SDK

If your SDK is not installed to ~/esp8266/esp-open-sdk, then there are many ways to let Make know where your SDK is located. You can edit DEFAULT_SDK in ./user.cfg to reflect your specific SDK path or even better define a shell variable. The latter is done with

# Add this in ~/.bashrc or similar
export ESP_ROOT=/path/to/sdk/where/esp-open-sdk

in your .bashrc, .profile or whatever is used by your shell. This way, the change will be persistent, even if you start many new esp82xx projects.

You can also pass the location as an argument to make:

make all ESP_ROOT=/path/to/sdk/where/esp-open-sdk

Start a new Project

Starting a new project based on esp82xx is pretty easy:

mkdir my_new_esp_project
cd my_new_esp_project
git clone --recursive https://github.com/cnlohr/esp82xx
cp esp82xx/Makefile.example Makefile
make project

Replace the last line by the line below, if you also want to initialize the folder as a new git repo and upload it to a remote location:

make gitproject GIT_ORIGIN=https://github.com/YOUR_USER/YOUR_NEW_REPO.git

Alternatively, you can add esp82xx as a submodule from your project as follows:

git add submodule https://github.com/cnlohr/esp82xx
cp esp82xx/Makefile.example Makefile
make project

After the above commands, provided you have specified the SDK, the basic file structure should be in place. Most files will be symbolic links against files in ./esp82xx/. Do not edit these files or anything in ./esp82xx/. You should rather copy the files to the top-level directories and edit the copies where necessary. I.e. if you want add a line of CSS that changes the font in the WebUI, copy ./esp82xx/web/page/intex.html to ./web/page/ overwriting the symbolic link. Then make your edits.

Edit user.cfg in the top level to specify things like the location of the Espressif toolchain (see Requirements). The file user.cfg specifies the most important configuration variables.

Burn Firmware

If you did everything correctly, flashing your esp should work. Just connect it to an USB to serial adapter that uses 3.3V (you will fry your ESP with voltages higher than 3.3 V) and place it in programming mode.

For the first run from a factory or unknown source of an ESP, you should run the following command to completely wipe it and give it new data:

    make burnitall

Then you can run

    make burn
    make burnweb  # programming mode here too

and your ESP is good to go. It should create its own WiFi Access Point called ESPXXXX or similar, where XXXX is some arbitrary code. From now on you can configure and burn new firmware/page data over the web interface in your browser (when connected to the esp's network or it is connected to yours). There are make targets to burn firmware and page data as well:

make netburn IP=192.168.4.1  # default IP, change to whatever your ESP is set to
make netweb IP=192.168.4.1

To find out the IP, see below.

Connect to your Module

The ESP will print its connection info, including its current IP to the serial interface after reset/power-on.

You can connect to the ESP in your browser:

http://esp82xx.local

There is also a make-target called getips that scans for ESP modules and lists their IPs. make getips is basically a port-scan, that uses external tools you might have to install and takes long (especially if no ESP is connected).

The default IP of the ESP, when it operates as it's own access point, is 192.168.4.1. When connected to an existing WiFi Network, it will ask your DHCP-Server for an IP. Most WiFi routers have an option in their Web-GUI to list all IPs, that their DHCP has given out. You could find out your ESP's IP this way.

For general troubleshooting hints, see esptools troubleshooting page. It is excellent!

Commands

Most features of the WebUI can be used over network by sending an ASCII string to the flashed ESP. This way you can evoke a feature from a program, script or the shell (i.e. using nc a.k.a netcat).

The command string starts with a letter signifying the command or family of commands. In case of a command family, the second letter usually defines the command. After that comes the first argument. Subsequent arguments after the first are usually followed by tab-characters. Most commands will also send a response packet containing information or error codes. The character(s) that specify the command(-family) are not case sensitive, i.e. E1234 and e1234 will be interpreted identically.

Here is an example to get a freshly flashed ESP to connect to a WiFi network named MyWiFi:

echo -ne "W1\tMyWiFi\t1234\ta1:b2:c3:d4:e5:f6\t1" | nc 192.168.4.1 7878  -u -w 1 | hexdump -C

The access point has the mac a1:b2:c3:d4:e5:f6 and password 1234. The program hexdump is used to receive and display the ESP's answer.

The commands are:

Family Command Description
B Browse commands
q Probe
s Service name
l List IP, service, device name and description
r Response
G GPIO commands
0 Turn pin with the same number as the first argument on
1 Turn pin with the same number as the first argument off
i Make pin numbered same as the first argument an input
f Toggle pin number specified by the first argument
g Get status of pin numbered same as the first argument
s Get outputmask and rmask as base-ten numbers
E . Echo command string with all arguments (for test purposes)
I Get info
b Restart system
s Save CS-settings
l Load CS-settings 1
r Load CS-settings 2
f Start finding devices or return list of found devices
n Device name
d Device description
. General info: IP, device name, description, servie name, free heap
W Wifi commands
0 Have the ESP an AP. Arguments: AP name, password, mac, channel
1 Connect to existing network AP. Same arguments as above
i Get info on current Wifi settings
x Get RSSI (if applicable) and current IP
s Scan for WiFi stations
r Return results of scan
F Flashing commands
e Erase sector
b Erase block
m Execute flash rewriter
w Write given number of bytes to flash (binary)
x Write given number (second argument) of hexadecimal bytes (third argument) to position in (first argument) in flash
r Read a number of bytes (second argument) from a sector (first argument) flash
C ** Custom commands **
C Respond with 'CC'
E Echo arguments to UART
... Your commands could go here

A dot . stands for an omitted character, i.e. nothing. It is not included in the command string.

For more information on these commands, please conuslt the source code. The commands are implemented in ./esp82xx/fwsrc/commonservices.c. You can add your own commands in ./user/custom_commands.c.

Troubleshooting

Caught in Reset loop

Most of endless resets are caused by one of the following:

  • Power supply too weak (the esp can draw 300mA)
  • Not enough decoupling capacitance (a combination of 100uF and 100nF work)
  • Wonky connection (worn out, loose or dirty contacts
  • Initial flash data faulty (see Specify SDK), in which case this might help:
make erase
make initdefault #init3v3

Gibberish Serial Data right after Boot

If you get weird data at the start of your serial communication with the esp, don't forsake! The boot ROM writes a log to the UART with the unusual timing of 74880 baud. It's normal.

Useful Links

Notes

This section should mostly concern developers and contributors to this project. We try to keep the generally interesting stuff on top.

Create File Structure

You can create the file structure of a basic program by hand or based on another project, instead of running make project. To do that first, check out a project that uses esp82xx

git clone --recursive https://github.com/con-f-use/esp82XX-basic

or create your own

git init project_name
cd project_name
git submodule add https://github.com/cnlohr/esp82xx.git
cp esp82xx/user.cfg.example user.cfg
cp esp82xx/Makefile.example Makefile
cp esp82xx/fwsrc/user . -a
mkdir -p web/page user
ln -s ../esp82xx/web/Makefile web/
# ... link or copy more files depending on how much you want to change ...

After that, you can push it a freshly created remote repository with the usual git commands:

git init .
git add .
git git remote add origin https://github.com/YOUR_USER/YOUR_NEW_REPO.git
git commit -m 'Initial commit'
git push

The basic Makefile for the firmware is ./esp82xx/main.mf. Most things can be achieved by including it in your top-level Makefile and changing some make variables.

include esp82xx/main.mf

SRCS += more_sources.c # Add your project specific sources

Branches

If you make small incremental changes and/or experimental ones, push to the dev branch rather than to origin/master:

git push origin dev

You can merge or squash-merge them into master once they have been tested and enough changes accumulate.

# ... Make changes in dev ...
# ... test them and be sure they should go into master ...
git checkout master
git merge --squash dev
git commit

It might be good to create feature branches to develop individual features and merge them into dev.

Submodule Updates

Cope with submodule changes in top-level project:

  • You made changes in the submodule and want to push them:

    cd esp82xx   # is the submodules here
    # Make changes in esp82xx
    git commit -m 'Your Message'
    git push     # pushes to the sumodule remote
    

    Make sure you're in the 'dev' branch. You can check that with git branch. If you're not, make sure to git checkout dev first, BEFORE you make your changes. You can also use git push origin dev to push just the dev branch.

    When you're ready to push, first make sure 'master' is up to date with git push origin dev:master. Then to push to master, use git push origin dev:master

  • Bump esp82xx version in the main project root folder:

    cd esp82xx
    git pull
    cd ..
    git add esp82xx
    git commit -m 'Bumped submodule version'
    git push
    
  • Make sure you are using the master branch of your submodules, when you're about to merge a dev version of top-level projects. I.e. just before you merge, checkout the master branch of submodules, so that when you merge, a Master-branch top-level projects uses the master-branch of all its submodules and not subodule dev-braches.

  • You can clone the dev-branch directly:

    git clone --recursive -b dev https://github.com/cnlohr/esp82xx.git && cd esp82xx
    

    If you forgot and switched to dev via git checkout dev, you might not have the proper submodules. In that case run git submodule update --init

Include Binaries

You should not include binaries in the project repository itself. There is a make target that builds the binaries and creates a .zip file. Included that in the release. To make a release, just tag a commit with git tag -a 'v1.3.3.7' -m 'Your release caption' and push the tag with git push --tags.

After that, the github web-interface will allow you to make a release out of the new tag and include the binary file. To make the zip file invoke make projectname-version-binaries.tgz (Tab-autocompletion is your friend).

ToDo

  • Include libraries for usb, ws2812s and ethernet
  • Expand the "Requirements" section

Troubleshooting

If you see something like this:

rf_cal[0] !=0x05,is 0xE9

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 25936, room 16 
tail 0
chksum 0x20
load 0x3ffe8000, len 1272, room 8 
tail 0
chksum 0x9b
load 0x3ffe8500, len 1212, room 8 
tail 4
chksum 0x8c
csum 0x8c

You may not be loading your parititon tables properly. #1 check user.cfg to make sure you have your partition burning location set correctly.

Additionally, make sure you are loading the partition tables in your user_main.

void user_pre_init(void)
{
	//You must load the partition table so the NONOS SDK can find stuff.
	LoadDefaultPartitionMap();
}

Appendices

Appendix A: Installing the pfalcon SDK

We recommend the excellent esp-open-sdk by @pfalcon. It downloads and installs the Espressif toolchain. Here is a shell script to download and build a version known to work. You should read and understand the script, before running it. It will take some time and GBs of disk space to build the toolchain.

Appendix B: Alternate (Manual) pfalcon SDK Linux Setup

Prerequisites (Debian, Mint, Ubuntu):

sudo apt-get update
sudo apt-get install -y make unrar autoconf automake libtool gcc g++ gperf flex bison texinfo-doc-nonfree install-info info texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial sed git unzip bash help2man wget bzip2 libtool-bin

esptool:

cd ~/esp8366
git clone --recursive https://github.com/igrr/esptool-ck.git || exit 1
cd esptool-ck
make
cd ..

pfalcon's SDK:

cd ~/esp8266

git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk

# For legacy projects, you will need SDK 1.5.2, from before espressif filled the iram
#sed -i 's/^\(\s*VENDOR_SDK\s*=\s*\).*$/\1 1.5.2/' Makefile
#git checkout e32ff685 # Old version of sdk (v1.5.2) before espressif filled the iram

make STANDALONE=y 
find . -name "c_types.h" -exec cp "{}" "{}.patched" \;

# Line below fixes a bug, when e32ff685 or other old versions are used
#find -type f -name 'c_types.h.orig' -print0 | while read -d $'\0' f; do cp "$f" "${f%.orig}"; done

You may want to manually add the SDK path to your bashrc. Copy out the note from makefile and paste it into your .bashrc.

nano ~/.bashrc

esp82xx's People

Contributors

0xd3d0c3d avatar aefeinstein avatar bbkiwi avatar binary1230 avatar bn-jbischko avatar cnlohr avatar con-f-use avatar jinodk avatar king2 avatar leopck avatar piksel avatar temoto 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

esp82xx's Issues

netburn failing

I'm checking this out. I get !FM4 (MD5 mismatch).
If I remove -DQUIET_REFLASH it seems to work but gives message
"Timeout. Good? Maybe?" (a bit of a strange message).

netweb seems to work with either option.

Improve browse behavior

One feature I had left for a long time and haven't messed with much was the browse and MDNS feature (if turned on). Normally esp82xx devices can be found by typing: http://esp82xx.local into your web browser. It will pick the first available esp82xx device. (Currently we're calling it cn8266, but I think the name may want to change?)

Once you are at that device, it can list all other ESPs on the network and produce a list of links for you to click the others. It does this by sending 'q' to broadcast port 7878.

We should do that in the makefile when searching, too! @con-f-use (For the makefile part)r

documentation

This is interesting but there's no documentation about usage.

Feature request/question

I don't want to install all this tools on my computer so I have a question. Can I just burn .bin file to the esp?
Thanks

Makefile automatically pull recursive

@con-f-use This is actually an issue for other projects, but is there some easy way of adding a line to the Makefile of other projects so they can automatically detect that they were git pulled without proper --recursive flags and then actually switch over and pull esp82xx?

This would be a change to the child projects, not this project, but would be very useful since people probably aren't used to git pull --recursive.

Get github logo smaller

Right now in index.html, the github logo is there, encoded as an image object.

I am confident the image could be much smaller than 1.3kB of text in the HTML!

[ webgui flashing ]

new esp82xx flashing via webgui is nice, i had to make some changes a bit to work on 8285.
i adjusted menuinterface.js to reflect 0x10000 rather than 0x40000 instances. i adjusted mpfs_start_at location because it is in different spot, you'll get file not found flashing page.mpfs otherwise. i also had to move the scratchpad location because if you flash bin pairs it will overwrite the page.mpfs and then you're left with no webgui unless you flash via esptool. this at least leaves the webgui ;p.. so firmware flashing is working gr8, even webgui flashing page.mpfs is great.. the issue is if you exceed 60k filesize. it will be missing data. every 65536 - 4096 x 2 will be 0xFF'd. :*[ i guess my question is without using esptool.py to flash page.mpfs, is there way around this boundary via webgui? is there a way to use a pointer system to the missing chunks if there is a boundary? im not 100% sure how to tackle this. i used a 390k page.mpfs as an example, the real page.mpfs size im using is 109k or 80k.. either are still above 60k.

** esp8285 - 1048576 **

[ user.cfg ]

MFS_PAGE_OFFSET  = 532480

[ menuinterface.js ]

  • new esp82xx uses 0x00000 0x10000 fw bins, so i adjusted all 0x40000 references to 0x10000
var mpfs_start_at = 532480; // 65536;
var flash_scratchpad_at = 655360; // 524288;

[ page.mpfs ]

make clean page.mpfs # 512 328704
wc -c page.mpfs # 329216 page.mpfs

[ flash ]

esptool.py -b 115200 --port /dev/ttyUSB0 write_flash --erase-all -fs 1MB -fm dout 0xfc000 esp82xx/toolchain/esp_nonos_sdk/bin/esp_init_data_default_v08.bin 0x00000 image.elf-0x00000.bin 0x10000 image.elf-0x10000.bin 532480 web/page.mpfs

[ reflash ]

  • from webgui flash this same page.mpfs then dump it for a difference

[ dump ]

  • extracting reflashed page.mpfs from dump
esptool.py read_flash 0x00000 0x100000 dump.bin
dd if=dump.bin of=mpfs.bin bs=1 skip=532480 count=329216

[ compare page.mpfs versus mpfs.bin extraction ]

  • diff mpfs.bin page.mpfs
  • Binary files mpfs.bin and page.mpfs differ

[ visually compare the differences ]

  • vimdiff mpfs.bin page.mpfs

[ switch visual modes ]

  • :%!hexdump -C
  • ctrl + l
  • :%!hexdump -C

[ analyze differences ]

    >>> MPFS_FILE_SIZE=329216
    >>> offset1 = [ "0000e000", "57344" ]
    >>> hex(65536 * 1)
    '0x10000'
    >>> offset2 = [ "0001e000", "122880" ]
    >>> hex(65536 * 2)
    '0x20000'
    >>> offset3 = [ "0002e000", "188416" ]
    >>> hex(65536 * 3)
    '0x30000'
    >>> offset4 = [ "0003e000", "253952" ]
    >>> hex(65536 * 4)
    '0x40000'
    >>> offset5 = [ "0004e000", "319488" ]
    >>> hex(65536 * 5)
    '0x50000'
    >>> 57344 + 4096*2
    65536
    >>> 122880 + 4096*2
    131072
    >>> 188416 + 4096*2
    196608
    >>> 253952 + 4096*2
    262144
    >>> 319488 + 4096*2
    327680
    >>> hex(65536)
    '0x10000'
    >>> hex(131072)
    '0x20000'
    >>> hex(196608)
    '0x30000'
    >>> hex(262144)
    '0x40000'
    >>> hex(327680)
    '0x50000'

Screenshot from 2019-07-05 08-28-02
Screenshot from 2019-07-05 08-29-06

Not saving wifi credentials

Hi @con-f-use and @cnlohr

I've been trying the basic example made by make project (Im in dev) with
make clean erase initdefault burn burnweb
the ESP8266 (nodemcu v1) comes up with an AP and in the gui I connect to my home wifi no problem.
However when I reset it usually tries to connect to the AP again and I have to use the gui again.
If examine top of flash 0x3FE000 with
echo -ne "fr4186112\t128" | netcat -u -w 1 192.168.1.3 7878 | hexdump -C
I find that the wifi credentials are not there.
Occasionally it does restart at home station and I find my credentials are there and after
each restart it goes to the station.

In commonservices.c I see your comment
wifi_station_set_config(&stationConf); //I don't know why, doing this twice seems to make it store more reliably. Is this a manifestation of the unreliability?

I thought I had a way to get around the issue by having my wifi off when I tried to switch to my home station. It kept trying and failing, then I turned the wifi on and it seemed to connect and remember.
However even with this it fails often.

Is there any testing I can do for you?
Cheers, Bill

Profiling of ESP8266 based code

Basic Infos
Hardware

Hardware: ESP8266
Core Version:
Description

Hi guys! I have developed a project based on NodeMCU, Now I am trying to debugging and profiling it.
Can any could please help how to profile the code?
I am able to debug it using gdb over eclipse and now I am trying to compile it using -pg Flag so that it gnenerate some info using mcount() and then I could use Gprof for further profiling.
Share some ideas would be appreciated.
Settings in IDE

Module: NodeMCU
Flash Size: 4MB
CPU Frequency: 80Mhz
Flash Mode: dio
Flash Frequency: 40Mhz
Upload Using: SERIAL
Reset Method: nodemcu

Improve mechanism for command parsing

Right now, we are using things like:

char * des = nam ? (char *)ets_strstr( (char*)(nam+1), "\t" ) : 0;

which is just awful to be used so many places. We should write our own, perhaps where it also re-writes the byte to be a null and advances the pointer by reference?

i.e.

char * CaptureAndAdvance( char ** data );

Called in the following way:

    char * nam = CaptureAndAdvance( &pusrdata );
    char * des = CaptureAndAdvance( &pusrdata );

This will produce much smaller code and I think it's easier to read.

Order of inclusion

The top of the makefiles read:

include user.cfg
-include esp82xx/common.mf
-include esp82xx/main.mf

Shouldn't user be after common, that way it can override things like SDK?

Undefined reference to `os_printf`

Using esp-open-sdk with the patch for nonos-sdk v3.0 from this PR pfalcon/esp-open-sdk#344

I first tried using the default version (2.1.0-18-g61248df) but that didn't work.

Running esp82xx from master, fresh install of everything

I'm assuming that I've missed something and forgot to include some .o-file somewhere, but after reading the docs I've come up with nothing. Did I simply miss some step?

Output from running make burn

$ make burn
/home/maistho/prog/esp8266/esp-open-sdk-v3/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -mlongcalls -Os -I/home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/include -Iesp82xx/include -I. -Iesp82xx/fwsrc -Iuser -DICACHE_FLASH -DMFS_PAGE_OFFSET=65536      -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878  -DSLOWTICK_MS=50 -DVERSSTR='"Version: 81ac6 - Build Tue, Nov 20 2018, 06:47:28 +0100 with -DICACHE_FLASH -DMFS_PAGE_OFFSET=65536      -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878  -DSLOWTICK_MS=50"' -g esp82xx/fwsrc/uart.c esp82xx/fwsrc/esp82xxutil.c esp82xx/fwsrc/flash_rewriter.c esp82xx/fwsrc/http.c esp82xx/fwsrc/commonservices.c esp82xx/fwsrc/http_custom.c esp82xx/fwsrc/mdns.c esp82xx/fwsrc/mfs.c user/custom_commands.c user/user_main.c -flto -Wl,--relax -Wl,--gc-sections -nostdlib -L/home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib -L/home/maistho/prog/esp8266/esp-open-sdk-v3/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/libgcc.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/libmain.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/liblwip.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/libssl.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/libupgrade.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/libnet80211.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/libwpa.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/libphy.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/liblwip.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/libcrypto.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/libc.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/libespnow.a /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib/libpp.a /home/maistho/prog/esp8266/esp-open-sdk-v3/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/libgcc.a -T /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/ld/eagle.app.v6.ld -T /home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/ld/eagle.rom.addr.v6.ld -B/home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/lib  -o image.elf
esp82xx/fwsrc/mfs.c: In function 'FindMPFS':
esp82xx/fwsrc/mfs.c:20:2: warning: passing argument 2 of 'ets_strncmp' from incompatible pointer type [enabled by default]
  if( ets_strncmp( "MPFSMPFS", mfs_check, 8 ) == 0 ) { mfs_at = MFS_PAGE_OFFSET; goto done; }
  ^
In file included from esp82xx/fwsrc/mfs.c:8:0:
/home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/include/osapi.h:48:5: note: expected 'const char *' but argument is of type 'uint32 *'
 int ets_strncmp(const char *s1, const char *s2, unsigned int n);
     ^
esp82xx/fwsrc/mfs.c:25:2: warning: passing argument 2 of 'ets_strncmp' from incompatible pointer type [enabled by default]
  if( ets_strncmp( "MPFSMPFS", mfs_check, 8 ) == 0 ) { mfs_at = MFS_ALTERNATIVE_START; goto done; }
  ^
In file included from esp82xx/fwsrc/mfs.c:8:0:
/home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/include/osapi.h:48:5: note: expected 'const char *' but argument is of type 'uint32 *'
 int ets_strncmp(const char *s1, const char *s2, unsigned int n);
     ^
user/user_main.c: In function 'user_init':
user/user_main.c:237:2: warning: passing argument 1 of 'ets_timer_disarm' discards 'volatile' qualifier from pointer target type [enabled by default]
  os_timer_disarm(&some_timer);
  ^
In file included from user/user_main.c:12:0:
/home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/include/osapi.h:66:6: note: expected 'struct ETSTimer *' but argument is of type 'volatile struct ETSTimer *'
 void ets_timer_disarm(os_timer_t *ptimer);
      ^
user/user_main.c:238:2: warning: passing argument 1 of 'ets_timer_setfn' discards 'volatile' qualifier from pointer target type [enabled by default]
  os_timer_setfn(&some_timer, (os_timer_func_t *)timer100ms, NULL);
  ^
In file included from user/user_main.c:12:0:
/home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/include/osapi.h:67:6: note: expected 'struct ETSTimer *' but argument is of type 'volatile struct ETSTimer *'
 void ets_timer_setfn(os_timer_t *ptimer, os_timer_func_t *pfunction, void *parg);
      ^
user/user_main.c:239:2: warning: passing argument 1 of 'ets_timer_arm_new' discards 'volatile' qualifier from pointer target type [enabled by default]
  os_timer_arm(&some_timer, 100, 1);
  ^
In file included from user/user_main.c:12:0:
/home/maistho/prog/esp8266/project/esp82xx/toolchain/esp_nonos_sdk/include/osapi.h:65:6: note: expected 'struct ETSTimer *' but argument is of type 'volatile struct ETSTimer *'
 void ets_timer_arm_new(os_timer_t *ptimer, uint32_t time, bool repeat_flag, bool ms_flag);
      ^
/tmp/cclb9OmE.ltrans1.ltrans.o:(.irom0.literal+0x128): undefined reference to `os_printf'
/tmp/cclb9OmE.ltrans1.ltrans.o: In function `cmd_GPIO':
/home/maistho/prog/esp8266/project/esp82xx/fwsrc/commonservices.c:312: undefined reference to `os_printf'
/home/maistho/prog/esp8266/project/esp82xx/fwsrc/commonservices.c:320: undefined reference to `os_printf'
collect2: error: ld returned 1 exit status
make: *** [esp82xx/main.mf:103: image.elf] Error 1

Make LED flashing more meaningful.

I am deeming GPIO2 the official "LED" pin. Since it's that way on the ESP-12-E, and F modules and it's convenient to have an LED on in general. I currently have it flash when you do a press-and-hold system restore. We should probably make it do something when connecting/connected.

can't burn web page due to missing usb library

Hello,

I have followed instructions in README file. Code compiles without any error. I was able to flash firmware via make burn command. Nevertheless I'm getting following error during web content flashing. I coludn't even find a place where this usb-1.0 lib is included. After two days I'm out of ideas - I tried to run exp82xx-basic project but it ends up with the same error message. Thank you in advance

make burnweb

rm -f mfsmaker page.mpfs pushtodev execute_reflash tmp/*
gcc -DICACHE_FLASH -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878 -DSLOWTICK_MS=50 mfsmaker.c -o mfsmaker -lusb-1.0
ld: library not found for -lusb-1.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [mfsmaker] Error 1
make: *** [burnweb] Error 2

ESP8285 Can't self-flash

I don't really know what's going on here, but for some reason the ESP8285 passes the check for MD5 matches, the final copy-to-flash seems to work, too? But, once in place, the system won't boot at all.

Anyone have any idea why the ESP8285 won't self flash? (This applies to USB and WIFI flashing)

Cannot make any changes in website

Hi,
Finally I was able to compile esp-open-sdk, esp82XX-basic and burn .bin to my ESP board. I try to change user.cfg file (PAGE_TITLE = esp82xx-basic to PAGE_TITLE = esp82xx-basic-mod), then make purge, make all and make burn. All process was succesfull, but even when I refresh site on browser I cannot see any changes in page title. What I'm doing wrong?

Incude SDK and possible the whole toolchain

The purpose of this issue is to discuss an e-mail conversation, I had with @cnlohr :

Espressif has sent me a patchwork of various updates to their SDK. I am adding them to https://github.com/cnlohr/esp_nonos_sdk

One big benefit is that it seems with this and the custom linker script, the IRAM issues are a thing of the past. What do you think it would take to make esp82xx also check out the new SDK?

My response in a nutshell:

You mean as in a Make target for cloning/donwloading the SDK [...]?
To answer your question, I guess it wouldn't take much to get it running [...].
Submodule [email protected]:cnlohr/esp_nonos_sdk.git into esp82xx [and adapt the make file].

I've thought about [including the whole Toolchain] at one point.
Would be an enormous relief for new users.
The reason why I didn't, was that it's probably only going to work for a few users that happen to build on a similarly configured OS.

So the SDK part should just be a matter of small makefile changes and a submodule.

For getting and compiling the whole toolchain, there's already my Ubuntu Script that uses pfalcon's Makefile. We could just include that, modify it to use @cnlohr 's patched SDK and call it a day. That would ignore other non-Ubuntu based systems completely.

@cnlohr , you have a better understanding of the toolchain. What exactly is the relationship between the SDK and the rest of the toolchain? Is it just libraries for the esp82xx that are compiled with the xtensa-gcc or is there more?

Cannot upgrade via WEB [SOLVED, WITH PATCH]

Just accurately merged new fresh downloaded lib into my firmware and found a problem: I cannot upgrade mpfs or firmware via web interface.

I have added some debug outputs to commonservices.c and can see that it receives strange data from web end. It succesfully parses commands (but strangely erased blocks in sequence of 8, 12, 13, 14..).

I have tried to see which data comes to spi_flash_write ('x' command) and found nothing that looks like my firmware files - and data received looks strange. It received as
99 00 33 00 00 66 00 00 44 00 00 11 00 44 00 00 00 00 00 11 00 44 00 66 cc 77 cc 00 00 00 00 00
instead of
E9 03 00 60 04 00 10 40 00 00 10 40 6C 7C 00 00

When I have commented colon2++ (just after FLASH_PROTECTION_BOUNDARY check), I got my first 'E' back, so I think that or we do not getting a char from web, or we do not should skip this char from data received.

Next, I was wondered by 'r1 = r2 = fromhex1( *(colon2++) );' line. It assigns same values to both variables and check all these variables later one by one!

Hmmmm, maybe some compilers calls fromhex1 twice from this code?

I have de-composed this line to:
r1 = fromhex1( *(colon2++) );
r2 = fromhex1( *(colon2++) );

And WOW! It started to work.

So, I have one question and one proposal.

  1. Why colon2 was incremented (and its value was skipped)? Maybe something wrong here?
  2. Please, return two calls to fromhex1 back! Some compilers with some optimization settings can raise headache to users in this place.

Thanks!

mfsmaker / windows

I'm using unofficial SDK under windows, so compiling webpages is a pain (I need to reboot notebook to Linux, copy files, compile them, then copy them back, reboot back to Windows - just to understand that I have missed something important or made a mistake in javascript code).

Sad, but other tools have programs I'm using exists on Windows only, so I cannnot switch entire developing process to Linux :(

Is there any place where I can find mfsmaker.c compiled for windows?

Thanks!

Problem with Scan For Wifi

I've noticed some problems while testing the new cc that uses esp82xx/dev that seem to be related to esp82xx/dev.

  1. In AP after scan for wifi (and having not found any) it attempts to return to the AP but fails to establish it. Manual reset will get it going again.
  2. In Station mode, sometimes after the scan it forces a reboot and then reconnects back to the station.
    Also it does not find anything. I had my home wifi running (which it was connected to) and I also had the other ESP8266 running an AP. The scan shows ISCAN but then does not list any.

output esp82xx test3.txt
output esp82xx test2.txt
output esp82xx test.txt

con-f-use needs to check my work

@con-f-use

Can you please check all of the changes I've made. I have done a lot and I think there's high risk for really messing something up along with possibly misunderstanding your intent for things.

Investigate possible use of mask ROM for malloc/free

It has been a resounding success using the mask ROM for several libgcc functions. IF the mask ROM malloc functions can be safely used then many of these functions can be stubbed, others should be able to be directly linkable to the mask ROM. This should save additional space and help unify the system operation.

40100afc 0000001f T prvInsertBlockIntoUsedList
40100b34 0000007c T pvShowMalloc
40100b34 0000007c T system_show_malloc
40100bb0 00000029 T prvRemoveBlockFromUsedList
40100bdc 00000002 T xPortWantedSizeAlign
40100c08 0000015c T pvPortMalloc
40100d6c 0000008c T vPortFree
40100dfc 00000030 T pvPortCalloc
40100e2c 00000030 T pvPortCallocIram
40100e5c 00000019 T pvPortZalloc
40100e78 00000019 T pvPortZallocIram
40100e94 00000058 T pvPortRealloc
40100ef0 00000016 T malloc
40100f08 00000014 T free
40100f1c 00000014 T zalloc
40100f30 00000014 T calloc
40100f44 00000014 T realloc
40100f58 00000007 T xPortGetFreeHeapSize
40100f60 00000007 T xPortGetMinimumEverFreeHeapSize
40100fb0 000000f7 T vPortDefineHeapRegions

Document why we don't use, because I don't know!

40106a28 00000017 T memchr
40106a40 00000049 T __modsi3
40106a8c 00000018 T __ashrdi3

Reboots with default settings after toggling gpios

When setting wifi settings in web-gui, the "change settings" button does not save settings to flash, I have to send command "Is" to save settings.

My main problem is that settings reverts to default then device is crashing by unknown reason. One way to reproduce this is to randomly toggle gpio pins via web-gui. This is the log from then it reboots to factory defaults after crash.

Version: unknown - Build Mon, 15 May 2017 20:54:44 +0200 with -DICACHE_FLASH -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878  -DSLOWTICK_MS=5Loading Settings: af / 0 / 69 / 69
Settings Loaded: ESP_D60606 / Default
Opmode: 1
Station mode: "Q-2.4":"xxxxxxxx" (bssid_set:0)
Boot Ok.
IGMP Joining: cc282a0a fb0000e0
STAT: 5
IP: 10.42.40.204
NM: 255.255.252.0
GW: 10.42.41.200
WCFG: /Q-2.4/xxxxxxxx/
IGMP Joining: cc282a0a fb0000e0
                             
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 30368, room 16 
tail 0
chksum 0x6a
load 0x3ffe8000, len 884, room 8 
tail 12
chksum 0x3d
ho 0 tail 12 room 4
load 0x3ffe8380, len 2832, room 12 
tail 4
chksum 0xe6
csum 0xe6
����g�s��n|�$dll`��;�$�d�䤨H����2XX Web-GUI
Version: unknown - Build Mon, 15 May 2017 20:54:44 +0200 with -DICACHE_FLASH -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878  -DSLOWTICK_MS=5Loading Settings: af / 0 / 69 / 69
Settings Loaded: ESP_D60606 / Default
Opmode: 2
Default SoftAP mode: "ESP_D60606":""
Boot Ok.
IGMP Joining: 0104a8c0 fb0000e0

Separate Flash Rewriter

Most of the flash re-writer can live in cache. Only a very small part needs to be in iram.

access points created but how to make further setup....i'm new to esp8266

Hi,
how should i make setup at router side. Actually executable toprecorder and process made but i don't know how to made setup at router side.

After "make burn" and "make netburn" it creates its own WiFi Access Point but i am new to esp8266 i don't know how to move forward to get packets.

Thanks.

Random charactes on serial with ESP not booting

With the latest version of esp82xx I'm getting something strange on fresh esp-12-E modules

When I do the following on a fresh esp-12E

git clone --recursive https://github.com/cnlohr/esp82xx.git  # latest commit 93074f
cp esp82xx/Makefile.example Makefile
make project
make burn
make burnweb

I only get an endless sequence of seemingly random character sequences on the UART and the ESP doesn't connect to WiFi or respond to anything but putting it in flashing mode.

When I flash an old version of esp82xx, set WiFi credentials and then flash the latest version again, everything works. Did @cnlohr experience something similar with the latest commit?

I suspect if that happens to new users, they might get thoroughly confused.

P.S. I tried multiple ESPs with different programmers.

image.elf section `.irom0.text' will not fit in region `irom0_0_seg'

I'm using ESP8266-12E. I needed to make a http get request so i found httpclient code. I fixed some warnings but then I got this:

/home/karol/git/esp8266/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: image.elf section .irom0.text' will not fit in region irom0_0_seg' /home/karol/git/esp8266/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: region irom0_0_seg' overflowed by 6576 bytes`

How can I fix this? As far I as know you modified a bit memory layout. We are using 32Mb flash but in makefile there is a -fs 8m flag. I'm also curious about OTA. Could you explaing a little bit how it is different from espressif way?

Troubleshoot reboot?

I, on my wifi chipset, have a hard time reconnecting to ESPs after they've been usbburned or netburned a few times. They need a hard power cycle. I'm not sure why, though. Is anyone else having this trouble?

Error compiling projects

Hi!

I am trying to compile https://github.com/con-f-use/esp82XX-basic but I am having an error during linking. I also tried with another project and the same error appears. I am not being able to figure out what is wrong, since the compile command apparently includes the libraries in the place where they are, and the linked libraries do not have 0B or something like that.

jbg@jbg:~/esp8266/projects/test_project_2/esp82XX-basic/esp82xx/toolchain/esp_nonos_sdk/lib$ pwd
/home/jbg/esp8266/projects/test_project_2/esp82XX-basic/esp82xx/toolchain/esp_nonos_sdk/lib
jbg@jbg:~/esp8266/projects/test_project_2/esp82XX-basic/esp82xx/toolchain/esp_nonos_sdk/lib$ ls
libairkiss.a  libcrypto.a  libespnow.a  libjson.a      liblwip.a  libmesh.a      libphy.a  libpwm.a          libssl.a      libwpa2.a  libwps.a
libat.a       libdriver.a  libgcc.a     liblwip_536.a  libmain.a  libnet80211.a  libpp.a   libsmartconfig.a  libupgrade.a  libwpa.a
jbg@jbg:~/esp8266/projects/test_project_2/esp82XX-basic$ sudo make burn
esp82xx/common.mf:39: Warning: No shell variable 'ESP_ROOT', using '/home/jbg/esp8266/esp-open-sdk'
/home/jbg/esp8266/esp-open-sdk/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -mlongcalls -Os -I/esp82xx/toolchain/esp_nonos_sdk/include -Iesp82xx/include -I. -Iesp82xx/fwsrc -Iuser -DICACHE_FLASH -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878  -DSLOWTICK_MS=50 -DVERSSTR='"Version: v0.1-12-g1b377 - Build Fri, 21 Aug 2020 17:52:26 +0200 with -DICACHE_FLASH -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878  -DSLOWTICK_MS=50"' esp82xx/fwsrc/uart.c esp82xx/fwsrc/esp82xxutil.c esp82xx/fwsrc/flash_rewriter.c esp82xx/fwsrc/http.c esp82xx/fwsrc/commonservices.c esp82xx/fwsrc/http_custom.c esp82xx/fwsrc/mdns.c esp82xx/fwsrc/mfs.c user/custom_commands.c user/user_main.c -flto -Wl,--relax -Wl,--gc-sections -nostdlib -L/esp82xx/toolchain/esp_nonos_sdk/lib -L/home/jbg/esp8266/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/libgcc.a /esp82xx/toolchain/esp_nonos_sdk/lib/libmain.a /esp82xx/toolchain/esp_nonos_sdk/lib/liblwip.a /esp82xx/toolchain/esp_nonos_sdk/lib/libssl.a /esp82xx/toolchain/esp_nonos_sdk/lib/libupgrade.a /esp82xx/toolchain/esp_nonos_sdk/lib/libnet80211.a /esp82xx/toolchain/esp_nonos_sdk/lib/libwpa.a /esp82xx/toolchain/esp_nonos_sdk/lib/libphy.a /esp82xx/toolchain/esp_nonos_sdk/lib/liblwip.a /esp82xx/toolchain/esp_nonos_sdk/lib/libcrypto.a /esp82xx/toolchain/esp_nonos_sdk/lib/libpp.a /home/jbg/esp8266/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/libgcc.a -T esp82xx/toolchain/ld/linkerscript.ld -T /esp82xx/toolchain/esp_nonos_sdk/ld/eagle.rom.addr.v6.ld -B/esp82xx/toolchain/esp_nonos_sdk/lib  -o image.elf
xtensa-lx106-elf-gcc: error: /esp82xx/toolchain/esp_nonos_sdk/lib/libmain.a: No such file or directory
xtensa-lx106-elf-gcc: error: /esp82xx/toolchain/esp_nonos_sdk/lib/liblwip.a: No such file or directory
xtensa-lx106-elf-gcc: error: /esp82xx/toolchain/esp_nonos_sdk/lib/libssl.a: No such file or directory
xtensa-lx106-elf-gcc: error: /esp82xx/toolchain/esp_nonos_sdk/lib/libupgrade.a: No such file or directory
xtensa-lx106-elf-gcc: error: /esp82xx/toolchain/esp_nonos_sdk/lib/libnet80211.a: No such file or directory
xtensa-lx106-elf-gcc: error: /esp82xx/toolchain/esp_nonos_sdk/lib/libwpa.a: No such file or directory
xtensa-lx106-elf-gcc: error: /esp82xx/toolchain/esp_nonos_sdk/lib/libphy.a: No such file or directory
xtensa-lx106-elf-gcc: error: /esp82xx/toolchain/esp_nonos_sdk/lib/liblwip.a: No such file or directory
xtensa-lx106-elf-gcc: error: /esp82xx/toolchain/esp_nonos_sdk/lib/libcrypto.a: No such file or directory
xtensa-lx106-elf-gcc: error: /esp82xx/toolchain/esp_nonos_sdk/lib/libpp.a: No such file or directory
esp82xx/main.mf:82: recipe for target 'image.elf' failed
make: *** [image.elf] Error 1

Any suggestion what could I be doing wrong?

Thank you very much in advance!!

Best regards

Use more dynamic memory

Currently there are several sections within esp82xx where static buffers are used. This should mostly be changed to dynamic memory.

Automatically getting esp_nonos_sdk?

@con-f-use I am not sure how to do this, but every time it takes me forever how to remember how to get esp82xx to pull the esp_nonos_sdk submodule inside esp82xx.

I am gonna make this issue so I at lest can remember...

git submodule init
git submodule update

from within esp82xx. But, my question is, how can we automatically detect this?

Failed to detect MPU9250 using I2C

First, thank you for this great project. I'd like to connect to an MPU9250 using I2C to my NodeMCU clone. As the first step, I wrote a custom command i to enumerate I2C devices. I'm calling the following method:

#include "i2c_master.h"
int ICACHE_FLASH_ATTR scan_i2c(char *buf)
{
    int i = 0;
    int found = 0;
    i2c_master_gpio_init();
    for (i=1; i<127; i++) {
        i2c_master_start();
        i2c_master_writeByte(i<<1);
        if (i2c_master_checkAck()) {
            ++found;
        }   
        i2c_master_stop();
     }   
    ets_sprintf(buf, "Found i2c devices: %d", found);
}

The probIem that I always get 0 devices. The connection should be okay, because when I upload a sketch using Arduino IDE for Esp8266, utilizing the Wire library, it works and receive ACK for 0x68. I also tried a logic analyzer to track down the problem.

When using Wire library it works:
arduino_esp

When using i2c_master code I get NAK:
nonos

The difference I see that Wire is ~2x faster. (I tried to change the delays in i2c_master_wait, it became faster, but still got NAK.)

The MPU9250 device works well with an Arduino Nano (and also from the NodeMCU using the Wire library).

I tried to connect a Nano as I2C slave, and the enumeration worked with i2c_master code. Any help or hint is really appreciated.

issues with instructions and python-serial

Hi this is an issue with the Readme.md and the instructions, the section in question is

_```
Prerequisites (Debian, Mint, Ubuntu):
sudo apt-get update
sudo apt-get install -y make gcc g++ gperf install-info gawk libexpat-dev python-dev python python-serial sed git unzip bash wget bzip2 libtool-bin
Note: Some platforms do not have python-serial. If they don't have it, do this:

curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
sudo python2 get-pip.py
pip install pyserial


So the issue is python-serial that has been dropped with python2 in most environments, and the second step "Sudo python2 get-pip.py" also did not work. Returning the following compiler error;

`
sudo python2 get-pip.py
Traceback (most recent call last):
  File "get-pip.py", line 24244, in <module>
    main()
  File "get-pip.py", line 199, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    from pip._internal.cli.main import main as pip_entry_point
  File "/tmp/tmpZgJI7n/pip.zip/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax
`
I used the following work around "https://github.com/pypa/packaging-problems/issues/433"

`curl https://bootstrap.pypa.io/2.7/get-pip.py | sudo python2`

My final issue after all this (I was setting up a new WSL) was my prerequisites did not completely install due to the error with python-serial, but the environment mostly worked until I was trying to "make burnweb" and GCC could not be found (which was weird as it seemed to pass make all and the ESP8266 was ping-able just couldn't get the web page working)

Going back and reinstalling all the prerequisites just with python-serial removed from the list fixed that issue and I can now build esp8266 projects.

So I suggest the instructions be changed to install python-serial on a separate line and then if it does not work to follow the second instruction with the new work around included.

unfubar strcat() in user_main.c

esp82xx/fwsrc/user/user_main.c strcat() calls itself?

"that's really wrong. File a bug report.
that's like /really/ wrong.
It's because the standard library is missing strcat, I believe."
-- cnlohr

Add programtic way of adding menu items to the index.html/webpage

Possibly do it at runtime too. It is a little annoying to have to decouple all the indexes from the main just to add whatever process-specific things are in it, like needed to be done in 20e932a of esp8266ws2812


<tr><td width=1>
<input type=submit onclick="ShowHideEvent( 'LEDs' ); KickLEDs();" value="LEDs"></td><td>
<div id=LEDs class="collapsible">
<table width=100% border=1><tr><td id=LEDCanvasHolder><CANVAS id=LEDCanvas width=512 height=100></CANVAS></td>
<td><input type=button onclick="ToggleLEDPause();" id=LEDPauseButton value="|| / >"></td></tr></table>
</div></td></tr>

Custom command Cmd_WiFi "WR" not working on web

Hi @cnlohr,

Sorry to bother you with this, but I was about to write a method to return a wireless scan as an array, and voila, there you have already a case in cmd_WiFi.

But I tried to issue the commands WR1, WR... to no avail, wonder if it really works via the WebGUI?

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.