ESP32 Command Station

Atani Dec 10, 2017

  1. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    Just realised that I have absolutely no idea what you mean here. I got the fact that the I2C could be 3.3v/5v or 5v only, and that the SDA/SCL outputs on the ESP32 will be 3.3v. I get that theoretically, this means that if the I2C is 5v only, I will need to change the voltage using a MOSFET 5v to 3v regulator. What I don't get is the need for pull-ups anywhere (or even what a pull-up is, sorry). I thought that you just connected the SDA/SCL inputs direct to the pinouts on the ESP32. Have I got this wrong?

    And yes, that was quick for a return...
     
  2. Atani

    Atani TrainBoard Member

    1,331
    1,028
    27
    https://www.nxp.com/docs/en/application-note/AN10441.pdf will cover the mosfet and pull-ups on both sides. The ESP32 has very weak pull-ups built-in (around 45kOhm) which will often work but it is best to have an external pull-up for I2C.

    You will want 2k4 on the 3v3 side and 4k7 on the 5v side.
     
  3. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    Thanks. Think I get it. Looking at my I2C, I think that it is 5v not 3.3v/5v. So run it on 5v and change the logic level of SCL/SDA to 5v using a MOSFET for each line. Thanks.
     
  4. Atani

    Atani TrainBoard Member

    1,331
    1,028
    27
    Depending on the device you are using it may just work at 3v3.
     
  5. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    How can I check that? Is it as simple as applying 3.3v to the vcc, ground to ground and seeing if it switches on? I had heard that one of the issues was contrast.

    Sent from my SM-N976B using Tapatalk
     
  6. Atani

    Atani TrainBoard Member

    1,331
    1,028
    27
    Pretty much yes. What device are you looking at using?

    As for contrast, that sounds like an LCD issue and that may be due to the lower voltage. It's hard to say really.
     
  7. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    20*4 lcd

    Sent from my SM-N976B using Tapatalk
     
  8. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    Yay!! Got past the first hurdle - Gzip is now recognised.

    Next problem - One (or more) OPS H-Bridge required parameters is not defined.

    I'm guessing that I haven't set a variable somewhere, and I'm guessing that this is the first of many variables I haven't set. Where should I have set this?

    Thanks.
     
  9. Atani

    Atani TrainBoard Member

    1,331
    1,028
    27
    It might work as-is by powering with 5v and using SDA/SCL without pull-ups.

    run: idf.py menuconfig
    Go into "DCC Signal" -> "OPS". Check for missing parameters.
    Go into "DCC Signal" -> "PROG". Check for missing parameters.
     
  10. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    C:\DCC++\ESP32CS Mast>idf.py menuconfig
    Checking Python dependencies...
    Python requirements from C:\Users\User\Desktop\esp-idf-3\requirements.txt are satisfied.
    Executing action: menuconfig
    Running cmake in directory 'c:\dcc++\esp32cs mast\build'
    Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 --warn-uninitialized -DWARN_UNINITIALIZED=1 -DCCACHE_ENABLE=1 'c:\dcc++\esp32cs mast'"...
    Warn about uninitialized values.
    -- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.21.0.windows.1")
    -- mconf-idf version mconf-v4.6.0.0-idf-20190628-win32
    -- IDF_TARGET not set, using default target: esp32
    -- ccache will be used for faster recompilation
    -- The C compiler identification is GNU 8.4.0
    -- The CXX compiler identification is GNU 8.4.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/Users/User/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
    -- Check for working C compiler: C:/Users/User/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
    -- Check for working C compiler: C:/Users/User/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: C:/Users/User/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe
    -- Check for working CXX compiler: C:/Users/User/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
    -- Project version: 1
    -- Building ESP-IDF components for target esp32
    -- Project sdkconfig file C:/DCC++/ESP32CS Mast/sdkconfig
    Loading defaults file C:/DCC++/ESP32CS Mast/sdkconfig.defaults...
    C:/DCC++/ESP32CS Mast/sdkconfig.defaults:16 CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED was replaced with CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE
    -- Found PythonInterp: C:/Users/User/.espressif/python_env/idf4.0_py3.7_env/Scripts/python.exe (found version "3.7.3")
    -- Could NOT find Perl (missing: PERL_EXECUTABLE)
    -- Adding linker script C:/DCC++/ESP32CS Mast/build/esp-idf/esp32/esp32_out.ld
    -- Adding linker script C:/Users/User/Desktop/esp-idf-3/components/esp32/ld/esp32.project.ld.in
    -- Adding linker script C:/Users/User/Desktop/esp-idf-3/components/esp32/ld/esp32.peripherals.ld
    -- Adding linker script C:/Users/User/Desktop/esp-idf-3/components/esp_rom/esp32/ld/esp32.rom.ld
    -- Adding linker script C:/Users/User/Desktop/esp-idf-3/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
    -- Adding linker script C:/Users/User/Desktop/esp-idf-3/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
    -- Adding linker script C:/Users/User/Desktop/esp-idf-3/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
    -- Adding linker script C:/Users/User/Desktop/esp-idf-3/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
    -- Components: app_trace app_update asio bootloader bootloader_support bt coap console cxx driver efuse esp-tls esp32 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_http_client esp_http_server esp_https_ota esp_https_server esp_local_ctrl esp_ringbuf esp_rom esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos heap idf_test jsmn json libsodium log lwip mbedtls mdns mqtt newlib nghttp nvs_flash openssl partition_table protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter ulp unity vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
    -- Component paths: C:/Users/User/Desktop/esp-idf-3/components/app_trace C:/Users/User/Desktop/esp-idf-3/components/app_update C:/Users/User/Desktop/esp-idf-3/components/asio C:/Users/User/Desktop/esp-idf-3/components/bootloader C:/Users/User/Desktop/esp-idf-3/components/bootloader_support C:/Users/User/Desktop/esp-idf-3/components/bt C:/Users/User/Desktop/esp-idf-3/components/coap C:/Users/User/Desktop/esp-idf-3/components/console C:/Users/User/Desktop/esp-idf-3/components/cxx C:/Users/User/Desktop/esp-idf-3/components/driver C:/Users/User/Desktop/esp-idf-3/components/efuse C:/Users/User/Desktop/esp-idf-3/components/esp-tls C:/Users/User/Desktop/esp-idf-3/components/esp32 C:/Users/User/Desktop/esp-idf-3/components/esp_adc_cal C:/Users/User/Desktop/esp-idf-3/components/esp_common C:/Users/User/Desktop/esp-idf-3/components/esp_eth C:/Users/User/Desktop/esp-idf-3/components/esp_event C:/Users/User/Desktop/esp-idf-3/components/esp_gdbstub C:/Users/User/Desktop/esp-idf-3/components/esp_http_client C:/Users/User/Desktop/esp-idf-3/components/esp_http_server C:/Users/User/Desktop/esp-idf-3/components/esp_https_ota C:/Users/User/Desktop/esp-idf-3/components/esp_https_server C:/Users/User/Desktop/esp-idf-3/components/esp_local_ctrl C:/Users/User/Desktop/esp-idf-3/components/esp_ringbuf C:/Users/User/Desktop/esp-idf-3/components/esp_rom C:/Users/User/Desktop/esp-idf-3/components/esp_websocket_client C:/Users/User/Desktop/esp-idf-3/components/esp_wifi C:/Users/User/Desktop/esp-idf-3/components/espcoredump C:/Users/User/Desktop/esp-idf-3/components/esptool_py C:/Users/User/Desktop/esp-idf-3/components/expat C:/Users/User/Desktop/esp-idf-3/components/fatfs C:/Users/User/Desktop/esp-idf-3/components/freemodbus C:/Users/User/Desktop/esp-idf-3/components/freertos C:/Users/User/Desktop/esp-idf-3/components/heap C:/Users/User/Desktop/esp-idf-3/components/idf_test C:/Users/User/Desktop/esp-idf-3/components/jsmn C:/Users/User/Desktop/esp-idf-3/components/json C:/Users/User/Desktop/esp-idf-3/components/libsodium C:/Users/User/Desktop/esp-idf-3/components/log C:/Users/User/Desktop/esp-idf-3/components/lwip C:/Users/User/Desktop/esp-idf-3/components/mbedtls C:/Users/User/Desktop/esp-idf-3/components/mdns C:/Users/User/Desktop/esp-idf-3/components/mqtt C:/Users/User/Desktop/esp-idf-3/components/newlib C:/Users/User/Desktop/esp-idf-3/components/nghttp C:/Users/User/Desktop/esp-idf-3/components/nvs_flash C:/Users/User/Desktop/esp-idf-3/components/openssl C:/Users/User/Desktop/esp-idf-3/components/partition_table C:/Users/User/Desktop/esp-idf-3/components/protobuf-c C:/Users/User/Desktop/esp-idf-3/components/protocomm C:/Users/User/Desktop/esp-idf-3/components/pthread C:/Users/User/Desktop/esp-idf-3/components/sdmmc C:/Users/User/Desktop/esp-idf-3/components/soc C:/Users/User/Desktop/esp-idf-3/components/spi_flash C:/Users/User/Desktop/esp-idf-3/components/spiffs C:/Users/User/Desktop/esp-idf-3/components/tcp_transport C:/Users/User/Desktop/esp-idf-3/components/tcpip_adapter C:/Users/User/Desktop/esp-idf-3/components/ulp C:/Users/User/Desktop/esp-idf-3/components/unity C:/Users/User/Desktop/esp-idf-3/components/vfs C:/Users/User/Desktop/esp-idf-3/components/wear_levelling C:/Users/User/Desktop/esp-idf-3/components/wifi_provisioning C:/Users/User/Desktop/esp-idf-3/components/wpa_supplicant C:/Users/User/Desktop/esp-idf-3/components/xtensa
    CMake Error at CMakeLists.txt:241 (message):
    One (or more) OPS H-Bridge required parameters is not defined.


    -- Configuring incomplete, errors occurred!
    See also "C:/DCC++/ESP32CS Mast/build/CMakeFiles/CMakeOutput.log".
    cmake failed with exit code 1
     
  11. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    Run: idf.py menuconfig didn't do anything. (Using a Windows 10 PC, and cmd in it).

    idf.py menuconfig showed the above script.
     
  12. Atani

    Atani TrainBoard Member

    1,331
    1,028
    27
    It looks like there may be a bug in idf.py where it is not running correctly due to spaces in the path (likely not the only one!). I'd suggest move the code to C:\ESP32CS. I'd also suggest upgrade from ESP-IDF v4.0 to ESP-IDF v4.2 which is the latest stable release (build guide needs an update for this).
     
    AndyH likes this.
  13. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    Thanks, I'll try that. Is it the "release/v4.2" version?
     
  14. Atani

    Atani TrainBoard Member

    1,331
    1,028
    27
    Yes, that would be the v4.2 release branch and they will merge bug fixes to it periodically.
     
  15. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    SUCCESS!! Thanks Atani. I've configured the build.

    Now what?
     
  16. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    I'm running idf.py build, and then will be running idf.py -p COM7 flash, and see how that goes.
     
  17. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    And it was all going so well:


    What did I fail to configure? Text cut to match character size. I can put the {stuff} back in if it will help.
     
  18. Atani

    Atani TrainBoard Member

    1,331
    1,028
    27
    Edit components/StatusDisplay/StatusDisplay.cpp after this line add:
    Code:
    #ifndef CONFIG_DISPLAY_OLED_RESET_PIN
    #define CONFIG_DISPLAY_OLED_RESET_PIN -1
    #endif
    
    I've got a fix for this on the "sync" branch but it is not quite ready to merge to master yet.
     
    AndyH likes this.
  19. AndyH

    AndyH TrainBoard Member

    77
    9
    5

    Getting a few errors now having made that change.

     
  20. AndyH

    AndyH TrainBoard Member

    77
    9
    5
    Also, do I need the address for my I2C controlling the LCD (0X27)? Does that need to go anywhere? Thanks
     

Share This Page