avr: added e04 and e05.

This commit is contained in:
Martin Preuss
2026-04-27 00:40:00 +02:00
parent accc7d41a2
commit 5e7c01c100
20 changed files with 1247 additions and 0 deletions

View File

@@ -13,6 +13,8 @@
e01 e01
e02 e02
e03 e03
e04
e05
n14 n14
n16 n16
n21 n21

4
avr/devices/e04/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
*.eep.hex
*.obj
n29-enclosure.stl
n29-enclosure-2.stl

18
avr/devices/e04/0BUILD Normal file
View File

@@ -0,0 +1,18 @@
<?xml?>
<gwbuild>
<subdirs>
boot
main
</subdirs>
<extradist>
defs.asm
README
</extradist>
</gwbuild>

11
avr/devices/e04/README Normal file
View File

@@ -0,0 +1,11 @@
E04
===
- Role: Extension for S06
- MCU: AtTiny84
- Connection: S06-internal
- Predecessor: E03
- Periphery:
- TWI interface
- clock

View File

@@ -0,0 +1,32 @@
<?xml?>
<gwbuild>
<target type="AvrHexFile" name="e04_boot" >
<includes type="avrasm" >
-I $(builddir)
-I $(srcdir)
-I $(topsrcdir)/avr
-I $(topbuilddir)/avr
</includes>
<sources type="avrasm" >
boot.asm
</sources>
</target>
<subdirs>
</subdirs>
<extradist>
</extradist>
</gwbuild>

View File

@@ -0,0 +1,155 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
; ***************************************************************************
; 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 "version.asm"
.include "../defs.asm"
.include "common/calls.asm"
.include "common/utils_io.asm"
.include "devices/all/defs.asm"
#define COM_ACCEPT_ALL_DEST
; ***************************************************************************
; defines
; ---------------------------------------------------------------------------
; generic
.include "common/utils_wait.asm"
; ---------------------------------------------------------------------------
; firmware settings
; ---------------------------------------------------------------------------
; 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 "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_com2w.asm"
.include "modules/flash/flash1p.asm"
.include "modules/flash/flashxp.asm"
.include "modules/flash/flashprocess.asm"
.include "modules/flash/wait.asm"
.include "modules/bootloader/main.asm"
.include "modules/network/msg/defs.asm"
.include "modules/network/msg/crc.asm"
;.include "common/debug.asm"
systemSetSpeed:
.if clock == 8000000
ldi r16, (1<<CLKPCE)
ldi r17, 0
out CLKPR, r16
out CLKPR, r17
.endif
.if clock == 1000000
ldi r16, (1<<CLKPCE)
ldi r17, (1<<CLKPS1) | (1<<CLKPS0)
out CLKPR, r16
out CLKPR, r17
.endif
ret

122
avr/devices/e04/defs.asm Normal file
View File

