1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #14037 from maribu/atmega1284p

boards/atmegaxxxp: Bugfixes
This commit is contained in:
benpicco 2020-05-07 16:37:28 +02:00 committed by GitHub
commit d12de79355
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 20 deletions

View File

@ -2,11 +2,10 @@
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
BAUD ?= 9600
ATMEGA328P_CLOCK ?=
include $(RIOTMAKE)/tools/serial.inc.mk
ATMEGA1284P_CLOCK ?=
# Allow overwriting programmer via env variables without affecting other boards
PROGRAMMER_BOARD_ATMEGA1284P ?= dragon_isp
PROGRAMMER_BOARD_ATMEGA1284P ?= atmelice
# ICSP programmer to use for avrdude
PROGRAMMER ?= $(PROGRAMMER_BOARD_ATMEGA1284P)
@ -14,5 +13,4 @@ ifneq (,$(ATMEGA1284P_CLOCK))
CFLAGS += -DCLOCK_CORECLOCK=$(ATMEGA1284P_CLOCK)
endif
include $(RIOTMAKE)/tools/avrdude.inc.mk
include $(RIOTBOARD)/common/atmega/Makefile.include

View File

@ -11,7 +11,7 @@ it. (An ISP programmer will be needed to program it; or to program a bootloader
to subsequently allow programming via UART.)
### MCU
| MCU | ATmega328p |
| MCU | ATmega1284p |
|:------------- |:-------------------------------------- |
| Family | AVR/ATmega |
| Vendor | Microchip (previously Atmel) |
@ -46,10 +46,10 @@ fuse is set, so that the clock is divided down to 1MHz. By disabling the
can be done with:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
avrdude -c dragon_isp -p m1284p -B 32 -U lfuse:w:0xc2:m
avrdude -c atmelice -p m1284p -B 32 -U lfuse:w:0xc2:m
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(Replace `dragon_isp` with the programmer you are using. The -B 32 might be
(Replace `atmelice` with the programmer you are using. The -B 32 might be
needed for some programmers to successfully communicate with ATmegas clocked at
less than 2MHz. It will no longer be needed after disabling `CKDIV8`.)
@ -80,8 +80,8 @@ needed. Connect the programmer as follows:
| RESET | 9/RESET |
| Ground | 11/GND |
The tool `avrdude` needs to be installed. When using the AVR Dragon for
programming, running
The tool `avrdude` needs to be installed. When using the Atmel ICE for
connected via JTAG for programming, running
make BOARD=atmega1284p flash
@ -100,21 +100,20 @@ the TTL adapter. Usually everything between 3.3 V and 5 V should work.
## On-Chip Debugging
In order to debug the ATmega1284P, an compatible debugger is needed. The AVR
Dragon is the ~~cheapest~~ least expensive option currently available. (But at
least it can program and debug pretty much all AVRs and can even be used to
de-brick ATmega MCUs using high voltage programming.)
In order to debug the ATmega1284P, an compatible debugger is needed. The Atmel
ICE is the ~~cheapest~~ least expensive option currently available. (But at
least it can program and debug pretty much all Atmel AVR and ARM chips.)
Once the AVR Dragon is correctly connected, the ATmega1284P has the JTAG
Once the Atmel ICE is correctly connected, the ATmega1284P has the JTAG
interface enabled, and the required software is installed, debugging can be
started using
make debug
@note If you are using a different debugger than the AVR Dragon, you have
@note If you are using a different debugger than the Atmel ICE, you have
to export the `AVR_DEBUGDEVICE` environment variable to the required
flag to pass to AVaRICE, e.g. when using the Atmel-ICE you have to
export `AVR_DEBUGDEVICE=--edbg`. If the debug device is not
flag to pass to AVaRICE, e.g. when using the AVR Dragon you have to
export `AVR_DEBUGDEVICE=--dragon`. If the debug device is not
connected via USB, you also need to export `AVR_DEBUGINTERFACE` to
the correct value.
@ -128,7 +127,7 @@ version of AVaRICE, you'll have to build the tool from source.
### JTAG Pin Mapping
| Pin Name | Pin | Signal | AVR Dragon Pin |
| Pin Name | Pin | Signal | Atmel ICE Pin |
|:----------|:------|:----------|:------------------|
| PC5 | 27 | TDI | JTAG-9 |
| PC4 | 26 | TDO | JTAG-3 |

View File

@ -3,7 +3,6 @@ PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
BAUD ?= 9600
ATMEGA328P_CLOCK ?=
include $(RIOTMAKE)/tools/serial.inc.mk
# Allow overwriting programmer via env variables without affecting other boards
PROGRAMMER_BOARD_ATMEGA328P ?= usbtiny
@ -14,5 +13,4 @@ ifneq (,$(ATMEGA328P_CLOCK))
CFLAGS += -DCLOCK_CORECLOCK=$(ATMEGA328P_CLOCK)
endif
include $(RIOTMAKE)/tools/avrdude.inc.mk
include $(RIOTBOARD)/common/atmega/Makefile.include