AfterEarthLTD / Solder-Reflow-Plate

PCB based SMD reflow plates
MIT License
1.4k stars 238 forks source link

If anyone wants to build and compile V3.0 with the ATmega4809 chip using an FT232R Breakout #57

Open gotnull opened 1 year ago

gotnull commented 1 year ago

Working with an ATmega4809

https://github.com/gotnull/Solder-Reflow-Plate/blob/main/Board%20Versions/70mm%20by%2050mm%20Ver3.0%20ATmega4809/Software/SW1.0_HW3.0_70by50mm.ino

To Prepare

  1. Include MiniCoreX in additional boards via the Arduino IDE Boards Manager: https://mcudude.github.io/MegaCoreX/package_MCUdude_MegaCoreX_index.json
  2. Install Bounce2, Adafruit_GFX and Adafruit_SSD1306 libraries (Tools->Manage Libraries)

To Program

  1. Select the following settings under (Tools)

Screenshot 2023-08-11 at 10 29 06 am

Board > MegaCoreX > ATmega4809 Clock > Internal 16MHz BOD > BOD 2.6V EEPROM > EEPROM retained Pinout > 48 pin standard Reset pin > Reset Compiler LTO > LTO Disabled Bootloader > No bootloader

Compile to ATmega4809

I followed this guide here: https://swharden.com/blog/2022-12-09-avr-programming/

Specifically this setup:

updi-ftdi-serial-programmer

unnamed (2)

Connect the programmer as shown with the RX pin directly to the UPDI pin of the microcontroller and the resistor between the RX and TX pins. IMPORTANT: The Reflow Plate must be powered externally via 12V with a minimum of 5A during this process.

I used a 10KΩ 0.5W resistor instead. This is even closer to the recommended value. 10KΩ is a common pull-up resistor value used in many electronics applications. It should work well for the UPDI interface.

Ensure a modern version of Python is installed on your system

pip install pymcuprog

Use the device manager to identify the name of the COM port representing your programmer. In my case it was /dev/tty/usb.serial-AH00XXXX on MacOS.

I then interacted with the microcontroller by running pymcuprog from a terminal. This command returns the Device ID (1E9651 for my ATmega4809) indicating the UPDI connection is working successfully.

pymcuprog ping -d atmega4809 -t uart -u /dev/tty.usbserial-AH00XXXX

Connecting to SerialUPDI Pinging device... Ping response: 1E9651 Done.

I used Arduino IDE to compile my C code and generate the hex file (turn on verbose output during compilation to know the location of your .ino.hex file). Now you can use pymcuprog to load the hex file onto the chip. It’s slower to program and inconvenient to drop to a terminal whenever you want to program the chip, but it works.

pymcuprog write -f SW1.0_HW3.0_70by50mm.ino.hex -d atmega4809 -t uart -u /dev/tty.usbserial-AH00XXXX --erase

Connecting to SerialUPDI Pinging device... Ping response: 1E9651 Erasing device before writing from hex file... Writing from hex file... Writing flash... Done.

RapierXbox commented 11 months ago

Is the script the same?