Welcome to MattzoBricks Forums MattzoTrainController for Bluetooth (MTC4BT) Problems with Montior / MAC address

Viewing 7 reply threads
  • Author
    Posts
    • #4782
      Max T.Max T.
      Participant

      Hi guys,
      wow what a new challenge. After I never got the MTC4PU to work I thought to give the MTC4BT a try.
      VS Code is totally new to me but I believe I managed to compile and upload everything to the ESP32.
      What doesn’t work is to find out the MAC address of a PU reciever.
      When I use “Monitor” within PlatformIO i get the output below, but it never shows me any address indipendent of when I boot the PU reciever.

      Any ideas what I might have done wrong? Thanks a lot.

      > Executing task in folder MTC4BT: C:\Users\U400\.platformio\penv\Scripts\platformio.exe device monitor –environment az-delivery-devkit-v4 <

      — Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
      — More details at https://bit.ly/pio-monitor-filters
      — Miniterm on COM5 115200,8,N,1 —
      — Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H —
      ets Jun 8 2016 00:22:57

      rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
      configsip: 0, SPIWP:0xee
      clk_drv:0x00,q_dre:DIO, clock div:2
      load:0x3fff0018,len:4
      load:0x3fff001c,len:1044
      load:0x40078000,len:10124
      load:0x40080400,len:5828
      entry 0x400806a8

      [1] Setup: Starting MattzoTrainController for BLE…
      [1] Setup: Loading network configuration…
      Syslog: Server: 192.168.x.y:514
      Syslog: Hostname: mtc4bt
      Syslog: Appname: MTC4BT
      [1] Logging: Configured.
      [1] Setup: Loading controller configuration…
      [1] Config: Read controller name: YourControllerNameHere
      [1] Config: Read ESP pin configuration (2).
      [1] Config: Read function configuration (1).
      [1] Config: Read function configuration (2).
      [1] Config: Read function configuration (0).
      [1] Config: Read function configuration (0).
      [1] Config: Read loco configuration (3).
      [1] Ctrl: Found status led attached to ESP pin 23. Initializing…
      [1] Trying to retrieve an ESP pin number from a non ESP pin device.
      [1] Setup: Initializing BLE…
      Exception in thread rx:
      Traceback (most recent call last):
      File “C:\Users\U400\.platformio\python3\lib\threading.py”, line 926, in _bootstrap_inner
      self.run()
      File “C:\Users\U400\.platformio\python3\lib\threading.py”, line 870, in run
      self._target(*self._args, **self._kwargs)
      File “C:\Users\U400\.platformio\penv\lib\site-packages\serial\tools\miniterm.py”, line 499, in reader
      data = self.serial.read(self.serial.in_waiting or 1)
      File “C:\Users\U400\.platformio\penv\lib\site-packages\serial\serialwin32.py”, line 259, in in_waiting
      raise SerialException(“ClearCommError failed ({!r})”.format(ctypes.WinError()))
      serial.serialutil.SerialException: ClearCommError failed (PermissionError(13, ‘Zugriff verweigert’, None, 5))

      — exit —

      Terminal will be reused by tasks, press any key to close it.

    • #4783
      Joos BuijsJoos Buijs
      Keymaster

      Hi Max,

      Great to read that you’re willing to try out the MC4BT.

      From what I read from the logging is that you have a configuration set up which sets up LEDs connected to the esp32. The one on pin 23 seems to cause the esp32 to crash and disconnect, causing the final communication error.

      Could you remove the LED configuration from your config file all together, or at least verify that it’s correct?

      Hope this helps, please keep us updated in your progress!

      Kind regards,
      Joos

    • #4788
      Max T.Max T.
      Participant

      Thank you Joos for the quick answer. Yes this was the problem I took the example controller.json which propably has to much info in it to start with

      Now I changed the controller_config.json to only on Loco, and managed to get the max-adresse ofer a PU hub. I put this into the controller_config.json, please see below.
      But I fear the PU does not connect to the ESP32 afterwards, Monitor says:

      [0] BLE : Discovered unknown device: Smart Hub (90:84:2b:21:07:89).
      [E][WiFiUdp.cpp:170] beginPacket(): could not get host from dns: 0
      [1] BLE : Scanning for 3 hub(s) aborted.
      [E][WiFiUdp.cpp:170] beginPacket(): could not get host from dns: 0
      [1] BLE : Scanning for 3 hub(s)…
      [E][WiFiUdp.cpp:170] beginPacket(): could not get host from dns: 0
      [0] BLE : Discovered unknown device: Smart Hub (90:84:2b:21:07:89).
      [E][WiFiUdp.cpp:170] beginPacket(): could not get host from dns: 0

      controller_config.json:

      {
      “locos”: [
      {
      “address”: 1,
      “name”: “GreenRocket”,
      “speedStep”: 10,
      “brakeStep”: 20,
      “bleHubs”: [
      {
      “type”: “PU”,
      “address”: “90:84:2b:21:07:89”,
      “channels”: [
      {
      “channel”: “A”,
      “attachedDevice”: “light”
      },
      {
      “channel”: “B”,
      “attachedDevice”: “motor”
      }
      ]
      }
      ],
      “fn”: [
      {
      “name”: “f0”,
      “device”: “bleHub”,
      “address”: “90:84:2b:21:07:89”,
      “channel”: “B”
      }

      ]
      }

      ]
      }

      • This reply was modified 2 years, 3 months ago by Max T.Max T..
    • #4790
      Joos BuijsJoos Buijs
      Keymaster

      Good to see you got some steps further to a working state.
      Your log however says ‘connecting to 3 hubs’ which seems odd to me. Could you double check that you’re using the correct configuration file? There are several config files.

      I can dive deeper into your issue next week if necessary, weekend obligations 😉

    • #4793
      Max T.Max T.
      Participant

      After your hint I cleaned up the folder a little, ziped and moved away all the example files, after uploading I had for strange reasons the old problem with the “status led attached to ESP pin 23” again so I closed vs code, opened it freshly uploaded again but I’m back to this:
      [0] BLE : Discovered unknown device: Smart Hub (90:84:2b:21:07:89).
      [E][WiFiUdp.cpp:170] beginPacket(): could not get host from dns: 0
      [1] BLE : Scanning for 3 hub(s) aborted.
      [E][WiFiUdp.cpp:170] beginPacket(): could not get host from dns: 0
      [1] BLE : Scanning for 3 hub(s)…
      [E][WiFiUdp.cpp:170] beginPacket(): could not get host from dns: 0
      [0] BLE : Discovered unknown device: Smart Hub (90:84:2b:21:07:89).
      [E][WiFiUdp.cpp:170] beginPacket(): could not get host from dns: 0

      Any idea where it tells the ESP32 to look for exactly 3 hubs?
      I checked the platformio.ini, the MTC4BT-workspace.code-workspace, the network_config.json and the controller_config.json but I can’t find any declaration to look for 3.

      Just to double check is my process right:
      After every change in one of the config files I save this file make sure platformio.ini and MTC4BT-workspace.code-workspace are opend in vs code, then I click platformIO and there “Upload and Monitor”. I wait till is says connecting, press the boot botton on my esp32 and wait till its done. Is this correct?

      Of course next week is alright. Thanks for your help. Happy weekend.

    • #4819
      Raymond BrinkRay
      Keymaster

      Upload and Monitor only updates the firmware of the controller. The configuration files network_config.json and controller_config.json are in SPIFFS storage, which you upload separately from your data folder using Upload Filesystem Image. After you’ve done that the controller will reboot with the new configuration.

      Make sure you stop the monitor first or the upload will fail. After uploading the new configuration you can re-attach the monitor using the Monitor option.

      • This reply was modified 2 years, 3 months ago by Raymond BrinkRay.
    • #4822
      Max T.Max T.
      Participant

      Guys your are awesome.
      The train’s running. I’m totally excited.
      The Upload Filesytem Image was the key.
      After having the Switches alreads running and now the the first train it is time to set up all trains and then move on to get sensors working.
      Thanks for your support.

    • #4823
      Raymond BrinkRay
      Keymaster

      You’re welcome! Good to hear your train is running now 🙂

Viewing 7 reply threads
  • You must be logged in to reply to this topic.