ESP32 Command Station

Atani Dec 10, 2017

  1. Gregory Gee

    Gregory Gee TrainBoard Member

    10
    2
    5
    This problem seems common.

    Serial port COM6
    Connecting........_____....._____....._____....._____....._____....._____....._____

    A fatal error occurred: Failed to connect to Espressif device: Timed out waiting for packet header
    esptool.py failed with exit code 2

    Or I am missing a setting. BTW, my board does not have a boot button.
     
  2. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    A boot button is often not necessary now. You can force the board into download mode by shorting IO 0 to GND and pressing the reset button. On most Espduino boards it will be the last IO pin on the side with the analog inputs (close to the power jack). If you have the motor shield connected it will be the pin next to IOREF (it will likely be unlabeled)

    Is that the correct COM port? Is the USB cable you are using a quality cable?
     
  3. Gregory Gee

    Gregory Gee TrainBoard Member

    10
    2
    5
    Yep, thanks. Grounding the last pin beside the barrel plug worked. It was able to connect to my AP and start a softAP.

    Now for the user guide. Do you have some outline?
    Is the web throttle the only way to access it?

    For a little while, the esp was showing up in JMRI as an LCC node which is cool. All the config settings are there.

    Thanks,
    Greg
     
  4. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    There really isn't a user guide entirely. You can connect to the CS from jmri as either LCC or DCC++. If you use LCC it will operate the throttles as LCC throttles which should work out-of-the-box (same as the TCS UWT-100).

    There aren't many other LCC throttles unfortunately. If you start the JMRI WiThrottle server you can use mobile throttles as well, I'll be adding support for WiThrottle after v1.5.0 is released (most likely next month as I'm wrapping up testing).

    Sent from my ONEPLUS A5010 using Tapatalk
     
  5. Gregory Gee

    Gregory Gee TrainBoard Member

    10
    2
    5
    On the arduino motor shield, is only A powered? When I turn on track power, I only see the LEDs on A light up. In the web config page, I don't see a power button for the PROG which I assume is the program track?

    Do you have an issue tracking system or just post here?

    In the LCC Wifi Uplink, it won't let me turn off the 'Uplink Reconnect'. I keep seeing the serial monitor output over and over that is it trying to reconnect to my PC running JMRI.

    [Uplink] Reconnecting to 192.168.10.170:12021.
    connect: Software caused connection abort



    Is master the branch to be using?
     
  6. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    This is normal and expected.

    Correct, it will be enabled and disabled automatically by the CS when it is needed.

    If you can file them over on https://github.com/atanisoft/ESP32CommandStation/issues so they don't get lost that would be great.

    Hmm, that sounds like a bug. If you set the reconnect to OFF and click save it should update the config on the CS side.

    Yes, that should be considered stable but there may be a few bugs still. I'm progressing through testing of various parts on various hardware setups and it is taking some time. I also have a few compatibility updates for various parts that I'm testing still (IDF v4.1+ including TWAI driver rewrite which will improve overall performance)
     
  7. John Flanagan

    John Flanagan TrainBoard Member

    45
    6
    7
    I must have some freertos files out of sync. Do you have a suggestion:

    ../components/DCCSignalGenerator/RMTTrackDevice.cpp: In constructor 'esp32cs::RMTTrackDevice::RMTTrackDevice(const char*, rmt_channel_t, uint8_t, size_t, gpio_num_t, RailcomDriver*)':
    ../components/DCCSignalGenerator/RMTTrackDevice.cpp:219:5: error: 'xQueueCreateStatic' was not declared in this scope
    xQueueCreateStatic(packet_queue_len, sizeof(dcc::packet)
    ^~~~~~~~~~~~~~~~~~
    ../components/DCCSignalGenerator/RMTTrackDevice.cpp:219:5: note: suggested alternative: 'xQueueCreateSet'
    xQueueCreateStatic(packet_queue_len, sizeof(dcc::packet)
    ^~~~~~~~~~~~~~~~~~
    xQueueCreateSet
     
  8. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Sorry about that, edit your sdkconfig and enable this option:
    Code:
    CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
    
    If you have an existing sdkconfig file the build system will not overwrite it unfortunately. I'll add a check for this being enabled.
     
  9. John Flanagan

    John Flanagan TrainBoard Member

    45
    6
    7
    Looks good, thanks
     
  10. John Holdsworth

    John Holdsworth TrainBoard Member

    21
    4
    6
    Hi, first of all thanks for all your effort in producing this code..and the PCB.

    I'm wrestling with ESP-IDF extension within VSC..mainly due to a poor install which seems to consistently miss items out of the PATH..but no doubt I'll get there eventually..ESP-IDF from the command line works on some of the canned examples....but not on the code youve released. I guess this is an environment issue.

    Can I ask ..if i put the list of path inclusions thats shown when the ESP-IDF command line starts in the user path will this not screw things up further?..I know its how long is a piece of string kind of question but its desperate times for me.

    Sorry to say that maybe because of all the problems Ive been having I feeling that the project has gone what can be managed by the average model train enthusiast.

    So, can I ask for one of the populated PCBs to be put on one side for me?..of course I'll pay you for it up front....and that hopefully you'll release a binary for it?

    Regards JH and best wishes in these uncertain times
     
  11. TrainzLuvr

    TrainzLuvr TrainBoard Member

    186
    268
    12
    What kind of specific problems are you having with ESP-IDF?

    Personally, I do not compile from within VSC (VSCodium) - I only use it as a fancy code editor with intellisense. And in this case, I always open a shell and run idf.py commands from it after the ESP-IDF environment is initialized (X:\espressif\esp-idf\exports.bat).

    It makes it much easer for me because I can do: idf.py build, followed by idf.py erase_flash, idf.py -p comX flash and finally idf.py -p comX monitor all within it.
     
    Atani likes this.
  12. John Holdsworth

    John Holdsworth TrainBoard Member

    21
    4
    6
    Well..it doesnt install cmake or ninja..and doesnt create a path entry for them.
    However i think i'll follow your build chain since it this does work for the esp-idf examples..the world famous blink and hello world..theres something wrong with my windows registry i think..thanks for your advice
     
  13. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Generally yes, if you run export.bat (source export.sh on Linux) it will configure the necessary execution environment for you. I do not recommend setting this globally though.

    The plugin is great but it does have a few shortcomings for sure.

    Binaries are available today via GitHub under the Actions tab. There are two to pick from, the generic one is pre-configured for the default settings (Arduino Uno form factor esp32 with Arduino motor shield) and the "pcb" one is configured for specific pin mappings (refer to sdkconfig.defaults.pcb)

    That should be handled automatically by the plugin. I'd suggest open an issue against the plugin https://github.com/espressif/vscode-esp-idf-extension. They are working on improving the plugin and overall it has improved considerably over the first few versions.
     
  14. John Holdsworth

    John Holdsworth TrainBoard Member

    21
    4
    6
    So now I get to this point and it fails:..something to do with the bootloader,,but what? help please!

    [44/1075] Performing configure step for 'bootloader'
    FAILED: bootloader-prefix/src/bootloader-stamp/bootloader-configure
    cmd.exe /C "cd /D C:\Users\John\Desktop\ESP32CSIDF\ESP32CommandStation_master\build\bootloader && C:\Users\John\.espressif\tools\cmake\3.13.4\bin\cmake.exe -DSDKCONFIG=C:/Users/John/Desktop/ESP32CSIDF/ESP32CommandStation_master/sdkconfig -DIDF_PATH=C:/Users/John/esp/esp-idf -DIDF_TARGET=esp32 -DPYTHON_DEPS_CHECKED=1 -DPYTHON=C:\Users\John\.espressif\python_env\idf4.1_py3.7_env\Scripts\python.exe -DEXTRA_COMPONENT_DIRS=C:/Users/John/esp/esp-idf/components/bootloader -DLEGACY_INCLUDE_COMMON_HEADERS= -GNinja C:/Users/John/esp/esp-idf/components/bootloader/subproject && C:\Users\John\.espressif\tools\cmake\3.13.4\bin\cmake.exe -E touch C:/Users/John/Desktop/ESP32CSIDF/ESP32CommandStation_master/build/bootloader-prefix/src/bootloader-stamp/bootloader-configure"
    CMake Error: The source "C:/Users/John/esp/esp-idf/components/bootloader/subproject/CMakeLists.txt" does not match the source "C:/Users/John/esp/components/bootloader/subproject/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.
    [61/1075] Building C object esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedcrypto.dir/ecp.c.obj
    ninja: build stopped: subcommand failed.
    ninja failed with exit code 1


    do I Need to alter the bootloader settings accessed through IDF.py menuconfig?
     
  15. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    You shouldn't need to alter any settings in the bootloader or really anything outside of the top level entries added by the CS itself.

    The only thing I can think of is that it is not liking the long path names. Can you checkout esp-idf under C:\esp-idf and rerun install.bat / export.bat?
     
  16. John Flanagan

    John Flanagan TrainBoard Member

    45
    6
    7
    If your move anything around then the cache gets out of data. I sometimes find that deleting the entire build directory and doing a build again solves the problem. Doing an "clean" should do it, but for me it doesn't.

    Regards
     
  17. John Holdsworth

    John Holdsworth TrainBoard Member

    21
    4
    6
    Got a bit further..I loaded the command station top level file directly in C:
    now got this..some problem with wifi configuration? Can't hank you enough for your help...

    In file included from ../components/OpenMRNLite/src/openlcb/Defs.hxx:39,
    from ../components/OpenMRNLite/src/openlcb/Node.hxx:38,
    from ../components/OpenMRNLite/src/openlcb/If.hxx:41,
    from ../components/OpenMRNLite/src/openlcb/SimpleNodeInfo.hxx:38,
    from ../components/OpenMRNLite/src/openlcb/ConfigRenderer.hxx:41,
    from ../components/OpenMRNLite/src/openlcb/ConfigEntry.hxx:44,
    from ../components/OpenMRNLite/src/openlcb/ConfigRepresentation.hxx:38,
    from ../components/OpenMRNLite/src/freertos_drivers/esp32/Esp32WiFiConfiguration.hxx:38,
    from ../components/OpenMRNLite/src/freertos_drivers/esp32/Esp32WiFiManager.hxx:38,
    from ../components/Configuration/include/LCCWiFiManager.h:19,
    from ../components/Configuration/LCCWiFiManager.cpp:18:
    ../components/OpenMRNLite/src/freertos_drivers/esp32/Esp32WiFiManager.hxx:499:30: note: candidate: 'openmrn_arduino::Esp32WiFiManager::Esp32WiFiManager(const openmrn_arduino::Esp32WiFiManager&)'
    DISALLOW_COPY_AND_ASSIGN(Esp32WiFiManager);
    ^~~~~~~~~~~~~~~~
    ../components/OpenMRNLite/src/utils/macros.h:155:5: note: in definition of macro 'DISALLOW_COPY_AND_ASSIGN'
    TypeName(const TypeName &); \
    ^~~~~~~~
    ../components/OpenMRNLite/src/freertos_drivers/esp32/Esp32WiFiManager.hxx:499:30: note: candidate expects 1 argument, 9 provided
    DISALLOW_COPY_AND_ASSIGN(Esp32WiFiManager);
    ^~~~~~~~~~~~~~~~
    ../components/OpenMRNLite/src/utils/macros.h:155:5: note: in definition of macro 'DISALLOW_COPY_AND_ASSIGN'
    TypeName(const TypeName &); \
    ^~~~~~~~
    In file included from ../components/Configuration/include/LCCWiFiManager.h:19,
    from ../components/Configuration/LCCWiFiManager.cpp:18:
    ../components/OpenMRNLite/src/freertos_drivers/esp32/Esp32WiFiManager.hxx:289:5: note: candidate: 'openmrn_arduino::Esp32WiFiManager::Esp32WiFiManager()'
    Esp32WiFiManager();
    ^~~~~~~~~~~~~~~~
    ../components/OpenMRNLite/src/freertos_drivers/esp32/Esp32WiFiManager.hxx:289:5: note: candidate expects 0 arguments, 9 provided
    ../components/OpenMRNLite/src/freertos_drivers/esp32/Esp32WiFiManager.hxx:156:5: note: candidate: 'openmrn_arduino::Esp32WiFiManager::Esp32WiFiManager(const char*, const char*, openlcb::SimpleStackBase*, const openmrn_arduino::WiFiConfiguration&, const char*, wifi_mode_t, openmrn_arduino::ESP32_ADAPTER_IP_INFO_TYPE*, ip_addr_t, uint8_t, wifi_auth_mode_t, const char*, openmrn_arduino::ESP32_ADAPTER_IP_INFO_TYPE*)'
    Esp32WiFiManager(const char *ssid
    ^~~~~~~~~~~~~~~~
    ../components/OpenMRNLite/src/freertos_drivers/esp32/Esp32WiFiManager.hxx:156:5: note: no known conversion for argument 7 from 'std::unique_ptr<tcpip_adapter_ip_info_t>::pointer' {aka 'tcpip_adapter_ip_info_t*'} to 'openmrn_arduino::ESP32_ADAPTER_IP_INFO_TYPE*' {aka 'esp_netif_ip_info_t*'}
    [876/912] Building CXX object esp-idf/main/CMakeFiles/__idf_main.dir/ESP32CommandStation.cpp.obj
    ninja: build stopped: subcommand failed.
    ninja failed with exit code 1
     
  18. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Which version of ESP-IDF are you using?
     
  19. John Holdsworth

    John Holdsworth TrainBoard Member

    21
    4
    6
    yep..its esp-idf is 4.1 and the esp-idf tools 2.3
     
  20. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    I'd suggest move either to 4.0 or 4.2. There are a few issues in the current releases of 4.1.

    Sent from my ONEPLUS A5010 using Tapatalk
     

Share This Page