flashing ESP8266 (sonoff) passed thru arduino pins possible?

Discussion in 'UDOO NEO' started by derdems, May 30, 2018.

  1. derdems

    derdems New Member

    Joined:
    Nov 2, 2015
    Messages:
    8
    Likes Received:
    2
    Hi there!

    I am using my Neo as an openhab2-server which works pretty well.
    There is a sketch running that controls a 433 MHz sender to control some old fashioned Radio Sockets.
    I managed to get the Arduino programming over network to run so I can flash sketches from the Mac to the Board. Everything works fine so far!
    Now some sonoffs arrived and I want to integrate them. They are basically nice little wifi relays powered by a ESP8266 chip. The firmware can be exchanged because GND, 3.3V, TX and RX Pins are exposed on the board. It is possible to do so with the arduino IDE.
    In lack of a regular FTDI board I researched a bit and found that arduinos in general have an FTDI on Board and that it would be possible to do the following to flash an ESP8266 which is connected to an Arduino:
    - set RESET to GND on Arduino side and
    - connect arduinos' RX and TX to the corresponding pins on the ESP8266
    - now flashing to the Arduino is just passed thru to the connected 8266.

    I have tried but couldn't get it to run, so I thought maybe somebody here in the nice forum might be able to clarify?

    Can somebody confirm if UDOO Neo is as well able to do that?
    And if so, could I then flash from Mac to UDOO-Neo via Network?
    (For whatever reason I never managed to get a direct USB connection to work, hence the network connect!)
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    The arduino part of a Neo is software wise more or less compatible with a regular Arduino Uno. But hardware wise they are completely different and I suspect that this FTDI feature is not present.
    But perhaps it is present in the A9/Linux side? You mean you need a USB cable to program the devices. So what if you connect the device to the USB port of the Neo. With VNC you can take over Linux part of the Neo and program the devices with the build in Arduino iDE.
     
  3. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    I now understand what you are trying to do: connect the programming wires of the sonoff to the Arduino side and from Linux side have it shown as a USB device so you can program it. Well this is not possible with a Neo.

    But, on the A9 side it is! You can activate UART6 (/dev/ttymxc5) through the device tree editor. Then you can connect the wires directly on the Neo.
     
  4. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  5. derdems

    derdems New Member

    Joined:
    Nov 2, 2015
    Messages:
    8
    Likes Received:
    2
    Thanks for your response, waltervl!

    To be honest, I am not sure if this really is what I wanted to say…
    Sorry for my obviously confusing attempt to explain my problem.
    I lack the specific english terms for what I want to do.
    In principle, I want to do follow these instructions and exchange the given arduino with my Neo.
    Additionally I want to connect from Mac to (arduino) via network instead of USB.
    Did you understand it this way from the beginning?
    If so, could you explain wether the UART6 approach that you mentioned would be still doable with the arduino IDE?
    Or would maybe just an upload of a precompiled .bin be possible with this method?
     
  6. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    That instruction will not work.
    Instead you can activate UART6 (/dev/ttymxc5) on the linux side with the Device tree editor and use basically below shown but remove yellow Reset wire and move Green and White (TX/RX) connect them instead to UART_6_TX_DATA (Pin 31), UART_6_RX_DATA (Pin 30) on the outside header of the Neo. Reboot the Neo after activating UART6.

    Now you can remote take over the Neo Linux session with VNC (instructions) from your Mac, start a terminal session on the Neo and you can run the esptool.py (eg esptool.py --port /dev/ttymxc5 erase_flash ). You have to install the esptool first on the Neo (sudo pip install –upgrade esptool) You also will have to download the MicroPython (ESP8266 Firmware) on the Neo.

    You do not need a voltage divider as the Neo UART6 is also 3.3V.

    So it is not fully remote from only your Mac but very close.

    [​IMG]

    [​IMG]
     
    derdems likes this.
  7. derdems

    derdems New Member

    Joined:
    Nov 2, 2015
    Messages:
    8
    Likes Received:
    2
    Thanks so much! I will do this and report back here!
    So grateful for your help!
     
  8. derdems

    derdems New Member

    Joined:
    Nov 2, 2015
    Messages:
    8
    Likes Received:
    2
    Success!
    I can flash the sonoff with this method!
    Thanks again, @waltervl!
     
    waltervl likes this.
  9. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Good news, glad I could help.
     
    derdems likes this.

Share This Page