@@ -0,0 +1,122 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
; ***************************************************************************
;
; AtTiny84
; --------
; VCC 1 14 GND
; MEM_CS PB0 2 13 PA0 SQW (RTC)
; TWI_SDA PB1 3 12 PA1 COM_DATA
; /RESET PB3 4 11 PA2
; TWI_SCL PB2 5 10 PA3 LED
; COM_CLK PA7 6 9 PA4 SPI_CLK
; SPI_MOSI PA6 7 8 PA5 SPI_MISO
; --------
;
; ***************************************************************************
.equ BOOTLOADER_ADDR = 0xd00
.equ FIRMWARE_VARIANT_BOOT = 0
.equ FIRMWARE_VARIANT_TEMP_WINDOW = 1
.equ DEVICEINFO_ID = 'E'
.equ DEVICEINFO_VERSION = 4
.equ DEVICEINFO_REVISION = 0
; ---------------------------------------------------------------------------
; LED module
.equ LED_SIMPLE_ONTIME = 1 ; shorter
.equ LED_SIMPLE_OFFTIME = 99 ; longer
.equ LED_SIMPLE_DDR = DDRA
.equ LED_SIMPLE_PORT = PORTA
.equ LED_SIMPLE_PORTIN = PINA
.equ LED_SIMPLE_PINNUM = PORTA3
; ---------------------------------------------------------------------------
; LED Activity module
.equ LED_ACTIVITY_DDR = DDRA
.equ LED_ACTIVITY_PORT = PORTA
.equ LED_ACTIVITY_PORTIN = PINA
.equ LED_ACTIVITY_PINNUM = PORTA3
; ---------------------------------------------------------------------------
; COM module
.equ COM_BIT_LENGTH = 52000 ; 104000ns=9600, 52000ns=19200, 26000ns=38400
.equ COM_HALFBIT_LENGTH = 26000 ; see https://de.wikipedia.org/wiki/Universal_Asynchronous_Receiver_Transmitter
.equ COM_DATA_DDR = DDRA
.equ COM_DATA_INPUT = PINA
.equ COM_DATA_OUTPUT = PORTA
.equ COM_DATA_PIN = PORTA1
.equ COM_CLK_DDR = DDRA
.equ COM_CLK_INPUT = PINA
.equ COM_CLK_OUTPUT = PORTA
.equ COM_CLK_PIN = PORTA7
.equ COM_IRQ_ADDR_CLK = PCMSK0
.equ COM_IRQ_BIT_CLK = PCINT7 ; bit 7 in PCMSK0
.equ COM_IRQ_GIFR_CLK = PCIF0
.equ COM_IRQ_GIMSK_CLK = PCIE0
; ---------------------------------------------------------------------------
; TWI master module
;.equ TWI_BIT_LENGTH = 10000 ; 100000 and 200000 works for display: 10000, 100000, 200000
.equ TWI_BIT_LENGTH = 1 ; 10, 100, 500, 100000 and 200000 works for display: 10000, 100000, 200000
.equ TWI_DDR_SCL = DDRB
.equ TWI_PORT_SCL = PORTB
.equ TWI_PIN_SCL = PINB
.equ TWI_PINNUM_SCL = PORTB2
.equ TWI_DDR_SDA = DDRB
.equ TWI_PORT_SDA = PORTB
.equ TWI_PIN_SDA = PINB
.equ TWI_PINNUM_SDA = PORTB1
; ---------------------------------------------------------------------------
; DS3231 (RTC)
.equ DS3231_ADDR = 0x68
.equ AT24C32_ADDR = 0x57
; ---------------------------------------------------------------------------
; DS1307 (RTC)
.equ DS1307_ADDR = 0x68
; ---------------------------------------------------------------------------
; LCD module
.equ LCD_TWI_ADDRESS = 0x3c

View File

@@ -0,0 +1,34 @@
<?xml?>
<gwbuild>
<target type="AvrHexFile" name="e04_firmware" >
<includes type="avrasm" >
-I $(builddir)
-I $(srcdir)
-I $(topsrcdir)/avr
-I $(topbuilddir)/avr
</includes>
<sources type="avrasm" >
main.asm
</sources>
</target>
<subdirs>
</subdirs>
<extradist>
screen.asm
</extradist>
</gwbuild>

View File

