Chat freely about anything...

User avatar
By 11mail22
#81311 After scanning your git repository, I found a missmatch which might be the root cause of ignoring UART data length.
uart.c: uart_set_initial(unsigned int uart)
Code: Select all   string_init(varname_uart_baud, "uart.baud.%u");
   string_init(varname_uart_data, "uart.data.%u");
   string_init(varname_uart_stop, "uart.stop.%u");
   string_init(varname_uart_parity, "uart.parity.%u");

   if(!config_get_int(&varname_uart_baud, uart, -1, &baud))
      baud = 115200;

   if(!config_get_int(&varname_uart_data, uart, -1, &data))
      data = 8;

   if(!config_get_int(&varname_uart_stop, uart, -1, &stop))
      stop = 1;


the string "uart.data.%u" can not be found as stored as "uart.bits.0=7" according cd command or application.c#637. So the default of 8bit is used.

Other finding: "uart.stop.0" is not stored in flash according cd command. Guess also default of one stop bit will always be used. Not verified.

As I am not able to generate own bin files up to know, I hope you can provide me images as pre release for testing, soon.
User avatar
By 11mail22
#81339 Fortunately "data" and "bits" does have the same number of letters, so I could patch the existing bin-image.
Perfect, now the UART can be configured with 7bits and work as expected in my application!

Thank you for this great ESP8266 application!

I also tried to compile your git.
Using: "git clone --recursive https://github.com/eriksl/esp8266-universal-io-bridge"
and "make all"
but failed:

Code: Select allpi@raspberrypi:~/esp8266-universal-io-bridge $ make all
BUILD TOOLCHAIN
make[1]: Entering directory '/home/pi/esp8266-universal-io-bridge/esp-open-sdk'
make -C crosstool-ng -f ../Makefile _ct-ng
make[2]: Entering directory '/home/pi/esp8266-universal-io-bridge/esp-open-sdk/crosstool-ng'
./bootstrap
INFO  :: *** Generating package version descriptions
INFO  :: Master packages: android-ndk autoconf automake avr-libc binutils cloog dtc duma elf2flt expat gcc gdb gettext glibc glibc-ports gmp isl libelf libiconv libtool linux ltrace m4 make mingw-w64 moxiebox mpc mpfr musl ncurses newlib strace uClibc zlib
INFO  :: Generating 'config/versions/android-ndk.in'
INFO  :: Generating 'config/versions/autoconf.in'
INFO  :: Generating 'config/versions/automake.in'
INFO  :: Generating 'config/versions/avr-libc.in'
INFO  :: Generating 'config/versions/binutils.in'
INFO  :: Generating 'config/versions/cloog.in'
INFO  :: Generating 'config/versions/dtc.in'
INFO  :: Generating 'config/versions/duma.in'
INFO  :: Generating 'config/versions/elf2flt.in'
INFO  :: Generating 'config/versions/expat.in'
INFO  :: Generating 'config/versions/gcc.in'
INFO  :: Generating 'config/versions/gdb.in'
INFO  :: Generating 'config/versions/gettext.in'
INFO  :: Generating 'config/versions/glibc.in'
INFO  :: Generating 'config/versions/glibc-ports.in'
INFO  :: Generating 'config/versions/gmp.in'
INFO  :: Generating 'config/versions/isl.in'
INFO  :: Generating 'config/versions/libelf.in'
INFO  :: Generating 'config/versions/libiconv.in'
INFO  :: Generating 'config/versions/libtool.in'
INFO  :: Generating 'config/versions/linux.in'
INFO  :: Generating 'config/versions/ltrace.in'
INFO  :: Generating 'config/versions/m4.in'
INFO  :: Generating 'config/versions/make.in'
INFO  :: Generating 'config/versions/mingw-w64.in'
INFO  :: Generating 'config/versions/moxiebox.in'
INFO  :: Generating 'config/versions/mpc.in'
INFO  :: Generating 'config/versions/mpfr.in'
INFO  :: Generating 'config/versions/musl.in'
INFO  :: Generating 'config/versions/ncurses.in'
INFO  :: Generating 'config/versions/newlib.in'
INFO  :: Generating 'config/versions/strace.in'
INFO  :: Generating 'config/versions/uClibc.in'
INFO  :: Generating 'config/versions/zlib.in'
INFO  :: *** Generating menu/choice selections
INFO  :: Generating arch.in (choice)
INFO  :: Generating kernel.in (choice)
INFO  :: Generating cc.in (choice)
INFO  :: Generating binutils.in (choice)
INFO  :: Generating libc.in (choice)
INFO  :: Generating debug.in (menu)
INFO  :: Generating comp_tools.in (menu)
INFO  :: Generating comp_libs.in (menu)
INFO  :: *** Gathering the list of data files to install
INFO  :: *** Running autoreconf
configure.ac:247: warning: macro 'AM_GNU_GETTEXT' not found in library
configure.ac:248: warning: macro 'AM_GNU_GETTEXT_VERSION' not found in library
INFO  :: *** Done!
./configure --prefix=`pwd`
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to create a pax tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... armv7l-unknown-linux-gnueabihf
checking host system type... armv7l-unknown-linux-gnueabihf
checking whether ln -s works... yes
checking whether install takes --strip-program option... yes
checking for ggrep... no
checking for grep... grep
checking for absolute path to grep... /bin/grep
checking for gegrep... no
checking for egrep... egrep
checking for absolute path to egrep... /bin/egrep
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for sed... /bin/sed
checking for GNU sed >= 4.0... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C preprocessor... gcc -E
checking for flex... no
checking for lex... no
checking for bison... no
checking for byacc... no
checking if gcc can static link... yes
checking for ranlib... ranlib
checking for gobjcopy... no
checking for objcopy... objcopy
checking for absolute path to objcopy... /usr/bin/objcopy
checking for gobjdump... no
checking for objdump... objdump
checking for absolute path to objdump... /usr/bin/objdump
checking for greadelf... no
checking for readelf... readelf
checking for absolute path to readelf... /usr/bin/readelf
checking for bison... no
configure: error: missing required tool: bison
../Makefile:161: recipe for target '_ct-ng' failed
make[2]: *** [_ct-ng] Error 1
make[2]: Leaving directory '/home/pi/esp8266-universal-io-bridge/esp-open-sdk/crosstool-ng'
Makefile:158: recipe for target 'crosstool-ng/ct-ng' failed
make[1]: *** [crosstool-ng/ct-ng] Error 2
make[1]: Leaving directory '/home/pi/esp8266-universal-io-bridge/esp-open-sdk'
Makefile:262: recipe for target '/home/pi/esp8266-universal-io-bridge/esp-open-sdk/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc' failed
make: *** [/home/pi/esp8266-universal-io-bridge/esp-open-sdk/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc] Error 2
User avatar
By eriksl
#81347 Thanks for finding the bug. I think I can imagine where that one crept in. Please notice that any config that is set to a default value is deleted from the config, to keep it as small as possible. The bits/data thing I will fix.

