I have some 40 pin dip atmega 4809 chips which I am looking to turn into a few projects.
I have setup my pio.ini (see below) based on the megacorex template found here:
“MegaCoreX/PlatformIO.md at master · MCUdude/MegaCoreX · GitHub”
And I’ll use the pyupdi programming software and hardware circuit described here to program the chips:
"GitHub - mraardvark/pyupdi: Python UPDI driver for programming "new" tinyAVR and megaAVR devices "
I have 2 questions below, thanks very much for help.
Paul
Question 1
In the pio.ini file there is no mention of MegaCoreX. I have downloaded the megacorex files, do I need to point PIO at them in some way?
Question 2
If I set up a serial port using an FTDI board connected to a 4809 serial hardware port, can I use PIOs debug features via that port? If so, will the following PIO.ini excerpt (from a PIO.ini for an avr328P) work or will I need something different:
debug_tool = avr-stub
debug_port = COM8
lib_deps = jdolinay/avr-debugger@^1.1
My PIO.ini for use with the 4809 below: (based on PIO template)
; PlatformIO template configuration file for MegaCoreX
; https://github.com/MCUdude/MegaCoreX/
;
; Build options: build flags, source filter
; Hardware options: oscillator type, BOD, UART number, EEPROM retain
; Upload options: custom upload port, speed, and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options
; https://github.com/MCUdude/MegaCoreX/blob/master/PlatformIO.md
; https://docs.platformio.org/page/projectconf.html
; https://docs.platformio.org/en/latest/platforms/atmelmegaavr.html
[platformio]
; Default build target
default_envs = ATmega4809_pyupdi_upload
; Parameters used for all environments
[env]
platform = atmelmegaavr
;framework = arduino
; pk included the line below
; Chip in use
board = ATmega4809
; Clock frequency in [Hz]
board_build.f_cpu = 16000000L
; Oscillator type (internal or external)
board_hardware.oscillator = internal
; Arduino pinout variant
board_build.variant = 40pin-default
; Unflag build flags
;build_unflags =
; Extra build flags PK - see https://github.com/MCUdude/MegaCoreX/blob/master/PlatformIO.md for options
;build_flags =
; Monitor port is auto detected. Override here
;monitor_port =
; Serial monitor baud rate
monitor_speed = 9600
[env:ATmega4809_pyupdi_upload]
; Upload protocol for UPDI upload - from PIO help pages ; see bottom of this page https://github.com/MCUdude/MegaCoreX/blob/master/PlatformIO.md for install
upload_speed = 115200
upload_flags =
-d
mega4809
-c
$UPLOAD_PORT
-b
$upload_speed
upload_command = pyupdi $UPLOAD_FLAGS -f $source
; Run the following command to upload with this environment
; pio run -e Upload_UART -t upload
;[env:Upload_UART]
; Upload protocol for serial uploads (using Optiboot)
;upload_protocol = arduino
;upload_flags =
;upload_port = /dev/cu.usbserial*
; run the following command to set fuses
; pio run -e fuses_bootloader -t fuses
; run the following command to set fuses + burn bootloader
; pio run -e fuses_bootloader -t bootloader
;[env:fuses_bootloader]
; Upload protocol for used to set fuses/bootloader
;upload_protocol = ${env:Upload_UPDI.upload_protocol}
;upload_flags =
; Hardware settings
board_hardware.bod = 2.7v
board_hardware.eesave = yes
board_hardware.uart = no_bootloader
board_hardware.rstpin = reset