Switch to Minicore & enable reset toggle on upload
This commit is contained in:
parent
c70aa53af7
commit
62371455fe
2 changed files with 79 additions and 13 deletions
6
Devices/Control/Firmware/enableReset.py
Normal file
6
Devices/Control/Firmware/enableReset.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
import serial
|
||||
import time
|
||||
ser = serial.Serial("COM5")
|
||||
ser.write(b'r')
|
||||
ser.close()
|
||||
time.sleep(1)
|
|
@ -1,16 +1,76 @@
|
|||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; 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 and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
[platformio]
|
||||
default_envs = Upload_UART ; Default build target
|
||||
|
||||
[env:control]
|
||||
|
||||
; Common settings for all environments
|
||||
[env]
|
||||
platform = atmelavr
|
||||
board = nanoatmega328
|
||||
framework = arduino
|
||||
upload_port = COM6
|
||||
monitor_port = COM6
|
||||
|
||||
; TARGET SETTINGS
|
||||
; Chip in use
|
||||
board = ATmega328P
|
||||
; Clock frequency in [Hz]
|
||||
board_build.f_cpu = 16000000L
|
||||
|
||||
; BUILD OPTIONS
|
||||
; Comment out to enable LTO (this line unflags it)
|
||||
build_unflags = -flto
|
||||
; Extra build flags
|
||||
build_flags =
|
||||
|
||||
; SERIAL MONITOR OPTIONS
|
||||
; Serial monitor port defined in the Upload_UART environment
|
||||
monitor_port = ${env:Upload_UART.upload_port}
|
||||
; Serial monitor baud rate
|
||||
monitor_speed = 9600
|
||||
|
||||
|
||||
; Run the following command to upload with this environment
|
||||
; pio run -e Upload_UART -t upload
|
||||
[env:Upload_UART]
|
||||
; Serial bootloader protocol
|
||||
upload_protocol = custom
|
||||
; Serial upload port
|
||||
upload_port = COM5
|
||||
; Get upload baud rate defined in the fuses_bootloader environment
|
||||
board_upload.speed = ${env:fuses_bootloader.board_bootloader.speed}
|
||||
upload_flags =
|
||||
-C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
|
||||
-p$BOARD_MCU
|
||||
-P${env:Upload_UART.upload_port}
|
||||
-carduino
|
||||
-v
|
||||
-V
|
||||
-D
|
||||
upload_command = python enableReset.py && avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
|
||||
|
||||
; Run the following command to upload with this environment
|
||||
; pio run -e Upload_ISP -t upload
|
||||
[env:Upload_ISP]
|
||||
; Custom upload procedure
|
||||
upload_protocol = custom
|
||||
; Avrdude upload flags
|
||||
upload_flags =
|
||||
-C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
|
||||
-p$BOARD_MCU
|
||||
-PUSB
|
||||
-cusbasp
|
||||
; Avrdude upload command
|
||||
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
|
||||
|
||||
|
||||
; 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]
|
||||
board_hardware.oscillator = external ; Oscillator type
|
||||
board_hardware.uart = uart0 ; Set UART to use for serial upload
|
||||
board_bootloader.speed = 115200 ; Set bootloader baud rate
|
||||
board_hardware.bod = 2.7v ; Set brown-out detection
|
||||
board_hardware.eesave = yes ; Preserve EEPROM when uploading using programmer
|
||||
upload_protocol = usbasp ; Use the USBasp as programmer
|
||||
upload_flags = ; Select USB as upload port and divide the SPI clock by 8
|
||||
-PUSB
|
||||
-B8
|
||||
|
|
Reference in a new issue