Migration from the espconn interface to the lwip interface and then "self compiling" the lwip instead of using the one that's supplied by Espressif is going along very well, I am now at a stage where everything looks like it's working.

I have decreased the buffers for the serial communication in one stage (out of three) where it should not matter. Also lwip works just a bit different than espconn and it MAY have impact on the speed continuous serial input is delivered to the network. I don't have the tools to test that thoroughly, I only have a simple terminal emulator at 19k2 bps. So when the new image is released, please test and give feedback. There may be some ways to improve responsiveness if necessary.

Regarding self compiling of the image. Crosstool says it needs bison here, so I guess that will be your next step...
User avatar
By eriksl
#81417 Regarding the UART bugs:

- indeed the wrong config entry was set (uart.bits instead of uart.data), I have fixed that. Another workaround, besides patching the code, is to use the "config-set" command and set the config entry directly.
- the UART supports 1 and 2 stop bits (I can't remember having seen 1.5 bits ever being mentioned in Espressif documentation, but it's nonsense anyway). There was a small bug where the command would mention "use 0 or 1" in it's usage remark, which is wrong, it's either 1 or 2. The actual handling already was correct and 1 is default so it doesn't end up in the config.

Please test, see here https://github.com/eriksl/esp8266-unive ... ses/tag/20

"This fixes the bug where the uart data bits width could not be set.

Also it's experimental because it now features:

espconn interface replaced by raw lwip interface
include LWIP from source code, ditch most of Espressif's code (especially espconn)
all functions now by default go to IROM, only IRAM functions need to be marked (source level change)
compile everything with -O3 instead of -Os, but keep IRAM functions -Os which seems to work well
As LWIP has a different interface than espconn, I've had to make some design choices. One of them is that the UART queue (software, not hardware) is only checked when previous data has been sent completely. This may result in a slowdown of the data transfer rate from UART to network. Please evaluate."