ESP32 Command Station

Atani Dec 10, 2017

  1. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    Double click on the radio buttons and it will prompt for an address

    Sent from my ONEPLUS A5010 using Tapatalk
     
  2. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    The speed is certainly not right at 9600, set it to 115200 and it should work fine

    Sent from my ONEPLUS A5010 using Tapatalk
     
  3. JoshMurrah

    JoshMurrah TrainBoard Member

    54
    20
    4
    Ahh! OK so I got the loco entry figured out... and setting upload/monitor speed in the .ini works and I got good serial.

    Bad news is that I still get the core 1 panics/reboots unfortunately.
     
    Atani likes this.
  4. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    Well, closer at least if you have the stack dumps, what is the first line of it? I have seen a few ranging from uncached access to fetch instruction failure and even illegal access. All pointing to different causes.

    Sent from my ONEPLUS A5010 using Tapatalk
     
  5. JoshMurrah

    JoshMurrah TrainBoard Member

    54
    20
    4
    I'm back onto the mega haha. The serial settings let me do a good upload from platformio. It's up! Well mostly. I still can't make a loco move for some reason, but the sound functions are working. I'm only pushing 12v so it may be a decoder issue, if the sound works, I don't see why motor wouldn't.

    The circuit protection... is it tripping and resetting that fast?? whichever track I short just kinda dims on the motor indicator lights... looks like it's staying below the 2A level on my amperage monitor. If that's the case I'm liking what I see, there needs to be some sort of visual or audio indicator added, but that's basically what I was looking for.
     
  6. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    If sound works that usually means the decoder has been addressed at least once by the base station so it should be usable. When you go to the web interface make sure that it is selected in the radio buttons, the first time you click one it may not select it (part of why it needs a rework still)

    It likely isn't tripping fully. When it does get shutdown it should turn the lights off entirely. On the ESP32 when you have an OLED or LCD connected it will visually indicate that track power is off.
     
  7. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    ok, I think I have development branch working now. It is no longer crashing on a regular basis for me at least. seems that in
    DCCPPProtocolConsumer::update() the call to _stream.available() was causing a number of problems so I have removed that method in favor of implementing the necessary logic in a couple places to call feed instead. This seems to have fixed it for me so JMRI connections will no longer cause the esp32 to crash and restart repeatedly.
     
  8. JoshMurrah

    JoshMurrah TrainBoard Member

    54
    20
    4
    OK I'll try it out tonight!
     
  9. JoshMurrah

    JoshMurrah TrainBoard Member

    54
    20
    4
    Do you have a recommended OLED/LCD, I do want that on the unit at some point.
     
  10. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    virtually any I2C connected OLED or LCD should work fine. I have tested with a number of the inexpensive OLED screens (roughly 1" diagonal sized) and those are ok but a bit small. For the LCD I would highly recommend a 20x4 sized as the ESP32 code has been customized to display more data on that sized LCD than the more typical 16x2 LCDs that are out there (that size is also supported but less data will be displayed at one time).

    The key thing to keep in mind for OLED/LCD is I2C connectivity. This is critical on the ESP32 as there are only so many pins available for use and I2C pins are not used for anything else (yet!).
     
  11. JoshMurrah

    JoshMurrah TrainBoard Member

    54
    20
    4
    OK yeah I see there's some 2004 with the I2C stuck onto the back, I'll get one of those.

    So I know that I'll need three motors (two districts and a prog)... since I'm using a Uno format dev board with the shield, would it make sense to just buy another shield, and trim the main's enable and sense pins from the bottom of it, rejumper those two pins elsewhere via the header, and stick it on?
     
  12. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    You could do that, you would also need to cut the PROG pins and jumper those as well. That will give you four districts (PROG + 3 OPS). You can define the additional districts in DCCppESP32.cpp in setup() where the other calls to MotorBoardManager::registerBoard() can be found.
     
  13. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    when you get one, make sure you use one of the I2C Scanners to get its address as not all of them default to 0x27. I have seen this also on the OLED screens. I had a batch of them that all had the same default address and then one oddball that came up as 0x3C or something like that.
     
  14. JoshMurrah

    JoshMurrah TrainBoard Member

    54
    20
    4
    Most excellent info thanks. I'm putting the display and extra shield on order, and I'll try out the ESP32 dev code tonight.

    Oh and yeah, the one I looked at on amazon, said its' address could be either 0x27 or 0x3F like you said.
     
  15. JoshMurrah

    JoshMurrah TrainBoard Member

    54
    20
    4
    Well I got different results... it came up and I was able to use JMRI with it to cycle power on and off. I couldn't talk to the locomotive. All this seemed to be OK without a cpu panic.

    I closed out JMRI and tried out the web interface, and the power toggle didn't operate correctly, and as soon as I started fiddling with that and trying to select a loco, I got the cpu panics again... here's a shot...

    [SignalGenerator.cpp:246] startSignal(): [PROG] Adding idle packet to packet queue
    [SignalGenerator.cpp:249] startSignal(): [PROG] Configuring Timer(2) for generating DCC Signal (Full Wave)
    [SignalGenerator.cpp:251] startSignal(): [PROG] Attaching interrupt handler to Timer(2)
    Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
    Core 1 register dump:
    PC : 0x400e4bc7 PS : 0x00060031 A0 : 0x800d7b22 A1 : 0x3ffc0bb0
    A2 : 0x00000000 A3 : 0x8e15f1be A4 : 0x0000003a A5 : 0x00000000
    A6 : 0x00000000 A7 : 0x3ffd314c A8 : 0x00000080 A9 : 0x3ffd2958
    A10 : 0x00000001 A11 : 0x3ffb2034 A12 : 0x00000001 A13 : 0x00000001
    A14 : 0x00060021 A15 : 0x00000000 SAR : 0x00000013 EXCCAUSE: 0x0000001c
    EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
    Core 1 was running in ISR context:
    EPC1 : 0x400e4bc7 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x4000921a

    Backtrace: 0x400e4bc7:0x3ffc0bb0 0x400d7b1f:0x3ffc0bd0 0x40081385:0x3ffc0bf0 0x4008187d:0x3ffc0c10 0x4000bfed:0x00000000

    Rebooting...
     
  16. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    I've seen this sort of case lately, it seems that when the ESP32 crashes/reboots it doesn't clear interrupt handlers and when setting up the new interrupts on the timers it seems to cause undesirable behavior. I'll need a bit more of the console to see what happened when you disconnected JMRI there is likely some sort of crash ahead of this one that will need to be resolved.

    I'll also try a few options to avoid this crash/reboot cycle as it seems to be stuck in an endless loop once the above sort of crash happens. The only solution I found was power down the ESP32 for a minute or two and then power it back up.
     
  17. JoshMurrah

    JoshMurrah TrainBoard Member

    54
    20
    4
    OK yeah interesting... I left JMRI off and got a dump with just the html interface while trying to acquire the logomotive... different dump than the prohibited load panic we've been seeing.


    CORRUPT HEAP: Bad head at 0x3ffd3d54. Expected 0xabba1234 got 0x3ffd3e50
    E (101387) boot: Assert failed in multi_heap_free, /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/heap/multi_heap_poisoning.c:205 (head != NULL)
    Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
    Core 1 register dump:
    PC : 0x400e8c71 PS : 0x00060d34 A0 : 0x8008f53c A1 : 0x3ffb6740
    A2 : 0x3ffc3bf4 A3 : 0x000000cd A4 : 0x3ffc3cb8 A5 : 0x3ffc3be4
    A6 : 0x00000000 A7 : 0x00000000 A8 : 0x800e8c71 A9 : 0x3ffb66f0
    A10 : 0x40106438 A11 : 0x3ffc5adc A12 : 0x3f4089a4 A13 : 0x00000008
    A14 : 0x00000002 A15 : 0x00000001 SAR : 0x00000004 EXCCAUSE: 0x00000006
    EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffc

    Backtrace: 0x400e8c71:0x3ffb6740 0x4008f539:0x3ffb6770 0x400848fa:0x3ffb6790 0x40086ac1:0x3ffb67b0 0x4000bec7:0x3ffb67d0 0x401152be:0x3ffb67f0 0x40115386:0x3ffb6810 0x4014186d:0x3ffb6830 0x401113c5:0x3ffb6850

    Core 0 register dump:
    PC : 0x4008d0ee PS : 0x00060334 A0 : 0x8008ee76 A1 : 0x3ffb8170
    A2 : 0x3ffaff6c A3 : 0x0000cdcd A4 : 0xb33fffff A5 : 0x00000001
    A6 : 0x00060720 A7 : 0x0000abab A8 : 0x0000abab A9 : 0x3ffb8260
    A10 : 0x00002109 A11 : 0x00000008 A12 : 0x00002109 A13 : 0x3ffd4848
    A14 : 0x000000c4 A15 : 0x3ffc1f5c SAR : 0x0000001f EXCCAUSE: 0x00000006
    EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff

    Backtrace: 0x4008d0ee:0x3ffb8170 0x4008ee73:0x3ffb81a0 0x4008f51d:0x3ffb81c0 0x400848fa:0x3ffb81e0 0x40086ac1:0x3ffb8200 0x4000bec7:0x3ffb8220 0x4014402e:0x3ffb8240 0x40149163:0x3ffb8260 0x40088be1:0x3ffb8290

    Rebooting...
    ets Jun 8 2016 00:22:57

    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:952
    load:0x40078000,len:6084
    load:0x40080000,len:7944
    entry 0x40080310
    [DCCppESP32.cpp:172] setup(): DCC++ ESP starting up
    Unable to initialize InfoScreen, switching to Serial
    DCC++ESP: v1.2.0
    Starting Up
    Loading Config
    Init WiFI
    IP:pending
    [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 2 - STA_START
    [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 0 - WIFI_READY
    Connecting to AP
    [WiFiInterface.cpp:120] begin(): Connecting to WiFi: MurrahSlower
    [WiFiInterface.cpp:123] begin(): Waiting for WiFi to connect
    [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 4 - STA_CONNECTED
    [D][WiFiGeneric.cpp:345] _eventCallback(): Event: 7 - STA_GOT_IP
    [D][WiFiGeneric.cpp:389] _eventCallback(): STA IP: 10.0.0.4, MASK: 255.255.255.0, GW: 10.0.0.1
    10.0.0.4
    MAIN Init
    [MotorBoard.cpp:41] GenericMotorBoard(): [MAIN] Configuring motor board [ADC1 Channel: 0, currentLimit: 2007, enablePin: 25]
    PROG Init
    [MotorBoard.cpp:41] GenericMotorBoard(): [PROG] Configuring motor board [ADC1 Channel: 3, currentLimit: 2007, enablePin: 23]
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command t
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command f
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command C
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command a
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command 1
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command 0
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command c
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command s
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command R
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command W
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command B
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command w
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command b
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command e
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command E
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command Z
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command T
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command S
    [V][DCCppProtocol.cpp:263] registerCommand(): Registering interface command RS
    [Outputs.cpp:99] init(): Initializing outputs
    [Outputs.cpp:104] init(): Found 0 outputs
    Found 00 Outputs
    [Turnouts.cpp:78] init(): Initializing turnout list
    [Turnouts.cpp:83] init(): Found 0 turnouts
    Found 00 Turnouts
    [Sensors.cpp:80] init(): Initializing sensors list
    [Sensors.cpp:85] init(): Found 0 sensors
    Found 0 Sensors
    [RemoteSensors.cpp:95] init(): Scanning for RemoteSensors DISABLED, remote sensors will only be created after reporting state
    [SignalGenerator.cpp:244] startSignal(): [OPS] Adding reset packet to packet queue
    [SignalGenerator.cpp:246] startSignal(): [OPS] Adding idle packet to packet queue
    [SignalGenerator.cpp:249] startSignal(): [OPS] Configuring Timer(0) for generating DCC Signal (Full Wave)
    [SignalGenerator.cpp:251] startSignal(): [OPS] Attaching interrupt handler to Timer(0)
    [SignalGenerator.cpp:253] startSignal(): [OPS] Configuring alarm on Timer(0) to 116us
    [SignalGenerator.cpp:255] startSignal(): [OPS] Setting load on Timer(0) to zero
    [SignalGenerator.cpp:258] startSignal(): [OPS] Configuring Timer(1) for generating DCC Signal (Half Wave)
    [SignalGenerator.cpp:260] startSignal(): [OPS] Attaching interrupt handler to Timer(1)
    [I][SignalGenerator.cpp:262] startSignal(): [OPS] Configuring alarm on Timer(1) to 58us
    [I][SignalGenerator.cpp:264] startSignal(): [OPS] Setting load on Timer(1) to zero
    [I][SignalGenerator.cpp:267] startSignal(): [OPS] Enabling alarm on Timer(0)
    [I][SignalGenerator.cpp:269] startSignal(): [OPS] Enabling alarm on Timer(1)
    [I][SignalGenerator.cpp:244] startSignal(): [PROG] Adding reset packet to packet queue
    [I][SignalGenerator.cpp:246] startSignal(): [PROG] Adding idle packet to packet queue
    [I][SignalGenerator.cpp:249] startSignal(): [PROG] Configuring Timer(2) for generating DCC Signal (Full Wave)
    [I][SignalGenerator.cpp:251] startSignal(): [PROG] Attaching interrupt handler to Timer(2)
    Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
    Core 1 register dump:
    PC : 0x400e4bc7 PS : 0x00060031 A0 : 0x800d7b22 A1 : 0x3ffc0bb0
    A2 : 0x00000000 A3 : 0x849bd625 A4 : 0x0000003a A5 : 0x00000000
    A6 : 0x00000000 A7 : 0xffffffff A8 : 0x00000080 A9 : 0x3ffd2b50[/I][/I][/I][/I][/I][/I][/I][/I]
     
  18. JoshMurrah

    JoshMurrah TrainBoard Member

    54
    20
    4
    I'm really disliking platformio, at least the Visual Studio plug-in form.

    Today, I can't get either an Uno or Mega build to work on your branch... the serial hangs up on both of them after a first line of display.
     
  19. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    Ok heap issue is the cause. I have seen that in the past with the web server if there are multiple parallel requests or too many requests. There was a fix recently in that area that may need to be picked up.

    I'll do some more digging as likely the memory footprint is getting pretty close to max.

    Sent from my ONEPLUS A5010 using Tapatalk
     
  20. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    I haven't touched the arduino code in a while but likely there are some issues to resolve. I'll try and take a look at it and see if I can find anything.

    Sent from my ONEPLUS A5010 using Tapatalk
     

Share This Page