@@ -0,0 +1,207 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
; ***************************************************************************
; Source file for temperature sensor node on AtTiny 84
;
; This is for the full system (i.e. not the boot loader).
;
; All definitions and changes should go into this file.
;
;
; ***************************************************************************
.equ clock=1000000 ; Define the clock frequency
;.equ clock=8000000 ; Define the clock frequency
.nolist
.include "include/tn84def.inc" ; Define device ATtiny84
.list
.include "../defs.asm"
.include "version.asm"
.include "devices/all/defs.asm"
.include "common/calls.asm"
.include "common/utils_io.asm"
.include "common/utils_wait.asm"
; ***************************************************************************
; defines
; ---------------------------------------------------------------------------
; generic
.equ NET_BUFFERS_NUM = 6
.equ NET_MSGNUMINBUF_SIZE = 8 ; max buffer nums in ringbuffer (global incoming)
.equ NET_IFACE_OUTMSGBUF_SIZE = 8 ; max buffer nums in ringbuffer (per interface outbound)
; ---------------------------------------------------------------------------
; firmware settings including list of modules used
; #define MODULES_TIMER
#define MODULES_CLOCK
#define MODULES_LED_SIMPLE
#define MODULES_NETWORK
#define MODULES_COM2W
#define MODULES_TWI_MASTER
#define MODULES_LCD
#define LCD_MINIMAL_FONT
#define MODULES_DS1307
#define APPS_NETWORK
#define APPS_STATS
; ---------------------------------------------------------------------------
; defines for values
; none
; ***************************************************************************
; code segment
.cseg
.org 000000
; ---------------------------------------------------------------------------
; Reset and interrupt vectors (will be removed as soon as we can flash data over COM)
; rjmp main ; Reset vector
rjmp BOOTLOADER_ADDR ; Reset vector ; use this for flashed system
reti ; EXT_INT0
rjmp com2wPcintIsr ; PCI0
reti ; PCI1
reti ; WATCHDOG
reti ; ICP1
reti ; OC1A
reti ; OC1B
reti ; OVF1
rjmp baseTimerIrqOC0A ; 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_TEMP_WINDOW, FIRMWARE_VERSION_MAJOR
.db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL
; ---------------------------------------------------------------------------
; @routine firmwareStart @global
firmwareStart:
rjmp main
; @end
; ---------------------------------------------------------------------------
; @routine onSystemStart
onSystemStart:
rcall ScreenPrintErrors
ret
; @end
; ---------------------------------------------------------------------------
; @routine onMessageReceived
;
; Called on every message received
onMessageReceived:
clc
ret
; @end
; ---------------------------------------------------------------------------
; @routine onEvery100ms
;
; Called every 100ms. Add your routine calls here. No arguments, no results.
onEvery100ms:
onEverySecond:
onEveryHour:
onEveryDay:
ret
; @end
onEveryMinute:
rcall ScreenPrintErrors
; ---------------------------------------------------------------------------
; @routine onEveryLoop
;
; Called on every loop (i.e. after awakening from sleep).
;
onEveryLoop:
ret
; @end
; ***************************************************************************
; includes
.include "devices/all/hw_tn84.asm"
.include "devices/all/includes.asm"
.include "common/debug.asm"
;.include "modules/network/msg/debug-w.asm"
.include "screen.asm"
; ---------------------------------------------------------------------------
; defines for network interface
.equ netInterfaceData = com2w_iface
deviceCodeEnd:
.if deviceCodeEnd >= BOOTLOADER_ADDR
.warning "Code reaches into boot loader!"
.endif

View File

