UPDI standalone using esp32? #945
Unanswered
Turbotronics
asked this question in
Q&A
Replies: 3 comments 1 reply
-
News to me. Machine intellegence is wild. I don't belive I have instructions on importing MegaCoreX library manually? But I know there is updi code for ESP32 foating around. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi, very interesting
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Hello all, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was looking for a lib to do standalone programming (via Wifi) from an esp32 of an ATtiny418. Asked ChatGPT and it insists that this lib can do it.
It said:
If you want to program an AVR microcontroller using the UPDI protocol with an ESP32 without a PC, you can use the ESP32 as a standalone device that communicates with the microcontroller using the UPDI protocol.
Here are the steps to program an AVR microcontroller using the ESP32 as a standalone UPDI programmer:
Install the Arduino IDE and the "megaTinyCore" library for programming AVR microcontrollers. You can find the "megaTinyCore" repository on GitHub here: https://github.com/SpenceKonde/megaTinyCore
Install the "MegaCoreX" board package for the ESP32 in the Arduino IDE. You can find instructions for doing this in the "README" file of the "megaTinyCore" repository on GitHub.
Connect the UPDI pin of the AVR microcontroller to a GPIO pin on the ESP32.
The UPDI pin is different for each AVR microcontroller, so be sure to consult the datasheet for your specific microcontroller to determine which pin to use.
Upload the following code to the ESP32 using the Arduino IDE:
#include <MegaCoreX.h>
#include <megaUPDI.h>
#define UPDI_PIN 27 // Define the UPDI pin on the ESP32
#define LED_PIN 2 // Define the LED pin on the ESP32
void setup() {
pinMode(UPDI_PIN, OUTPUT); // Set the UPDI pin as an output
pinMode(LED_PIN, OUTPUT); // Set the LED pin as an output
digitalWrite(UPDI_PIN, LOW); // Set the UPDI pin low to enter programming mode
delay(10); // Wait for the AVR microcontroller to enter programming mode
}
void loop() {
digitalWrite(LED_PIN, HIGH); // Turn on the LED to indicate programming mode
delay(1000); // Wait for 1 second
// Initialize the megaUPDI library to communicate with the AVR microcontroller
megaUPDI updi(UPDI_PIN);
// Enter programming mode and erase the AVR microcontroller
updi.enterProgrammingMode();
updi.chipErase();
updi.leaveProgrammingMode();
digitalWrite(LED_PIN, LOW); // Turn off the LED to indicate programming complete
delay(1000); // Wait for 1 second
}
Beta Was this translation helpful? Give feedback.
All reactions