FKW9 / esp-smartmeter-netznoe

Read Smartmeter Data and store to SD Card or publish to Graphite
MIT License
14 stars 4 forks source link

How-To Compile this Project ? #2

Closed Noschvie closed 2 years ago

Noschvie commented 2 years ago

Is there a How-To get this compiled and running ? Thanks!

FKW9 commented 2 years ago

Are you using PlatformIO? Otherwise i can't really help you

Noschvie commented 2 years ago

Have installed Visual Studio Code and extension "PlatformIO IDE for VSCode". Please find below the output with warnings, BIN file seems to be created, isn't it ?

> Executing task: C:\Users\nosch\.platformio\penv\Scripts\platformio.exe run --environment ESP8266 <

Processing ESP8266 (platform: espressif8266; board: esp01_1m; framework: arduino)
-------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp01_1m.html
PLATFORM: Espressif 8266 (3.2.0) > Espressif Generic ESP8266 ESP-01 1M
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
PACKAGES:
 - framework-arduinoespressif8266 3.30002.0 (3.0.2)
 - tool-esptool 1.413.0 (4.13)
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa 2.100300.210717 (10.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 39 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <mbedtls-psk> 0.1.0
|-- <ESP8266 and ESP32 OLED driver for SSD1306 displays> 4.3.0
|   |-- <Wire> 1.0
|-- <display>
|   |-- <ESP8266 and ESP32 OLED driver for SSD1306 displays> 4.3.0
|   |   |-- <Wire> 1.0
|   |-- <Wire> 1.0
|-- <graphite>
|   |-- <ArduinoOTA> 1.0
|   |   |-- <ESP8266WiFi> 1.0
|   |   |-- <ESP8266mDNS> 1.2
|   |   |   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266mDNS> 1.2
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <display>
|   |   |-- <ESP8266 and ESP32 OLED driver for SSD1306 displays> 4.3.0
|   |   |   |-- <Wire> 1.0
|   |   |-- <Wire> 1.0
Building in release mode
Compiling .pio\build\ESP8266\src\main.cpp.o
Generating LD script .pio\build\ESP8266\ld\local.eagle.app.v6.common.ld
Compiling .pio\build\ESP8266\libc94\mbedtls-psk\aes.c.o
Compiling .pio\build\ESP8266\libc94\mbedtls-psk\aesni.c.o
src\main.cpp: In function 'void loop()':
src\main.cpp:136:65: warning: ':' directive writing 1 byte into a region of size between 0 and 5 [-Wformat-overflow=]
  136 |                     sprintf(timeStamp, "%02u.%02u.%04u %02u:%02u:%02u", day, month, year, hour, minute, second);
      |                                                                 ^
src\main.cpp:136:40: note: directive argument in the range [0, 255]
  136 |                     sprintf(timeStamp, "%02u.%02u.%04u %02u:%02u:%02u", day, month, year, hour, minute, second);
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src\main.cpp:136:28: note: 'sprintf' output between 20 and 26 bytes into a destination of size 21
  136 |                     sprintf(timeStamp, "%02u.%02u.%04u %02u:%02u:%02u", day, month, year, hour, minute, second);
      |                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio\build\ESP8266\libc94\mbedtls-psk\arc4.c.o
...
Compiling .pio\build\ESP8266\FrameworkArduino\umm_malloc\umm_info.c.o
Compiling .pio\build\ESP8266\FrameworkArduino\umm_malloc\umm_integrity.c.o
Compiling .pio\build\ESP8266\FrameworkArduino\umm_malloc\umm_local.c.o
Compiling .pio\build\ESP8266\FrameworkArduino\umm_malloc\umm_malloc.cpp.o
Compiling .pio\build\ESP8266\FrameworkArduino\umm_malloc\umm_poison.c.o
Archiving .pio\build\ESP8266\libFrameworkArduino.a
Linking .pio\build\ESP8266\firmware.elf
Retrieving maximum program size .pio\build\ESP8266\firmware.elf
Checking size .pio\build\ESP8266\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=====     ]  51.9% (used 42504 bytes from 81920 bytes)
Flash: [=====     ]  46.5% (used 354160 bytes from 761840 bytes)
Building .pio\build\ESP8266\firmware.bin
Creating BIN file ".pio\build\ESP8266\firmware.bin" using "C:\Users\nosch\.platformio\packages\framework-arduinoespressif8266\bootloaders\eboot\eboot.elf" and ".pio\build\ESP8266\firmware.elf"
===================================================== [SUCCESS] Took 55.76 seconds =====================================================

