From 2a5f2ba91735ec5300b65ee7260f8a86713348a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Buben=C3=ADk?= Date: Mon, 12 Aug 2024 22:49:28 +0200 Subject: [PATCH] Added support for ATmega328PB --- README.md | 5 +++++ platformio.ini | 9 +++++++++ src/controllers.h | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6f27f25..31978b6 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ For controlling the MCP2515 a modified version of the [Arduino MCP2515 CAN inter * [ATmega32](http://ww1.microchip.com/downloads/en/devicedoc/doc2503.pdf) * [ATmega328P](http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf) +* [ATmega328PB](https://ww1.microchip.com/downloads/en/DeviceDoc/40001906A.pdf) * [ATmega32U4](https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf) * [ATmega64](http://ww1.microchip.com/downloads/en/DeviceDoc/atmel-2490-8-bit-avr-microcontroller-atmega64-l_datasheet.pdf) * [ATmega644P](https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42744-ATmega644P_Datasheet.pdf) @@ -361,6 +362,10 @@ Additionally a *start app* command may be send at any time by the flash applicat ## Changelog +## 1.4.1 (2024-08-12) + +* Added support for _ATmega328PB_ + ## 1.4.0 (2023-06-12) * Added support for _ATmega32U4_ diff --git a/platformio.ini b/platformio.ini index 039e060..5d03cde 100644 --- a/platformio.ini +++ b/platformio.ini @@ -69,6 +69,15 @@ build_flags = ;board_fuses.hfuse = 0xD8 ;board_fuses.efuse = 0xFC +[env:ATmega328PB] +board = ATmega328PB +build_flags = + ${env.build_flags} + -Wl,--section-start=.text=0x7000 ; 2048 words bootloader, 0x3800 * 2 + +;board_fuses.lfuse = 0xFF +;board_fuses.hfuse = 0xD8 +;board_fuses.efuse = 0xFC [env:ATmega64] board = ATmega64 diff --git a/src/controllers.h b/src/controllers.h index 583a601..f9a2ccd 100644 --- a/src/controllers.h +++ b/src/controllers.h @@ -48,7 +48,7 @@ #define SPI_MISO 3 #define SPI_SCK 1 -#elif defined(__AVR_ATmega328P__) +#elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328PB__) #define IV_REG MCUCR #define SPI_DDR DDRB