h2_leaksensor_code/platformio.ini
2026-07-24 16:39:26 +02:00

97 lines
3.3 KiB
INI

; =====================================================
; PlatformIO configuration — H2 Leak Sensor Controller
; MCU : ATtiny3226 (tinyAVR 2-series)
; Programmer: jtag2updi
; =====================================================
; The "atmelmegaavr" platform already bundles megaTinyCore
; under the hood for ATtiny3226 — do NOT add board_build.core
; or platform_packages overrides; doing so breaks the package
; resolver (KeyError: framework-arduino-megaavr-megtinycore).
;
; If USART2 (or any 2-series-only peripheral) is reported as
; "not declared", update the platform package instead:
; pio pkg update
; pio platform update atmelmegaavr
; This refreshes the underlying board manifests/io headers.
;
; Update upload_port / monitor_port below to match your system:
; Windows : COM3, COM4, ...
; Linux : /dev/ttyUSB0, /dev/ttyACM0
; macOS : /dev/cu.usbserial-*, /dev/cu.usbmodem*
; =====================================================
[platformio]
default_envs = attiny3226_jtag2updi
; -------------------------------------------------------
; Main build + upload environment — jtag2updi programmer
; (Arduino board running the jtag2updi sketch, acting as
; a UPDI programmer connected to PA0 on the target.)
; -------------------------------------------------------
[env:attiny3226_jtag2updi]
platform = atmelmegaavr
framework = arduino
board = ATtiny3226
; 20 MHz internal oscillator
board_build.f_cpu = 20000000L
board_hardware.oscillator = internal
; BOD disabled, EEPROM retained on chip erase
board_hardware.bod = disabled
board_hardware.eesave = yes
; jtag2updi upload
upload_protocol = jtag2updi
upload_port = COM3 ; <-- UPDATE to the jtag2updi adapter's port
upload_speed = 19200 ; jtag2updi default — do not change unless
; you rebuilt the jtag2updi sketch otherwise
; Debug serial monitor (USART2 on PC1/PC2) — separate USB-UART adapter
monitor_port = COM4 ; <-- UPDATE to your debug UART adapter
monitor_speed = 115200
build_flags =
-DDEBUG_UART ; Comment out to disable USART2 debug output
; -------------------------------------------------------
; Alternative environment — SerialUPDI (cheap USB-UART + resistor)
; Switch default_envs above to use this instead.
; -------------------------------------------------------
[env:attiny3226_serialupdi]
platform = atmelmegaavr
framework = arduino
board = ATtiny3226
board_build.f_cpu = 20000000L
board_hardware.oscillator = internal
board_hardware.bod = disabled
board_hardware.eesave = yes
upload_protocol = serialupdi
upload_port = COM3 ; <-- UPDATE
upload_speed = 460800
monitor_port = COM3
monitor_speed = 115200
build_flags =
-DDEBUG_UART
; -------------------------------------------------------
; Fuse-only environment
; Run with: pio run -e set_fuses -t fuses
; -------------------------------------------------------
[env:set_fuses]
platform = atmelmegaavr
framework = arduino
board = ATtiny3226
board_build.f_cpu = 20000000L
board_hardware.oscillator = internal
board_hardware.bod = disabled
board_hardware.eesave = yes
upload_protocol = jtag2updi
upload_port = COM4 ; <-- UPDATE