Environment    Status    Duration
-------------  --------  ------------
ESP8266        SUCCESS   00:00:55.755
===================================================== 1 succeeded in 00:00:55.755 =====================================================
FKW9 commented 2 years ago

Yes, this was a successful build. Can you upload it to your ESP? BTW check the selected environment, you built it for ESP8266

Noschvie commented 2 years ago

Visual Studio Code is running in a virtual machine, recompiled for ESP32.

Using ESP-Flasher-Windows-x64.exe leads to this output:

Using 'COM4' as serial port.
Connecting....
Detecting chip type... ESP32
Connecting....

Chip Info:
 - Chip Family: ESP32
 - Chip Model: ESP32-D0WDQ6 (revision 1)
 - Number of Cores: 2
 - Max CPU Frequency: 240MHz
 - Has Bluetooth: YES
 - Has Embedded Flash: NO
 - Has Factory-Calibrated ADC: YES
 - MAC Address: 24:62:AB:FC:B5:C0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
 - Flash Size: 4MB
 - Flash Mode: dio
 - Flash Frequency: 40MHz
Erasing flash (this may take a while)...
Chip erase completed successfully in 7.3s
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x000d2fff...
Compressed 17104 bytes to 11191...
Writing at 0x00001000... (100 %)
Wrote 17104 bytes (11191 compressed) at 0x00001000 in 0.4 seconds (effective 316.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 129...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (129 compressed) at 0x00008000 in 0.0 seconds (effective 523.7 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 948.9 kbit/s)...
Hash of data verified.
Compressed 794704 bytes to 458939...
Writing at 0x00010000... (3 %)
...
Writing at 0x000d1eb0... (100 %)
Wrote 794704 bytes (458939 compressed) at 0x00010000 in 11.1 seconds (effective 574.0 kbit/s)...
Hash of data verified.

Leaving...
Hard Resetting...
Hard resetting via RTS pin...
Done! Flashing is complete!

Showing logs:
[21:43:06]ets Jun  8 2016 00:22:57
[21:43:06]
[21:43:06]rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[21:43:06]configsip: 0, SPIWP:0xee
[21:43:06]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[21:43:06]mode:DIO, clock div:2
[21:43:06]load:0x3fff0018,len:4
[21:43:06]load:0x3fff001c,len:1044
[21:43:06]load:0x40078000,len:10124
[21:43:06]load:0x40080400,len:5828
[21:43:06]entry 0x400806a8
FKW9 commented 2 years ago

Is the last part the serial output of the ESP? If you get this Message after line "Showing logs" continuously, it seems like you are stuck in a boot loop, but i cannot tell from this log.

Are you receiving messages from the ESP? You can check this by connecting to the serial port on which your ESP is and restart it and you should see messages appear.

Noschvie commented 2 years ago

Something is missing to get this firmware running. Flashing Tasmota to this ESP using ESP-Flasher-Windows-x64.exe leads to a running system.

Have no display connected and tested with disconnected / connected M-Bus interface. Any idea ?

FKW9 commented 2 years ago

Sorry, i do not really understand what's your problem.

The warnings seen in here can be ignored. The ESP should print something to the serial port (when booting), with or without the connected hardware. Please check that first.

Noschvie commented 2 years ago

Fix #3 solved this issue, thanks!