@@ -0,0 +1,99 @@
; ***************************************************************************
; copyright : (C) 2025 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
.cseg
ScreenPrintErrors:
ldi yl, LOW(netInterfaceData)
ldi yh, HIGH(netInterfaceData)
ldi r16, 0
rcall LCD_Fill
ldi r18, 0
ldi r19, 0
rcall LCD_SetCursor
ldi zl, LOW(screenTxtSystem)
ldi zh, HIGH(screenTxtSystem)
rcall LCD_PrintFromFlash
ldi r18, 0
ldi r19, 2
rcall LCD_SetCursor
ldi zl, LOW(screenTxtPacketsIn)
ldi zh, HIGH(screenTxtPacketsIn)
rcall LCD_PrintFromFlash
ldi r18, 64
ldi r19, 2
rcall LCD_SetCursor
ldd r18, Y+NET_IFACE_OFFS_PACKETSIN_LOW
ldd r19, Y+NET_IFACE_OFFS_PACKETSIN_HIGH
rcall LCD_PrintHexWord
ldi r18, 0
ldi r19, 3
rcall LCD_SetCursor
ldi zl, LOW(screenTxtPacketsOut)
ldi zh, HIGH(screenTxtPacketsOut)
rcall LCD_PrintFromFlash
ldi r18, 64
ldi r19, 3
rcall LCD_SetCursor
ldd r18, Y+NET_IFACE_OFFS_PACKETSOUT_LOW
ldd r19, Y+NET_IFACE_OFFS_PACKETSOUT_HIGH
rcall LCD_PrintHexWord
ldi r18, 0
ldi r19, 4
rcall LCD_SetCursor
ldi zl, LOW(screenTxtEContent)
ldi zh, HIGH(screenTxtEContent)
rcall LCD_PrintFromFlash
ldi r18, 64
ldi r19, 4
rcall LCD_SetCursor
ldd r18, Y+NET_IFACE_OFFS_ERR_CONTENT_LOW
ldd r19, Y+NET_IFACE_OFFS_ERR_CONTENT_HIGH
rcall LCD_PrintHexWord
ldi r18, 0
ldi r19, 5
rcall LCD_SetCursor
ldi zl, LOW(screenTxtEMsgSize)
ldi zh, HIGH(screenTxtEMsgSize)
rcall LCD_PrintFromFlash
ldi r18, 64
ldi r19, 5
rcall LCD_SetCursor
ldd r18, Y+NET_IFACE_OFFS_ERR_MSGSIZE_LOW
ldd r19, Y+NET_IFACE_OFFS_ERR_MSGSIZE_HIGH
rcall LCD_PrintHexWord
ret
; @end
screenTxtSystem: .db "AqHOME %YEAR%/%MONTH%/%DAY%-%HOUR%:%MINUTE%", 0
screenTxtPacketsIn:
.db "In:", 0
screenTxtPacketsOut:
.db "Out:", 0, 0
screenTxtEContent:
.db "eCRC:", 0
screenTxtEMsgSize:
.db "eSize:", 0, 0

4
avr/devices/e05/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
*.eep.hex
*.obj
n29-enclosure.stl
n29-enclosure-2.stl

18
avr/devices/e05/0BUILD Normal file
View File

@@ -0,0 +1,18 @@
<?xml?>
<gwbuild>
<subdirs>
boot
main
</subdirs>
<extradist>
defs.asm
README
</extradist>
</gwbuild>

13
avr/devices/e05/README Normal file
View File

@@ -0,0 +1,13 @@
E05
===
- Role: Extension for S06
- MCU: AtTiny84
- Connection: S06-internal
- Predecessor:
- Periphery:
- SPI interface
- RAM
- EEPROM

View File

@@ -0,0 +1,32 @@
<?xml?>
<gwbuild>
<target type="AvrHexFile" name="e05_boot" >
<includes type="avrasm" >
-I $(builddir)
-I $(srcdir)
-I $(topsrcdir)/avr
-I $(topbuilddir)/avr
</includes>
<sources type="avrasm" >
boot.asm
</sources>
</target>
<subdirs>
</subdirs>
<extradist>
</extradist>
</gwbuild>

View File

@@ -0,0 +1,155 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
; ***************************************************************************
; 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 "version.asm"
.include "../defs.asm"
.include "common/calls.asm"
.include "common/utils_io.asm"
.include "devices/all/defs.asm"
#define COM_ACCEPT_ALL_DEST
; ***************************************************************************
; defines
; ---------------------------------------------------------------------------
; generic
.include "common/utils_wait.asm"
; ---------------------------------------------------------------------------
; firmware settings
; ---------------------------------------------------------------------------
; 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 "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_com2w.asm"
.include "modules/flash/flash1p.asm"
.include "modules/flash/flashxp.asm"
.include "modules/flash/flashprocess.asm"
.include "modules/flash/wait.asm"
.include "modules/bootloader/main.asm"
.include "modules/network/msg/defs.asm"
.include "modules/network/msg/crc.asm"
;.include "common/debug.asm"
systemSetSpeed:
.if clock == 8000000
ldi r16, (1<<CLKPCE)
ldi r17, 0
out CLKPR, r16
out CLKPR, r17
.endif
.if clock == 1000000
ldi r16, (1<<CLKPCE)
ldi r17, (1<<CLKPS1) | (1<<CLKPS0)
out CLKPR, r16
out CLKPR, r17
.endif
ret

