Volodymyr, did you test the Uno R4 WiFi?
the datasheet says
When programming the UNO R4 WiFi, the RA4M1 MCU is programmed via the ESP32-S3 module by default.
which I understand as the fw in esp32 is a SWD programmer to upload to the main MCU
Volodymyr, did you test the Uno R4 WiFi?
the datasheet says
When programming the UNO R4 WiFi, the RA4M1 MCU is programmed via the ESP32-S3 module by default.
which I understand as the fw in esp32 is a SWD programmer to upload to the main MCU
Unfortunately, UNO R4 WiFi has not been tested yet. The device is on the way.
UNO R4 WiFi has both software (gpio P408) and hardware (SJ1 pads) means of connecting it directly to USB.
Also, here’s an interesting finding: GitHub - arduino/uno-r4-wifi-usb-bridge
Looks like it’s a complete DAP debugger.
A version of NCP for ESP-01, ESP-01S is now available: https://github.com/blynkkk/BlynkNcpDriver/releases/latest/
With a (non-minimal) example, I was able to go from this:
RAM: [==========] 247.1% (used 5060 bytes from 2048 bytes)
Flash: [===== ] 46.6% (used 15024 bytes from 32256 bytes)
to this:
RAM: [====== ] 59.6% (used 1220 bytes from 2048 bytes)
Flash: [==== ] 43.0% (used 13864 bytes from 32256 bytes)
And, when using the BlynkNcpDriver directly, we can strip it down to:
RAM: [=== ] 32.9% (used 674 bytes from 2048 bytes)
Flash: [== ] 22.9% (used 7394 bytes from 32256 bytes)
It can definitely be further optimized.
Volodymyr, then it is feasible to add OTA for Arduino Mega ?
This can be done. In theory, it can even be done for UNO, but OTA update for these boards is not on our roadmap.
BTW, your https://github.com/jandrassy/ArduinoOTA library is used to provide the default/reference OTA implementation for the Primary MCUs.
Is it possible to replace the serial wire by Bluetooth Classic, BLE or ESP-now on ESP32? This would create a low power IoT solution at home
you know it is my library. and it supports classic ATmega with more than 64kB flash. so the EdgentNCP sketch working for SAMD could work for the the Mega too
@Juraj yeah, I edited the post to better express this
Now, regarding Uno R4 WiFi. I was able to port the CDC Bridge and DAP functionality to Blynk.NCP. Looks working fine so far, including the debugger!
This will require a separate NCP build/variant for UNO R4 WiFi, but I’m ok with that (it was needed anyway)
We didn’t try it, but it’s a cool experiment!
For a prototype, you can connect an external Bluetooth to Serial converter module.
It required one more significant change: the initial baud rate of ESP8266 had to be lowered to 38400
.
This and all the optimizations mentioned above are now publicly available:
Woah, connecting a bare ESP01 to an ordinary Arduino is quite challenging:
Wondering why this connection type got so popular?!
I know, the ESP-01 is probably the least friendly pinout to use.
The resistors to switch between 5v and 3.3v logic level aren’t really necessary.
Pete.
@vshymanskyy I’ve been travelling for a while, but now I’m home I thought I’d give the ESP-01/Arduino Uno combo a try with Blynk.NCP.
It’s working, but the process wasn’t very intuitive and I came across a couple of issues so I thought I’d feed-back on those and share the process with anyone else who’d interested…
Software Versions used in the test
I downloaded Blynk Library 1.3.0 and used the BlynkNCPSimple.ino
that is part of that release.
I used the BlynkNCP_generic_esp8266_1M.flash.bin
from the NCP v0.6.2 release and uploaded it to my ESP-01 using nodemcu-flasher or Windows from here…
My initial attempt to upload the .bin file failed with a size mismatch error, but I fixed that by changing the Flash Size setting to 1MB, from the default of 4MB…
I used Arduino 1.8.19 for everything else.
Hardware Setup
I have a homemade proto shield that allows an ESP-01 to be hooked-up to an Uno without the need for a breadboard or any jumper wires, and this uses pins 2 and 3 on the Uno for serial communication with the ESP-01…
As the Uno only has one hardware serial port on pins 0 & 1 the SoftwareSerial is required. As the Uno struggles to emulate a serial port at speeds higher than 9600 baud some changes were needed to accommodate this.
Changes to the BlynkNCPSimple.ino sketch
I obviously had to change the SoftwareSerial pins to be used to suit my board…
// Create Serial1 for ARDUINO_AVR_UNO and similar boards
#if defined(__AVR_ATmega328P__)
#include <SoftwareSerial.h>
SoftwareSerial Serial1(2, 3); // was 10, 9
#endif
and I initially thought that I had to un-comment this line…
//#define SerialNCP Serial1
but actually I needed to add this line…
#define BLYNK_NCP_SERIAL Serial1
which looks like a naming error in your sketch?
I then had a compilation error that highlighted this line…
const long baudTarget = BLYNK_NCP_BAUD;
with the error…
NCP_Helpers.h: In function 'bool ncpSetupSerial(uint32_t)':
NCP_Helpers.h:83:27: error: 'BLYNK_NCP_BAUD' was not declared in this scope
const long baudTarget = BLYNK_NCP_BAUD;
^~~~~~~~~~~~~~
BLYNK_NCP_BAUD
isn’t defined anywhere in the sketch, so this is definitely a bug.
As I wanted the baud rate to be 9600 I added this in the #if defined(__AVR_ATmega328P__)
section…
// Create Serial1 for ARDUINO_AVR_UNO and similar boards
#if defined(__AVR_ATmega328P__)
#include <SoftwareSerial.h>
SoftwareSerial Serial1(2, 3);
#define BLYNK_NCP_BAUD 9600
#endif
I then just needed to add my BLYNK_TEMPLATE_ID
and BLYNK_TEMPLATE_NAME
to the sketch, provision the board in the app and it’s working perfectly!
Pete.
Thanks for your feedback, I’ll review our example based on it.
@PeteKnight looks like you used the low-level BlynkNcpDriver
example, but there’s a simpler example in the Blynk library: Blynk -> Blynk.Edgent -> Edgent_NCP
Please check it out
That works, by changing this…
// Redefine NCP connection port settings, if needed
//#define BLYNK_NCP_SERIAL Serial1
//#define BLYNK_NCP_BAUD 2000000
to this…
#define BLYNK_NCP_SERIAL Serial1
#include <SoftwareSerial.h>
SoftwareSerial Serial1(2, 3);
#define BLYNK_NCP_BAUD 9600
(Obviously this is using the same hardware setup as before, with the ESP-01 connected to pins 2 & 3 of the Uno)
07:53:53.488 -> [2999] Main firmware: 0.1.0
07:53:53.488 -> [3000] Build: Jul 30 2023 07:38:52
07:53:53.488 -> [3000]
07:53:53.488 -> ___ __ __
07:53:53.488 -> / _ )/ /_ _____ / /__
07:53:53.488 -> / _ / / // / _ \/ '_/
07:53:53.488 -> /____/_/\_, /_//_/_/\_\
07:53:53.488 -> /___/ v1.3.0 on Arduino Uno
07:53:53.488 ->
07:53:53.488 -> #StandWithUkraine https://bit.ly/swua
07:53:53.488 ->
07:53:53.488 ->
07:53:53.488 -> [3022] NCP responding (baud 38400, 5796 us)
07:53:53.556 -> [3067] NCP responding (baud 9600, 17944 us)
07:53:53.591 -> [3094] Blynk.NCP firmware: 0.6.2
07:53:53.792 -> [3300] State: Connecting Network
07:53:58.102 -> [7601] State: Connecting Cloud
07:54:03.875 -> [13307] State: Connected
07:54:03.875 -> [13307] Connected to Blynk 🙌
Pete.