How to flash Arduino through soft serial?

Posted on
  • I tried to use IR LED on ESP8266 but it didn't support 38k frequency, so I have to use Arduino to drive an IR LED. It will receive data from ESP8266 through soft serial, but for some reason, I want to transmit hex data to Arduino to flash it. Is anybody know how to do this?

    I know the AT firmware can set transmit transparency mode to do this, but I want to know how to flash it using Espruino, thank you.

  • We can help you flashing Espruino - a JavaScript driven IoT platform and related applications onto ESP-8266 and many other HW / mc boards. For Arduino you have to go some place else.

  • Sorry, you were misunderstood my meaning. I mean, based on Espruino, store hex data in flash and transmit data to Arduino to flash it.

  • @user111618, you want to use an Espruino (driven) device to

    • 1st) store hex data in its flash
    • 2nd) flash an Arduino with that hex data

    Is that what you want?

  • Yes. Cause Espruino(ESP8266) can not generate 38KHz PWM to drive an IR LED, so I have to use Arduino to do this. But for some reason I'd like to change Arduino firmware, like when I put those MCUs into a box.

  • Cause Espruino(ESP8266) can not generate 38KHz PWM

    can you please send a snippet of the code you use to come up with this finding.

  • Yes. I searched on the forum and use these codes:

    let rawCodes =[4400,4350,550,1600,600,500,550,1650,55­0,1600,550,550,550,550,550,1600,550,550,­550,550,550,1600,550,550,550,550,550,160­0,550,1600,600,500,550,1650,550,550,550,­1600,550,1600,600,1600,550,1600,550,550,­550,1600,600,1600,550,1600,600,500,550,5­50,550,550,550,500,600,1600,550,550,550,­500,600,1600,550,1600,600,1600,550,550,5­50,500,600,500,550,550,550,550,550,500,6­00,500,550,550,550,1600,600,1600,550,160­0,550,1650,550,1600,550].map(function(x)­ {return x/1000;});
    analogWrite(NodeMCU.D5, 0.9, {freq:38000});
    digitalPulse(NodeMCU.D5, 1, rawCodes);
    digitalPulse(NodeMCU.D5, 1, 0);
    

    And it will reboot itself during process.

  • And I had searched on the web, they said i2s can generate 38khz PWM signal, but I don't know how to write the code in Espruino, so if you know how to do with this, please teach me about it, thank you very much.

  • what happens if you omit the last line? digitalPulse(NodeMCU.D5, 1, 0);
    esp8266 reboots if you block for too long, the last line blocks because it waits for previous one (digitalPulse with long array) to finish.

  • digitalPuls() on ESP8266 can only handle as lowes value 1ms because it is not using the hardware timer which can handle lowest 1us.

    https://github.com/espruino/Espruino/iss­ues/1749

    You are welcome to extend it 😉.

    Edit: It is but not working as it should

  • Oh ho ho! Finally a thread on here that is really in my wheelhouse! (I joined the electronics hobby with Espruino - the ease of the live console eliminated the barriers that had kept me from the hobby previously. But then I needed the real-time processing of Arduino, and started dabbling in that, then found my niche with ATTinyCore, and have since dove headfirst into low-level AVR stuff. I love programming so close to bare metal that I can feel the silicon under my fingertips... but I just don't have sufficient mental bandwidth to handle the complexity of STM32 at that depth (besides, their datasheets, particularly the separate manual and datasheet structure, are hell to navigate compared to the AVRs.) However, I still program with Arduino IDE, not the Microchip tools (good lord, I wasted three days just trying to get their thing to read the signature of their new part, using their own programming tool, without getting anywhere, before giving up and modifying the opensource firmware of jtag2updi so I could just use AVRdude like a normal person), and I still use Espruino whenever I have to touch a modern network. The internet, with it's world of variable length strings, was just not made for the fixed length character arrays of embedded C (with 512~2k (occasionally as high as 16k) of ram, and no way to clean up ram fragmentation, dynamic allocation on classical Arduino parts should be avoided like the plague). This generally means that when I use Espruino, I usually have an ESP8266 handling the network tied to an Arduino doing the timing-critical stuff.... Which sounds like about what you're doing!

    Can you clarify what you mean by "Arduino" in this case? What hardware?

    Which Arduino board package is used to support it (github link or board manager json), if it is supported by a third party board package? Which exact Tools -> board and Tools -> bootloader (if present in that board package)

    These details matter a great deal, as the programming methods used on Arduino-supported boards differ greatly with the hardware and bootloader on the board.

    When you say "soft serial", which side do you want to be using the software serial for that upload you mentioned?

    Also, you are running Espruino on the ESP8266?

  • Depending on what is on the Arduino side, I may have some specific advice (very specific if it's an AVR - I know exactly what's needed in this case.)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

How to flash Arduino through soft serial?

Posted by Avatar for user111618 @user111618

Actions