73
avr/devices/e05/defs.asm Normal file
View File

@@ -0,0 +1,73 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
; ***************************************************************************
;
; AtTiny84
; --------
; VCC 1 14 GND
; RAM_CS PB0 2 13 PA0
; EEPROM_CS PB1 3 12 PA1 COM_DATA
; /RESET PB3 4 11 PA2
; PB2 5 10 PA3 LED
; COM_CLK PA7 6 9 PA4 SPI_CLK
; SPI_MOSI PA6 7 8 PA5 SPI_MISO
; --------
;
; ***************************************************************************
.equ BOOTLOADER_ADDR = 0xd00
.equ FIRMWARE_VARIANT_BOOT = 0
.equ FIRMWARE_VARIANT_TEMP_WINDOW = 1
.equ DEVICEINFO_ID = 'E'
.equ DEVICEINFO_VERSION = 5
.equ DEVICEINFO_REVISION = 0
; ---------------------------------------------------------------------------
; LED module
.equ LED_SIMPLE_ONTIME = 1 ; shorter
.equ LED_SIMPLE_OFFTIME = 99 ; longer
.equ LED_SIMPLE_DDR = DDRA
.equ LED_SIMPLE_PORT = PORTA
.equ LED_SIMPLE_PORTIN = PINA
.equ LED_SIMPLE_PINNUM = PORTA3
; ---------------------------------------------------------------------------
; COM module
.equ COM_BIT_LENGTH = 52000 ; 104000ns=9600, 52000ns=19200, 26000ns=38400
.equ COM_HALFBIT_LENGTH = 26000 ; see https://de.wikipedia.org/wiki/Universal_Asynchronous_Receiver_Transmitter
.equ COM_DATA_DDR = DDRA
.equ COM_DATA_INPUT = PINA
.equ COM_DATA_OUTPUT = PORTA
.equ COM_DATA_PIN = PORTA1
.equ COM_CLK_DDR = DDRA
.equ COM_CLK_INPUT = PINA
.equ COM_CLK_OUTPUT = PORTA
.equ COM_CLK_PIN = PORTA7
.equ COM_IRQ_ADDR_CLK = PCMSK0
.equ COM_IRQ_BIT_CLK = PCINT7 ; bit 7 in PCMSK0
.equ COM_IRQ_GIFR_CLK = PCIF0
.equ COM_IRQ_GIMSK_CLK = PCIE0

View File

@@ -0,0 +1,34 @@
<?xml?>
<gwbuild>
<target type="AvrHexFile" name="e05_firmware" >
<includes type="avrasm" >
-I $(builddir)
-I $(srcdir)
-I $(topsrcdir)/avr
-I $(topbuilddir)/avr
</includes>
<sources type="avrasm" >
main.asm
</sources>
</target>
<subdirs>
</subdirs>
<extradist>
data.asm
</extradist>
</gwbuild>

View File

@@ -0,0 +1,14 @@
; ***************************************************************************
; copyright : (C) 2025 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
.dseg

View File

