OpenSprinkler Forums OpenSprinkler Unified Firmware ESP32 port of 2.1.9 firmware

Viewing 25 posts - 76 through 100 (of 126 total)
  • Author
    Posts
  • #75912

    polskifacet
    Participant

    I grabbed the new one and made pin changes etc. Same error coming up.

    ets Jul 29 2019 12:21:46

    rst:0xc (SW_CPU_RESET),boot:0x17 (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:0x3fff0030,len:1184
    load:0x40078000,len:13104
    load:0x40080400,len:3036
    entry 0x400805e4
    started
    Scanning i2c for devices…
    No I2C devices found
    Using GPIO IOEXP
    Starting to detect expanders
    hw_type = 172 hw_rev = 0
    Starting sensors – INPUT_PULLUP
    Sensor1 PIN: 36
    Sensor2 PIN: 2
    Starting RFTX pins
    RFTX PIN: 255
    LCD SSD1306 init
    Init file system…
    Flash size: 4194304 bytes
    Done.
    Detecting RTC
    SPIFFS dir:
    FILE: prog.dat
    FILE: done.dat
    FILE: 19501.txt
    FILE: 19503.txt
    FILE: iopts.dat
    FILE: sopts.dat
    FILE: stns.dat
    FILE: nvcon.dat
    Starting network

    assert failed: tcpip_send_msg_wait_sem IDF/components/lwip/lwip/src/api/tcpip.c:455 (Invalid mbox)

    Backtrace: 0x40083de5:0x3ffb24a0 0x4008c9d9:0x3ffb24c0 0x400923dd:0x3ffb24e0 0x40103001:0x3ffb2610 0x40115359:0x3ffb2640 0x401153b9:0x3ffb2660 0x401027b5:0x3ffb26b0 0x401748b1:0x3ffb26d0 0x40174934:0x3ffb2720 0x400e282a:0x3ffb2740 0x400e1ace:0x3ffb2760 0x400d5b81:0x3ffb2780 0x400d7173:0x3ffb27b0 0x400d9357:0x3ffb2800 0x400eb2ca:0x3ffb2820

    ELF file SHA256: 9a6f3cf3917bb35c

    #75929

    Ken.238
    Participant

    How you compile this firmware? I tried but too many error.

    #75936

    v1pr
    Participant

    read the readme and the previous posts (the FW still not works, but you can get rid of the errors)

    #75937

    v1pr
    Participant

    @Ray: the error is in the OTF library somewhere 🙁 Do you’ve any idea what can be behind it?

    assert failed: tcpip_send_msg_wait_sem IDF/components/lwip/lwip/src/api/tcpip.c:455 (Invalid mbox)

    The error is within somewhere in localServer.begin();

    #75948

    usydow
    Participant

    @V1pr
    I have found a workaround!
    There seems to be no WIFI connection, so the start of the web server goes nowhere.

    DEBUG_PRINT(“ETH enabled: “);
    DEBUG_PRINTLN(useEth);
    DEBUG_PRINT(“Wifi mode: “);
    DEBUG_PRINTLN(( get_wifi_mode() == WIFI_MODE_STA ) ? F(“STA”) : F(“AP”));
    –> start_network_sta(“myssid”,”mypassword”);
    // FIXME, just for testing
    //::start_server_ap();
    delay(500);
    if((useEth || get_wifi_mode()==WIFI_MODE_STA) && otc.en>0 && otc.token.length()>=32) {
    otf = new OTF::OpenThingsFramework(httpport, otc.server, otc.port, otc.token, false, ether_buffer, ETHER_BUFFER_SIZE);
    DEBUG_PRINTLN(F(“Started OTF with remote connection”));

    #75951

    Ray
    Keymaster

    I have not followed this thread closely because I haven’t compiled the firmware for ESP32. But the OTF library is designed to support ESP32 as well.

    #75952

    v1pr
    Participant

    @usydow great, I was thinking the same (that’s why the start AP is there). There is a glitch in the whole flow somewhere 🙁 upon the first start (after factory reset), the controller should start an AP, which happens later than wifiserver begin… Logically this should not work on the original esp8266 either…


    @Ray
    ,the esp32 otf is missing the flush/close for sure

    #75968

    v1pr
    Participant

    @usydow: thanks for the finding, I’ve fixed it.


    @Ken
    .238 @polskifacet please download the latest/refresh. Everything should be fixed know, no workarounds needed (platformio should update espressif32 platfrom automatically for correct version)

    #75971

    Ken.238
    Participant

    It compile without error but once wifi start keep factory reset. Below is I copy from platformio serial monitor. Thanks for hard work.

    Starting AP
    Starting AP with SSID OS_5361C8
    Connecting in AP_STA to WiFi network ORBI25
    IP received by client, restart.
    Prepare to restart…
    ets Jul 29 2019 12:21:46

    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:0x3fff0030,len:1184
    load:0x40078000,len:13192
    load:0x40080400,len:3028
    entry 0x400805e4
    Build timestamp: Jun 5 2023 18:11:05
    — Starting setup
    Scanning i2c for devices…
    No I2C devices found
    Using GPIO IOEXP
    Starting to detect expanders
    hw_type = 172 hw_rev = 0
    Starting sensors – INPUT_PULLUP
    Sensor1 PIN: 39
    Sensor2 PIN: 33
    Starting RFTX pins
    RFTX PIN: 255
    LCD SSD1306 init
    Init file system…
    Flash size: 4194304 bytes
    Done.
    Detecting RTC…done.
    — Setting up options
    Factory reset
    [ 24726][E][WiFiAP.cpp:141] softAP(): SSID missing!
    Starting AP with SSID
    — PD init
    — Time setup
    Starting network
    ETH enabled: 0
    Wifi mode: AP
    OTF start with http_port 80
    Started OTF with just local connection
    DNSServer start
    Setting update server
    Starting MDNS service
    [ 27425][E][ESPmDNS.cpp:148] addService(): Failed adding service _http._tcp.

    [ 27426][E][ESPmDNS.cpp:169] addServiceTxt(): Failed setting service TXT
    Started update server
    — MQTT Init
    2106-02-07 01:28:43 – MQTT Init
    2106-02-07 01:28:43 – MQTT Init: ClientId OS-CCDBA75361C8
    Starting AP
    Starting AP with SSID OS_5361C8

    #75973

    Ray
    Keymaster

    @v1pr, you said “Logically this should not work on the original esp8266 either…” — I don’t understand what this is referring to. Did you mean some line of code should have appeared before some other line of code? If i had to take a guess: note that creating ESP8266WebServer merely creates the object, it doesn’t do anything yet and certainly does not require having WiFi ready at that point. Same with creating the OpenThingsFramework object. The WiFi AP started at this line of code:
    https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/main.cpp#L463
    The otf->loop() function does the house keeping of responding to WiFi web requests. AP needs to be started before that, which is the case with the code.

    #75974

    polskifacet
    Participant

    compiles fine, screen doesn’t work. AP mode works, add my ssid etc, then reboots back to ap mode. Seems chip is warmer than with 2.1.9 original working firmware?

    Started update server
    — MQTT Init
    2106-02-07 01:28:34 – MQTT Init
    2106-02-07 01:28:34 – MQTT Init: ClientId OS-A0B7654CB00C
    Starting AP
    Starting AP with SSID OS_4CB00C
    Connecting in AP_STA to WiFi network Cisco
    IP received by client, restart.
    Prepare to restart…
    ets Jul 29 2019 12:21:46

    rst:0xc (SW_CPU_RESET),boot:0x17 (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:0x3fff0030,len:1184
    load:0x40078000,len:13192
    load:0x40080400,len:3028
    entry 0x400805e4
    Build timestamp: Jun 5 2023 20:20:19
    — Starting setup
    Scanning i2c for devices…
    No I2C devices found
    Using GPIO IOEXP
    Starting to detect expanders
    hw_type = 172 hw_rev = 0
    Starting sensors – INPUT_PULLUP
    Sensor1 PIN: 36
    Sensor2 PIN: 2
    Starting RFTX pins
    RFTX PIN: 255
    LCD SSD1306 init
    Init file system…
    Flash size: 4194304 bytes
    Done.
    Detecting RTC…done.
    — Setting up options
    Factory reset
    [ 16117][E][WiFiAP.cpp:141] softAP(): SSID missing!
    Starting AP with SSID
    — PD init
    — Time setup
    Starting network
    ETH enabled: 0
    Wifi mode: AP
    OTF start with http_port 80
    Started OTF with just local connection
    DNSServer start
    Setting update server
    Starting MDNS service
    [ 18814][E][ESPmDNS.cpp:148] addService(): Failed adding service _http._tcp.

    [ 18815][E][ESPmDNS.cpp:169] addServiceTxt(): Failed setting service TXT
    Started update server
    — MQTT Init
    2106-02-07 01:28:34 – MQTT Init
    2106-02-07 01:28:34 – MQTT Init: ClientId OS-A0B7654CB00C
    Starting AP
    Starting AP with SSID OS_4CB00C

    #76002

    usydow
    Participant

    I have a few hardware questions?
    I have tested a LAN connection.
    Since I still had a board with the LAN8720, this was no problem. The drivers are already present by default. Like in the example code:
    https://github.com/espressif/arduino-esp32/blob/f1b06d2a74acdef190ac16e83d48ab619f557e73/libraries/Ethernet/examples/ETH_LAN8720/ETH_LAN8720.ino
    Runs without problems! (Testcode)
    byte OpenSprinkler::start_network() {
    lcd_print_line_clear_pgm(PSTR(“Starting…”), 1);
    uint16_t httpport = (uint16_t)(iopts[IOPT_HTTPPORT_1]<<8) + (uint16_t)iopts[IOPT_HTTPPORT_0];

    #ifdef ENABLE_DEBUG
    #if defined(ESP32)
    //DEBUG_PRINTLN(F(“SPIFFS dir:”));
    //SPIFFS_list_dir();
    DEBUG_PRINTLN(F(“Starting network”));
    useEth = false;
    WiFi.onEvent(WiFiEvent);
    ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_TYPE, ETH_CLK_MODE);
    delay(1000);
    #endif //ESP32
    #endif

    #if defined(ESP8266) || defined(ESP32)

    DEBUG_PRINT(“ETH enabled: “);
    DEBUG_PRINTLN(useEth);
    DEBUG_PRINT(“Wifi mode: “);
    DEBUG_PRINTLN(( get_wifi_mode() == WIFI_MODE_STA ) ? F(“STA”) : F(“AP”));
    //start_network_sta(“myssid”,”mypassword”);
    // FIXME, just for testing
    //::start_server_ap();
    Since now relatively many GPIOs are needed for the LAN connection I would control the portexpander via I2C. Or does the 74HC595 have advantages?
    What is the encoder needed for?

    #76009

    v1pr
    Participant

    Sorry for the late reply, did not see the update mails.


    @Ray
    , it seems to me, that after a factory reset the AP is not started, but OTF is in OpenSprinkler::start_network() and this leads to a crash, when OTF want’s to start the server (server.begin) – I’m guessing here – ‘cos the TCP stack is not available. If I start an AP/STA beforhand, than it does not crash.


    @polskifacet
    which LCD are you using?


    @usydow
    : I’ve (hard)disabled LAN support (for now). It’s possible to get it working, but I don’t have any LAN boards now. It does not matter if you use I2C portexpander or an 74HC595 shift-register. I’m using the later on my custom board, since that’s how my friend designed it. On an another install I’ve I2C expanders. Really does not matter. About the encoder: I’m not 100% happy with the 3 button solution, I prefer to use a rotary encoder, but did not had the time to finish the implementation – it’s much more difficult, than I first calculated due to the extensive button logic.

    Finally my test setup’s parts arrived, I’ll put the together quickly to speed up the debugging.

    #76010

    polskifacet
    Participant

    The original 2.1.9 firmware port works, its a esp32 board with OLED built in. It’s the .96 (SSD1306) screen.

    https://randomnerdtutorials.com/esp32-built-in-oled-ssd1306/

    #76014

    Ray
    Keymaster

    @v1pr: as I said, those functions in OpenSprinkler::start_network only create various objects and initialize them, AP does not need to be started at that point. In any case, I’ve never observed ESP8266 crashing due to this. Is this causing ESP32 to crash?

    #76024

    v1pr
    Participant

    @Ray: seems so. I was able to track it down to OTF ESP32 server.begin() – that’s where it’s crashes (after factory reset). If I initialize an AP beforehand, all is OK.

    #76027

    Ray
    Keymaster

    OK so maybe the way ESP32 works is different.

    #76029

    v1pr
    Participant

    The LCD works for me, but I only hae 1.3″ one, which uses the SH1106 driver. One bug still exists, the LCD turns off after ~10s, when everything is initialized… still chasing that one.

    I’ve pushed a new version to git, managed to fix the factory_reset loop, please give it a try (don’t forget to change the LCD type to LCD_SSD1306 in esp32.h ! )

    #76043

    Ken.238
    Participant

    I compile the one from git seem like working. Only the buttons and sensors not test yet, I need to locate where the gpio define. Thanks for your hard work.

    #76055

    Ken.238
    Participant

    I test the firmware seem like working only those sensors not work or I test wrong gpio. Can you post those define gpio?

    #76063

    v1pr
    Participant

    Sure, it’s in esp32.h:

    #define E0_PIN_SENSOR1 39 // sensor 1
    #define E0_PIN_SENSOR2 33 // sensor 2

    If debug is enabled, than you can also check in the output upon bootup.

    #76066

    polskifacet
    Participant

    I ended up erasing the flash on my esp32 and then pulled the repo again. Great news, no more boot loop! I can log into web ui and confirmed the pins I have defined work as intended. Only thing that doesn’t work for me is the screen, seems like it loads the right library so not sure. I see one error at the end of this log “[ 17561][E][vfs_api.cpp:105] open(): /littlefs/logs/19521.txt does not exist, no permits for creation”

    Connecting in AP_STA to WiFi network Cisco
    IP received by client, restart.
    Prepare to restart…
    ets Jul 29 2019 12:21:46

    rst:0xc (SW_CPU_RESET),boot:0x17 (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:1
    load:0x3fff0030,len:1184
    load:0x40078000,len:13220
    ho 0 tail 12 room 4
    load:0x40080400,len:3028
    entry 0x400805e4
    Build timestamp: Jun 13 2023 09:56:21
    — Starting setup
    Scanning i2c for devices…
    No I2C devices found
    Using GPIO IOEXP
    Starting to detect expanders
    hw_type = 172 hw_rev = 0
    Starting sensors – INPUT_PULLUP
    Sensor1 PIN: 36
    Sensor2 PIN: 2
    Starting RFTX pins
    RFTX PIN: 255
    LCD SSD1306 init
    Init file system…
    Flash size: 4194304 bytes
    Listing directory: /
    FILE: done.dat SIZE: 1
    FILE: iopts.dat SIZE: 64
    FILE: nvcon.dat SIZE: 16
    FILE: prog.dat SIZE: 1
    FILE: sopts.dat SIZE: 1920
    FILE: stns.dat SIZE: 17856
    Done.
    Detecting RTC…done.
    [ 1752][E][WiFiAP.cpp:141] softAP(): SSID missing!
    Starting AP with SSID
    — Setting up options
    — PD init
    — Time setup
    FILE: done.dat
    FILE: iopts.dat
    FILE: nvcon.dat
    FILE: prog.dat
    FILE: sopts.dat
    FILE: stns.dat
    Starting network
    ETH enabled: 0
    Wifi mode: STA
    OTF start with http_port 80
    Started OTF with just local connection
    DNSServer start
    Setting update server
    Started update server
    — MQTT Init
    2106-02-07 01:28:29 – MQTT Init
    2106-02-07 01:28:29 – MQTT Init: ClientId OS-A0B7654CB00C
    Setting up WiFi client
    Connecting in STA to WiFi network Cisco
    mDNS responder started
    req_mqtt_restart
    2106-02-07 01:28:30 – MQTT Begin
    2106-02-07 01:28:30 – MQTT Begin: Config (:1883 ) Disabled
    NTP Syncing…
    using default time servers
    1686675900
    weather.opensprinkler.com:80(0)
    &tz=32&sunrise=308&sunset=1222&eip=2728279798&rawData={“wp”:”Manual”}&errCode=0
    [ 17561][E][vfs_api.cpp:105] open(): /littlefs/logs/19521.txt does not exist, no permits for creation

    #76067

    v1pr
    Participant

    @polskifacet the error is ok, it’s due to the internal working of LittleFS. About the screen: are you sure, it’s a 0.96″? You can try switching to SH1106. The lib is the same as in the original FW and Ja.Carer’s fw… other thing you can try, is to change the OLED lib’s version in platformio.ini (4.4.0 is the latest ). Cabeling is ok? PIN21 = SDA PIN22 = SCK is the I2C

    #76069

    polskifacet
    Participant

    No luck
    – updated lib to 4.4.0
    – tried SH1106 and SSD1306
    – Flashed Ja.Carer’s fw and it works

    #76072

    v1pr
    Participant

    That’s interesting… Nothing happens, if you press a button? Or after a factory reset it’s still black? No logo, nothing?
    When, you flash back with the old 2.1.9 fw, than you’re using Arduino Ide, right? What is the oled’s library version there? (search for ssd1306 in library manager, should be the ThingPulse one)

Viewing 25 posts - 76 through 100 (of 126 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware ESP32 port of 2.1.9 firmware