SIGNALESP: Firm- und Hardware für SIGNALduino direkt auf ESP8266 oder ESP32

Begonnen von Ralf9, 24 Januar 2018, 20:04:44

Vorheriges Thema - Nächstes Thema

juergs

Hallo Ralf,

ich habe bei mir für den ESP32 die Erzeugung des MAP-Files mal testweise ausprobiert:

Vorschlag Webseite:
Zitatrecipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -Wl,–start-group  {object_files} "{build.path}/arduino.ar" {compiler.c.elf.libs} -Wl,-Map=arduino.map -Wl,–cref -Wl,-EL -Wl,–end-group -o "{build.path}/{build.project_name}.elf"

Arduino:
Zitatrecipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -Wl,--start-group {object_files} "{archive_file_path}"     {compiler.c.elf.libs} -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf"

Meine Einstellung in C:\Users\<user>\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\platform.txt :
Zitat## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--Map=arduino.map -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf"

erzeugt leider bei mir in C:\Program Files (x86)\Arduino die MAP-Datei.

ZitatA file called arduino.map will appear in Users\Richard\AppData\Local\VirtualStore\Program Files (x86)\Arduino, replace "Richard" with your Windows Username.....

This came in very handy as I soon found RAM segments that I could have easily turned into constants with the const declaration, and then FLASH would have been used to store the variable and not RAM, example:

    int variableOne; // this is in RAM

    const int variableTwo; // this is in FLASH

When searching for RAM usage in the map file, look for the .dram0.data section and this is where all the RAM variables are held. You will see sections that look like:

    .data.lastConnected
    0x3ffc10c4 0x4 C:\Users\Richard\AppData\Local\Temp\arduino_build_730303\sketch\cdstick_2.ino.cpp.o
    0x3ffc10c4 lastConnected

This is showing you a variable called lastConnected at memory location 0x3ffc10c4 taking 4 bytes and the variable resides in the file C:\Users\Richard\AppData\Local\Temp\arduino_build_730303\sketch\cdstick_2.ino.cpp.



Ralf9

habs bei mir mal eingefügt:
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {compiler.libraries.ldflags} -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} {build.extra_libs} -Wl,-Map=arduino.map -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf"


Kann aber nach dem compile unter linux die map Datei nicht finden
FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

juergs

Bin auch am versuchen, das direkt in den Temp-Ordner zu legen.
Wenn Du "{build.path}/{build.project_name}.map" statts arduino.map angibst?

Ralf9

Der EvilCrow ist gerade wieder lieferbar
https://de.aliexpress.com/item/1005002476481892.html
was mir nicht klar ist, sind die Filter an den Antennen für 433 oder 868 MHz oder sind sie für 433 und 868 ausgelegt?
FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

juergs

Schau mal hier: https://github.com/joelsernamoreno/EvilCrow-RF/blob/main/schematics/Schematic_EvilCrow%20RF.pdf
Würde annehmen 433MHz. Sinnvoll wäre natürlich: einer 433 und der andere 868MHz.

ZitatAs it has two CC1101 modules it can receive or transmit on two different frequencies at the same time

juergs

Ich habe eine Portierung von Ralf9s Version auf VSCOde mit PlatformIO für den WEMOS D1 ESP32 gemacht:

https://github.com/juergs/Signal_ESP32

Da PlatformIO stringenter compiliert, ist musste ich einen Änderungen durchführen.
Der ESP32-WifiManager ist auch schon eingebaut und OTA vorgesehen.

PIN-Übersicht

Allerdings hänge ich gerade noch an diesem [-Werror=reorder]-Fehler:

Zitat
lib\signalDecoder\src/signalDecoder4.h: In constructor 'SignalDetectorClass::SignalDetectorClass()':
lib\signalDecoder\src/signalDecoder4.h:135:21: error: 'SignalDetectorClass::last' will be initialized after [-Werror=reorder]
   int16_t*  last  = NULL  ;                              // Pointer to last  buffer entry
                     ^
In file included from src\main.cpp:54:0:
lib\signalDecoder\src/signalDecoder4.h:112:29: error:   'BitStore<750u> SignalDetectorClass::sd_message' [-Werror=reorder]
   BitStore<defMaxMsgSize/2> sd_message;       //--- container, using 4 bit for every value stored.
                             ^
In file included from src\main.cpp:54:0:
lib\signalDecoder\src/signalDecoder4.h:181:3: error:   when initialized here [-Werror=reorder]
   SignalDetectorClass() : first(buffer), last(NULL), sd_message(4)
   ^

/edit: Lösung gefunden!