@@ -0,0 +1,204 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
; ***************************************************************************
; Source file for temperature sensor node on AtTiny 84
;
; This is for the full system (i.e. not the boot loader).
;
; All definitions and changes should go into this file.
;
;
; ***************************************************************************
.equ clock=1000000 ; Define the clock frequency
;.equ clock=8000000 ; Define the clock frequency
.nolist
.include "include/tn84def.inc" ; Define device ATtiny84
.list
.include "../defs.asm"
.include "./data.asm"
.include "version.asm"
.include "devices/all/defs.asm"
.include "common/calls.asm"
.include "common/utils_io.asm"
.include "common/utils_wait.asm"
; ***************************************************************************
; defines
; ---------------------------------------------------------------------------
; generic
.equ NET_BUFFERS_NUM = 6
.equ NET_MSGNUMINBUF_SIZE = 8 ; max buffer nums in ringbuffer (global incoming)
.equ NET_IFACE_OUTMSGBUF_SIZE = 8 ; max buffer nums in ringbuffer (per interface outbound)
; ---------------------------------------------------------------------------
; firmware settings including list of modules used
; #define MODULES_TIMER
#define MODULES_CLOCK
#define MODULES_LED_SIMPLE
;#define MODULES_LED_ACTIVITY
#define MODULES_NETWORK
#define MODULES_COM2W
;#define MODULES_TWI_MASTER
;#define MODULES_LCD
;#define LCD_MINIMAL_FONT
;#define MODULES_DS3231
#define APPS_NETWORK
#define APPS_STATS
; ---------------------------------------------------------------------------
; defines for values
; ***************************************************************************
; code segment
.cseg
.org 000000
; ---------------------------------------------------------------------------
; Reset and interrupt vectors (will be removed as soon as we can flash data over COM)
; rjmp main ; Reset vector
rjmp BOOTLOADER_ADDR ; Reset vector ; use this for flashed system
reti ; EXT_INT0
rjmp com2wPcintIsr ; PCI0
reti ; PCI1
reti ; WATCHDOG
reti ; ICP1
reti ; OC1A
reti ; OC1B
reti ; OVF1
rjmp baseTimerIrqOC0A ; 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_TEMP_WINDOW, FIRMWARE_VERSION_MAJOR
.db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL
; ---------------------------------------------------------------------------
; @routine firmwareStart @global
firmwareStart:
rjmp main
; @end
; ---------------------------------------------------------------------------
; @routine onSystemStart
onSystemStart:
ret
; @end
; ---------------------------------------------------------------------------
; @routine onMessageReceived
;
; Called on every message received
onMessageReceived:
clc
ret
; @end
; ---------------------------------------------------------------------------
; @routine onEvery100ms
;
; Called every 100ms. Add your routine calls here. No arguments, no results.
onEvery100ms:
onEverySecond:
onEveryMinute:
onEveryHour:
onEveryDay:
ret
; @end
; ---------------------------------------------------------------------------
; @routine onEveryLoop
;
; Called on every loop (i.e. after awakening from sleep).
;
onEveryLoop:
ret
; @end
; ***************************************************************************
; includes
.include "devices/all/hw_tn84.asm"
.include "devices/all/includes.asm"
;.include "common/debug.asm"
;.include "modules/network/msg/debug-w.asm"
; ---------------------------------------------------------------------------
; defines for network interface
.equ netInterfaceData = com2w_iface
deviceCodeEnd:
.if deviceCodeEnd >= BOOTLOADER_ADDR
.warning "Code reaches into boot loader!"
.endif

View File

@@ -153,6 +153,22 @@ case $NODE in
FILE_ARG="-U flash:w:./0-build/avr/devices/e03/boot/e03_boot.hex" FILE_ARG="-U flash:w:./0-build/avr/devices/e03/boot/e03_boot.hex"
;; ;;
e04)
DEVICE_ARG="-p t84"
HFUSE_ARG="-U hfuse:w:0xD7:m"
LFUSE_ARG=""
EFUSE_ARG="-U efuse:w:0xFE:m"
FILE_ARG="-U flash:w:./0-build/avr/devices/e04/boot/e04_boot.hex"
;;
e05)
DEVICE_ARG="-p t84"
HFUSE_ARG="-U hfuse:w:0xD7:m"
LFUSE_ARG=""
EFUSE_ARG="-U efuse:w:0xFE:m"
FILE_ARG="-U flash:w:./0-build/avr/devices/e05/boot/e05_boot.hex"
;;
*) *)
echo "Unknown node $NODE". echo "Unknown node $NODE".
exit 1 exit 1