diff --git a/avr/devices/0BUILD b/avr/devices/0BUILD
index 717a804..5202e19 100644
--- a/avr/devices/0BUILD
+++ b/avr/devices/0BUILD
@@ -2,7 +2,7 @@
-
+
n00
n06
n11
@@ -18,6 +18,11 @@
n22
n23
t03
+
+
+
+
+ n23
diff --git a/avr/devices/n23/0BUILD b/avr/devices/n23/0BUILD
index 53ef8b7..dc4c439 100644
--- a/avr/devices/n23/0BUILD
+++ b/avr/devices/n23/0BUILD
@@ -2,44 +2,9 @@
-
-
-
- -I $(builddir)
- -I $(srcdir)
- -I $(topsrcdir)/avr
- -I $(topbuilddir)/avr
-
-
-
-
- main.asm
-
-
-
-
-
-
-
-
-
-
- -I $(builddir)
- -I $(srcdir)
- -I $(topsrcdir)/avr
- -I $(topbuilddir)/avr
-
-
-
-
- boot.asm
-
-
-
-
-
-
+ boot
+ main
diff --git a/avr/devices/n23/README b/avr/devices/n23/README
index 60505df..b1a7c94 100644
--- a/avr/devices/n23/README
+++ b/avr/devices/n23/README
@@ -1,5 +1,5 @@
-N20
+N23
===
- Role: Air quality and climate sensors
diff --git a/avr/devices/n23/boot/0BUILD b/avr/devices/n23/boot/0BUILD
new file mode 100644
index 0000000..d266259
--- /dev/null
+++ b/avr/devices/n23/boot/0BUILD
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+ -I $(builddir)
+ -I $(srcdir)
+ -I $(topsrcdir)/avr
+ -I $(topbuilddir)/avr
+
+
+
+
+ boot.asm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/avr/devices/n23/boot.asm b/avr/devices/n23/boot/boot.asm
similarity index 97%
rename from avr/devices/n23/boot.asm
rename to avr/devices/n23/boot/boot.asm
index 0ef28e4..06f242d 100644
--- a/avr/devices/n23/boot.asm
+++ b/avr/devices/n23/boot/boot.asm
@@ -12,10 +12,13 @@
.include "include/tn84def.inc" ; Define device ATtiny84
.list
-.include "./defs.asm"
+.include "../defs.asm"
.include "defs_all.asm"
+#define COM_ACCEPT_ALL_DEST
+
+
; ***************************************************************************
; defines
@@ -119,6 +122,8 @@ main:
.include "modules/network/msg/defs.asm"
.include "modules/network/msg/crc.asm"
+.include "common/debug.asm"
+
systemSetSpeed:
diff --git a/avr/devices/n23/main/0BUILD b/avr/devices/n23/main/0BUILD
new file mode 100644
index 0000000..ad3944d
--- /dev/null
+++ b/avr/devices/n23/main/0BUILD
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ -I $(builddir)
+ -I $(srcdir)
+ -I $(topsrcdir)/avr
+ -I $(topbuilddir)/avr
+
+
+
+
+ main.asm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/avr/devices/n23/main.asm b/avr/devices/n23/main/main-old.asm
similarity index 99%
rename from avr/devices/n23/main.asm
rename to avr/devices/n23/main/main-old.asm
index bdf974b..6cb705c 100644
--- a/avr/devices/n23/main.asm
+++ b/avr/devices/n23/main/main-old.asm
@@ -30,7 +30,7 @@
.include "include/tn84def.inc" ; Define device ATtiny84
.list
-.include "./defs.asm"
+.include "../defs.asm"
.include "defs_all.asm"
diff --git a/avr/devices/n23/main/main.asm b/avr/devices/n23/main/main.asm
new file mode 100644
index 0000000..da8ef4d
--- /dev/null
+++ b/avr/devices/n23/main/main.asm
@@ -0,0 +1,364 @@
+; ***************************************************************************
+; copyright : (C) 2024 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 "defs_all.asm"
+
+
+
+; ***************************************************************************
+; defines
+
+; ---------------------------------------------------------------------------
+; generic
+
+
+
+; ---------------------------------------------------------------------------
+; firmware settings including list of modules used
+
+.equ FIRMWARE_VERSION_MAJOR = 0
+.equ FIRMWARE_VERSION_MINOR = 0
+.equ FIRMWARE_VERSION_PATCHLEVEL = 1
+
+
+#define MODULES_TIMER
+#define MODULES_LED_SIMPLE
+#define MODULES_TWI_MASTER
+;#define MODULES_LCD
+#define LCD_MINIMAL_FONT
+#define MODULES_SI7021
+#define MODULES_STATS
+;#define MODULES_OWI_MASTER
+;#define MODULES_DS18B20
+#define MODULES_MOTION
+;#define MODULES_CCS811
+
+; ---------------------------------------------------------------------------
+; defines for values
+
+.equ VALUE_ID_SI7021_TEMP = 0x01
+.equ VALUE_ID_SI7021_HUM = 0x02
+
+.equ VALUE_ID_ADC = 0x03
+;.equ VALUE_ID_REED1 = 0x04
+;.equ VALUE_ID_REED2 = 0x05
+;.equ VALUE_ID_DS18B20_TEMP = 0x06
+.equ VALUE_ID_MOTION = 0x07
+
+.equ VALUE_ID_CO2 = 0x08
+.equ VALUE_ID_TVOC = 0x09
+
+;.equ VALUE_ID_REED_CONF = 0x81
+
+.equ VALUE_ID_DEBUG = 0x7f
+
+
+
+; ***************************************************************************
+; 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 uartBitbangIsrPcint0 ; 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
+
+firmwareStart:
+ cli
+ ; setup stack
+ .ifdef SPH ; if SPH is defined
+ ldi r16, High(RAMEND)
+ out SPH, r16 ; init MSB stack pointer
+ .endif
+ ldi r16, Low(RAMEND)
+ out SPL, r16 ; init LSB stack pointer
+
+ rcall systemSetSpeed
+ rcall initHardware
+; rcall watchdogOff ; turn off watchdog timer (sometimes it stays on after reboot)
+
+ rcall Utils_Init
+ rcall Utils_SetupUid
+
+ rcall initModules
+
+ sbi LED_SIMPLE_DDR, LED_SIMPLE_PINNUM ; out
+ sbi LED_SIMPLE_PORT, LED_SIMPLE_PINNUM ; off
+
+ sei
+main_loop:
+ ; only modify SE, SM1 and SM0
+ cli
+ in r16, MCUCR
+ ldi r17, (1<