ZitatProcessing wemos_d1_mini32 (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
-------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 (3.2.0) > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 3.10006.210326 (1.0.6)
- tool-esptoolpy 1.30000.201119 (3.0.0)
- toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 50 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <WiFiManager> 2.0.4-beta+sha.a83ac6e
|   |-- <DNSServer> 1.1.0
|   |   |-- <WiFi> 1.0
|   |-- <ESPmDNS> 1.0
|   |   |-- <WiFi> 1.0
|   |-- <Update> 1.0
|   |-- <WebServer> 1.0
|   |   |-- <WiFi> 1.0
|   |   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|-- <bitstore> 1.0.0
|-- <config>
|-- <output> 1.0.0
|   |-- <SPI> 1.0
|   |-- <WiFi> 1.0
|-- <signaldecoder> 1.0.0
|   |-- <bitstore> 1.0.0
|   |-- <output> 1.0.0
|   |   |-- <SPI> 1.0
|   |   |-- <WiFi> 1.0
|-- <SimpleFIFO> 1.0.0
|-- <DNSServer> 1.1.0
|   |-- <WiFi> 1.0
|-- <SPI> 1.0
|-- <WiFi> 1.0
|-- <EEPROM> 1.0.3
Building in release mode
Compiling .pio\build\wemos_d1_mini32\libc55\signalDecoder\signalDecoder4.cpp.o
Archiving .pio\build\wemos_d1_mini32\libFrameworkArduino.a
lib\signalDecoder\src\signalDecoder4.cpp: In member function 'void SignalDetectorClass::processMessage(uint8_t)':
lib\signalDecoder\src\signalDecoder4.cpp:514:36: warning: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Wstrict-overflow]
       while (mstartNeu < mstartNeu+40 && mstartNeu < (messageLen - minMessageLen)) // alle folgenden sync ueberspringen
                                    ^
Archiving .pio\build\wemos_d1_mini32\libc55\libsignalDecoder.a
Linking .pio\build\wemos_d1_mini32\firmware.elf
Retrieving maximum program size .pio\build\wemos_d1_mini32\firmware.elf
Checking size .pio\build\wemos_d1_mini32\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  13.3% (used 43576 bytes from 327680 bytes)
Flash: [=======   ]  67.1% (used 879646 bytes from 1310720 bytes)
Building .pio\build\wemos_d1_mini32\firmware.bin
esptool.py v3.0
============= [SUCCESS] Took 9.77 seconds ================================

Werde die Änderungen in Github nachreichen.


juergs

Der erste Teil der Signalduino-FW geht schon mal mit Wifimanager:
rst:0xc (SW_CPU_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:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8


Started
Reset to AP command? (enter 'reset') Timeout:2500
*wm:[1] AutoConnect
*wm:[2] ESP32 event handler enabled
*wm:[2] Connecting as wifi client...
*wm:[2] setSTAConfig static ip not set, skipping
*wm:[1] Connecting to SAVED AP: <myAP>
*wm:[1] connectTimeout not set, ESP waitForConnectResult...
*wm:[2] Connection result: WL_CONNECTED
*wm:[1] AutoConnect: SUCCESS
*wm:[1] STA IP Address: 192.168.xxx.yyy
WifiManager had connected ...yeey :)
main.cpp:541: i = 0
192.168.xxx.yyy:23' to connect
main.cpp:611: void setup()
main.cpp:626: void setup()
main.cpp:826: hasCC1101 = 1
main.cpp:630: void setup()
main.cpp:634: void setup()
main.cpp:642: void setup()
[E][WiFiClient.cpp:288] setSocketOption(): 1006 : 9
*wm:[2] Connection result: WL_CONNECTED
*wm:[1] AutoConnect: SUCCESS
*wm:[1] STA IP Address: 192.168.xxx.yyy
WifiManager had connected ...yeey :)
main.cpp:541: i = 0
192.168.xxx.yyy:23' to connect
main.cpp:611: void setup()
main.cpp:626: void setup()
main.cpp:826: hasCC1101 = 1
main.cpp:630: void setup()
main.cpp:634: void setup()
main.cpp:642: void setup()
[E][WiFiClient.cpp:288] setSocketOption(): 1006 : 9


CC1101 wird erkannt!
Hängt jetzt aber noch im WifiClient fest!   ... und hier
core-debug-level-in-esp32/

juergs

Zitat[E][WiFiClient.cpp:288] setSocketOption(): 1006 : 9

Verursacher:
MSG_PRINTER.setTimeout(400);

Obige Fehlermeldung kommt wenn ein Timeout gesetzt wird, bevor ein Telnet-Client verbunden ist.
Besser erst nach dem Connect.


