diff --git a/avr/devices/n23/.gitignore b/avr/devices/n23/.gitignore new file mode 100644 index 0000000..8e0618c --- /dev/null +++ b/avr/devices/n23/.gitignore @@ -0,0 +1,2 @@ +*.eep.hex +*.obj diff --git a/avr/devices/n23/0BUILD b/avr/devices/n23/0BUILD new file mode 100644 index 0000000..53ef8b7 --- /dev/null +++ b/avr/devices/n23/0BUILD @@ -0,0 +1,53 @@ + + + + + + + + -I $(builddir) + -I $(srcdir) + -I $(topsrcdir)/avr + -I $(topbuilddir)/avr + + + + + main.asm + + + + + + + + + + + -I $(builddir) + -I $(srcdir) + -I $(topsrcdir)/avr + -I $(topbuilddir)/avr + + + + + boot.asm + + + + + + + + + + + defs.asm + README + + + + + + diff --git a/avr/devices/n23/README b/avr/devices/n23/README new file mode 100644 index 0000000..60505df --- /dev/null +++ b/avr/devices/n23/README @@ -0,0 +1,13 @@ + +N20 +=== + +- Role: Air quality and climate sensors +- MCU: AtTiny84 +- Connection: RJ45 +- Periphery: + - PIR sensor (AMN31112) + - TWI interface + - SI7021 temperature and humidity sensor + - CCS811 air quality sensor + diff --git a/avr/devices/n23/boot.asm b/avr/devices/n23/boot.asm new file mode 100644 index 0000000..d42b2d1 --- /dev/null +++ b/avr/devices/n23/boot.asm @@ -0,0 +1,144 @@ +; *************************************************************************** +; Source file for base system node on AtTiny 84 +; +; This is for the maintenance system (i.e. the flash loader). +; +; All definitions and changes should go into this file. +; *************************************************************************** + +.equ clock=1000000 ; Define the clock frequency + +.nolist +.include "include/tn84def.inc" ; Define device ATtiny84 +.list + +.include "./defs.asm" +.include "defs_all.asm" + + + +; *************************************************************************** +; defines + +; --------------------------------------------------------------------------- +; generic + +.include "common/utils_wait.asm" +.include "modules/com2/defs.asm" +.include "modules/comproto/defs.asm" + + + +; --------------------------------------------------------------------------- +; firmware settings + +.equ FIRMWARE_VERSION_MAJOR = 0 +.equ FIRMWARE_VERSION_MINOR = 0 +.equ FIRMWARE_VERSION_PATCHLEVEL = 1 + + + +; --------------------------------------------------------------------------- +; LED + +.equ LED_DDR = DDRA +.equ LED_PORT = PORTA +.equ LED_PIN = PINA +.equ LED_PINNUM = PORTA3 + + +; *************************************************************************** +; code segment + +.cseg +.org 0x0000 + + + +; --------------------------------------------------------------------------- +; Reset and interrupt vectors +; rjmp start ; Reset vector + rjmp main ; Reset vector + reti ; EXT_INT0 + reti ; PCI0 + reti ; PCI1 + reti ; WATCHDOG + reti ; ICP1 + reti ; OC1A + reti ; OC1B + reti ; OVF1 + reti ; OC0A + reti ; OC0B + reti ; OVF0 + reti ; ACI + reti ; ADCC + reti ; ERDY + reti ; USI_STR + reti ; USI_OVF + + +devInfoBlock: ; 12 bytes +devInfoManufacturer: .db 'A', 'Q', 'U', 'A' +devInfoId: .db DEVICEINFO_ID, 0 +devInfoVersion: .db DEVICEINFO_VERSION, DEVICEINFO_REVISION ; version, revision +firmwareVersion: .db FIRMWARE_VARIANT_BOOT, FIRMWARE_VERSION_MAJOR + .db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL + +firmwareStart: rjmp main ; will be overwritten when flashing + + + +; *************************************************************************** +; main code + + +.org BOOTLOADER_ADDR + + +main: + rjmp bootLoader ; this routine is in modules/bootloader/main.asm + + + +; *************************************************************************** +; includes + +.include "modules/uart_bitbang/bytelevel.asm" +.include "modules/uart_bitbang/packetlevel.asm" +.include "modules/com2/crc.asm" +.include "common/crc8.asm" +.include "common/utils_wait_fixed.asm" +.include "common/utils_copy_from_flash.asm" +.include "common/utils_copy_sdram.asm" + +.include "modules/flash/defs.asm" +.include "modules/flash/eeprom.asm" +.include "modules/flash/io.asm" +.include "modules/flash/io_attn.asm" +.include "modules/flash/io_bitbang.asm" +.include "modules/flash/flash1p.asm" +.include "modules/flash/flashprocess.asm" +.include "modules/flash/wait.asm" +.include "modules/bootloader/main.asm" + + + +systemSetSpeed: +.if clock == 8000000 + ldi r16, (1<