From f4915a67c717102bb9eac932c41506dd3b712393 Mon Sep 17 00:00:00 2001 From: Neil Gershenfeld <gersh@cba.mit.edu> Date: Sat, 9 Jan 2021 17:48:26 -0500 Subject: [PATCH] 128DB32 --- GPIO/128DB32/ring.128DB32.c | 27 +++++++++++++++++++++++++++ GPIO/128DB32/ring.128DB32.make | 21 +++++++++++++++++++++ index.html | 7 +++++++ 3 files changed, 55 insertions(+) create mode 100644 GPIO/128DB32/ring.128DB32.c create mode 100644 GPIO/128DB32/ring.128DB32.make diff --git a/GPIO/128DB32/ring.128DB32.c b/GPIO/128DB32/ring.128DB32.c new file mode 100644 index 0000000..1799a2a --- /dev/null +++ b/GPIO/128DB32/ring.128DB32.c @@ -0,0 +1,27 @@ +// +// ring.128DB32.c +// +// 128DB32 ring oscillator test +// +// Neil Gershenfeld 1/9/21 +// +// This work may be reproduced, modified, distributed, +// performed, and displayed for any purpose, but must +// acknowledge this project. Copyright is retained and +// must be preserved. The work is provided as is; no +// warranty is provided, and users accept all liability. +// + +#include <avr/io.h> + +int main(void) { + CPU_CCP = CCP_IOREG_gc; // unprotect clock + CLKCTRL.OSCHFCTRLA = 9 << 2; // select 24 MHz clock + PORTD.DIRSET = PIN5_bm; + while (1) { + if (VPORTD.IN & PIN6_bm) + VPORTD.OUT &= ~PIN5_bm; + else + VPORTD.OUT |= PIN5_bm; + } + } diff --git a/GPIO/128DB32/ring.128DB32.make b/GPIO/128DB32/ring.128DB32.make new file mode 100644 index 0000000..0163323 --- /dev/null +++ b/GPIO/128DB32/ring.128DB32.make @@ -0,0 +1,21 @@ +PROJECT=ring.128DB32 +SOURCES=$(PROJECT).c +DEVICE = avr128db32 +MMCU=$(DEVICE) +F_CPU = 24000000 +PACK = path to AVR-Dx_DFP atpack goes here +PORT = /dev/ttyUSB1 +BAUD = 9600 + +CFLAGS=-mmcu=$(MMCU) -Wall -Os -DF_CPU=$(F_CPU) + +$(PROJECT).hex: $(PROJECT).out + avr-objcopy -O ihex $(PROJECT).out $(PROJECT).hex;\ + avr-size --mcu=$(MMCU) --format=avr $(PROJECT).out + +$(PROJECT).out: $(SOURCES) + avr-gcc $(CFLAGS) -I./ -I$(PACK)/include -B$(PACK)/gcc/dev/$(MMCU) -o $(PROJECT).out $(SOURCES) + +pyupdi: $(PROJECT).hex + pyupdi -d $(DEVICE) -c $(PORT) -b $(BAUD) -v -f $(PROJECT).hex + diff --git a/index.html b/index.html index efe7006..5eb804b 100644 --- a/index.html +++ b/index.html @@ -88,6 +88,13 @@ The GPIO test measures how quickly pins can communicate with a processor core; t <td>November, 2020</td> </tr> +<tr> +<td>2.172</td> +<td>AVR128DB32</td> +<td><a href=GPIO/128DB32/ring.128DB32.c>VPORT</a> (<a href=GPIO/128DB32/ring.128DB32.make>Makefile</a>)</td> +<td>December, 2021</td> +</tr> + <tr> <td>1.818</td> <td>ATtiny412</td> -- GitLab