Interessant ist, dass nach einigen Versions-Updates des Expressifs SDKs nun einfach der Hardwaredebugger nicht mehr will...  :o :(
ZitatOpen On-Chip Debugger  v0.10.0-esp32-20201202 (2020-12-02-17:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

adapter speed: 20000 kHz

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
Warn : Interface already configured, ignoring
adapter speed: 5000 kHz

Error: failed to reset FTDI device: LIBUSB_ERROR_PIPE
Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'
** OpenOCD init failed **
shutdown command invoked

Assertion failed!

https://github.com/espressif/openocd-esp32/issues/159

https://www.bibble.co.nz/mediawiki/index.php/ESP32

Diese Lib funktioniert auch mit dem ESP32+Wifimanager:
https://github.com/LennartHennigs/ESPTelnet

ZitatTelnet Test
- Wifi:  192.168.1xx.1xx
- Telnet: running
- Telnet: 192.168.1xx.3xx connected
XQ
- Telnet: Version
br
- Telnet: 192.168.1xx.3yy connected
XQ
- Telnet: Version
br
XE
- Telnet: Version
P
P



Ralf9

Hast Du auch schon mal static IP versucht?
Mit DHCP funktioniert bei mir der Wifimanager,
wenn ich aber damit static IP versuche, erfolgt zwar ein connect, aber ich kann mich nicht mit telnet darauf verbinden.
Bei einem Portscan wird kein offener Port 23 gefunden
wifiManager.setSTAStaticIPConfig(ip,gateway,netmask);
FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

juergs

ja, gleiches Verhalten bei mir. Auch mit DHCP nicht (Lib-Version?). Nicht mal ein connect!
Deshalb wollte ich die neue Lib integrieren. Die funktioniert!
Ich benutze die DEV-Version vom Wifimanager.

Ralf9

Bis auf ein paar Kleinigkeiten funktioniert die Maplesduino firmware jetzt auch auf dem ESP32.
Hier ist vorab eine Beschreibung, es ist momentan nur zum selbst compileren mit der Arduino IDE. Den Code auf dem github reiche ich noch nach.

Ein "get version" gibt:
V 4.2.0-dev210609 SIGNALduinoAdv ESP32 cc1101 (R: A1 B0*) - compiled at Jun  9 2021 22:58:28

Es sind damit u.a. auch bis zu 4 cc1101 Module möglich.
Der messagebuffer ist nicht mehr auf nur 254 Werte begrenzt.
Weitere neuerungen und eine Befehlsübersicht siehe hier ganz unten
https://forum.fhem.de/index.php/topic,106278.msg1001477.html#msg1001477

Wenn der ESP32 mit dem Seriellen Monitor verbunden wird, gibts debugausgaben vom WifiManager.
Es gibt auch ein kleines serielles config Menü

Wenn innerhalb von 2.5 Sek 'cmd' eingegeben wird
serial menue? (enter 'cmd') Timeout:2500
Kommt ein Menü
serial command menue
i - printDiag
c - change DHCP <> StaticIP, act: static
R - resetWifiSettings
q - quit

Mit 'R' wird die Wificonfig zurückgesetzt
Return to AP-mode, because reset command received.
*WM: [1] resetSettings
...
*WM: [2] Enabling AP
*WM: [1] StartAP with SSID:  ESP32DuinoConfig


Es kann zwischen DHCP und static IP gewechselt werden.

Da ist auch noch mein kleines Problem.
Wenn die static IP im configportal geändert wurde, möchte ich sie im EEPROM speichern.

Es gibt dafür eine Routine "saveIp()", damit wird die IP, Gateway und  subnetMask gespeichtert.
Es soll ins flash geschrieben werden wenn mindestens eine Routine "true" zurück liefert.

bool saveFlag;
saveFlag = saveIp(WiFi.localIP(), EE_IP4_ADDR) || saveIp(WiFi.gatewayIP(), EE_IP4_GATEWAY) || saveIp(WiFi.subnetMask(), EE_IP4_NETMASK);
if (saveFlag) {
tools::EEstore();
Serial.println(F("IPaddress changed -> save"));
}

Es funktioniert so aber nicht wie gewünscht, kann es sein, daß wenn die erste  saveIp() Routine true zurückliefert, daß dann die folgenden beiden Routinen nicht mehr ausgeführt werden?

Gruß Ralf

FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7


Ralf9

Danke, nun funktioniert es (ist momentan nur für den ESP32)
https://github.com/Ralf9/SIGNALDuino/tree/dev-r420_cc1101
Es muß dazu noch in der Arduino IDE der WifiManager installiert werden (siehe Anlage)
FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7

juergs

Das Timoutsetzen, bevor ein  Telnet-Client verbunden war:
machte bei mir Probleme, deshalb auskommentiert.

Wird dieses Timeout benötigt? Ansonsten Standard-Timeout 45 Sekunden?
Im Moment bekomme ich leider noch ein "connection rejected" ....  :(

Also probiere ich es mal mit dem Einbau des anderen Telnet-Servers.
Es ist etwas sagen wir mal "undurchsicht" welcher Client welche Funktion ausführt ...
und die Umwidmung auf MSG_PRINTER mach es auch nicht besser ;-)

Mein ESP32-Debugger über openocd macht im Moment leider nur Probleme!
Auch im Prinzip: welche Version (von den vielen) was wo aufruft.
Das Fehlen von Debug-Infos an den entscheidenen Stellen macht es auch nicht besser ...



Ralf9

FHEM auf Cubietruck mit Igor-Image, SSD und  hmland + HM-CFG-USB-2,  HMUARTLGW Lan,   HM-LC-Bl1PBU-FM, HM-CC-RT-DN, HM-SEC-SC-2, HM-MOD-Re-8, HM-MOD-Em-8
HM-Wired:  HMW_IO_12_FM, HMW_Sen_SC_12_DR, Selbstbau IO-Module HBW_IO_SW
Maple-SIGNALduino, WH3080,  Hideki, Id 7