avr: added device n32 (FAN controller).
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
n29
|
||||
n30
|
||||
n31
|
||||
n32
|
||||
r06
|
||||
s03
|
||||
t03
|
||||
|
||||
4
avr/devices/n32/.gitignore
vendored
Normal file
4
avr/devices/n32/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*.eep.hex
|
||||
*.obj
|
||||
n32-enclosure.stl
|
||||
n32-enclosure-2.stl
|
||||
19
avr/devices/n32/0BUILD
Normal file
19
avr/devices/n32/0BUILD
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml?>
|
||||
|
||||
<gwbuild>
|
||||
|
||||
<subdirs>
|
||||
boot
|
||||
main
|
||||
</subdirs>
|
||||
|
||||
<extradist>
|
||||
defs.asm
|
||||
README
|
||||
enclosure.scad
|
||||
</extradist>
|
||||
|
||||
|
||||
</gwbuild>
|
||||
|
||||
|
||||
14
avr/devices/n32/README
Normal file
14
avr/devices/n32/README
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
N32
|
||||
===
|
||||
|
||||
- Role: Fan Controller
|
||||
- MCU: AtTiny861
|
||||
- Frequency: 1MHz
|
||||
- Connection: RJ45
|
||||
- COM: COM2W
|
||||
- Periphery:
|
||||
- Apps:
|
||||
- NETWORK : Basic network functionality (address setup etc.)
|
||||
- REPORTSENSORS: report sensor data from temperature sensor etc.
|
||||
- STATS : periodically send stats data
|
||||
32
avr/devices/n32/boot/0BUILD
Normal file
32
avr/devices/n32/boot/0BUILD
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml?>
|
||||
|
||||
<gwbuild>
|
||||
|
||||
<target type="AvrHexFile" name="n32_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>
|
||||
|
||||
|
||||
156
avr/devices/n32/boot/boot.asm
Normal file
156
avr/devices/n32/boot/boot.asm
Normal file
@@ -0,0 +1,156 @@
|
||||
; ***************************************************************************
|
||||
; 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/tn861Adef.inc" ; Define device ATtiny861A
|
||||
.list
|
||||
|
||||
.include "common/calls.asm"
|
||||
.include "common/utils_io.asm"
|
||||
.include "devices/all/io_1.asm"
|
||||
|
||||
.include "version.asm"
|
||||
.include "../defs.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 main ; 0x00: Reset vector Reset Vector
|
||||
reti ; 0x01: INT0 External Interrupt 0
|
||||
reti ; 0x02: PCI Pin Change Interrupt
|
||||
reti ; 0x03: OC1A Timer/Counter1 Compare Match 1A
|
||||
reti ; 0x04: OC1B Timer/Counter1 Compare Match 1B
|
||||
reti ; 0x05: OVF1 Timer/Counter1 Overflow
|
||||
reti ; 0x06: OVF0 Timer/Counter0 Overflow
|
||||
reti ; 0x07: USI_START USI Start
|
||||
reti ; 0x08: USI_OVF USI Overflow
|
||||
reti ; 0x09: ERDY EEPROM Ready
|
||||
reti ; 0x0a: ACI Analog Comparator
|
||||
reti ; 0x0b: ADCC ADC Conversion Complete
|
||||
reti ; 0x0c: WDT Watchdog Time-Out
|
||||
reti ; 0x0d: INT1 External Interrupt 1
|
||||
reti ; 0x0e: OC0A Timer/Counter0 Compare Match A
|
||||
reti ; 0x0f: OC0B Timer/Counter0 Compare Match B
|
||||
reti ; 0x10: ICP0 Interrupt Capture Event for Timer/Counter0
|
||||
reti ; 0x11: OC1D Timer/Counter1 Compare Match D
|
||||
reti ; 0x12: FAULT_PROT Timer/Counter1 Fault Protection
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
97
avr/devices/n32/defs.asm
Normal file
97
avr/devices/n32/defs.asm
Normal file
@@ -0,0 +1,97 @@
|
||||
; ***************************************************************************
|
||||
; 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. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
;
|
||||
; AtTiny861
|
||||
; --------
|
||||
; PB0 1 20 PA0 COM_DATA
|
||||
; PWM1 PB1 2 19 PA1
|
||||
; Tacho1 PB2 3 18 PA2 COM_CLK
|
||||
; PWM2 PB3 4 17 PA3 LED
|
||||
; VCC 5 16 AGND
|
||||
; GND 6 15 AVCC
|
||||
; Tacho2 PB4 7 14 PA4
|
||||
; PWM3 PB5 8 13 PA5
|
||||
; Tacho3 PB6 9 12 PA6
|
||||
; Reset PB7 10 11 PA7
|
||||
|
||||
; --------
|
||||
;
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
|
||||
.equ BOOTLOADER_ADDR = 0xd00
|
||||
|
||||
.equ FIRMWARE_VARIANT_BOOT = 0
|
||||
.equ FIRMWARE_VARIANT_TEMP_WINDOW = 1
|
||||
|
||||
.equ DEVICEINFO_ID = 'N'
|
||||
.equ DEVICEINFO_VERSION = 32
|
||||
.equ DEVICEINFO_REVISION = 0
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; LED module
|
||||
|
||||
; green LED
|
||||
.equ LED1_DEFAULT_ONTIME = 1 ; shorter
|
||||
.equ LED1_DEFAULT_OFFTIME = 99 ; longer
|
||||
.equ LED1_DEFAULT_REPEATS = 0 ; continous
|
||||
.equ LED1_DDR = DDRA
|
||||
.equ LED1_PORT = PORTA
|
||||
.equ LED1_PORTIN = PINA
|
||||
.equ LED1_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 = PORTA0
|
||||
|
||||
.equ COM_CLK_DDR = DDRA
|
||||
.equ COM_CLK_INPUT = PINA
|
||||
.equ COM_CLK_OUTPUT = PORTA
|
||||
.equ COM_CLK_PIN = PORTA2
|
||||
|
||||
.equ COM_IRQ_ADDR_CLK = PCMSK0
|
||||
.equ COM_IRQ_BIT_CLK = PCINT2 ; bit 2 in PCMSK0
|
||||
.equ COM_IRQ_GIFR_CLK = PCIF
|
||||
.equ COM_IRQ_GIMSK_CLK = PCIE0
|
||||
|
||||
|
||||
|
||||
; MultiFan module (definitions for new IO module)
|
||||
.equ MULTIFAN_FANS = 3
|
||||
.equ MULTIFAN_PWM_DDR = DDRB
|
||||
.equ MULTIFAN_PWM_OUTPUT = PORTB
|
||||
|
||||
.equ MULTIFAN_TACHO_DDR = DDRB
|
||||
.equ MULTIFAN_TACHO_INPUT = PINB
|
||||
|
||||
.equ MULTIFAN_PWM1_PIN = PORTB1
|
||||
.equ MULTIFAN_TACHO1_PIN = PORTB2
|
||||
|
||||
.equ MULTIFAN_PWM2_PIN = PORTB3
|
||||
.equ MULTIFAN_TACHO2_PIN = PORTB4
|
||||
|
||||
.equ MULTIFAN_PWM3_PIN = PORTB5
|
||||
.equ MULTIFAN_TACHO3_PIN = PORTB6
|
||||
|
||||
|
||||
|
||||
|
||||
244
avr/devices/n32/enclosure.scad
Normal file
244
avr/devices/n32/enclosure.scad
Normal file
@@ -0,0 +1,244 @@
|
||||
$fn = 50;
|
||||
|
||||
width = 45;
|
||||
length = 60;
|
||||
height = 20;
|
||||
|
||||
corner_radius = 2;
|
||||
wall_thickness = 1.5;
|
||||
post_diameter = 8;
|
||||
post_height = 0;
|
||||
|
||||
hole_diameter = 3;
|
||||
|
||||
lid_height = 4;
|
||||
lid_tolerance = .3;
|
||||
|
||||
hook_height = 1;
|
||||
hook_tolerance = 0.75;
|
||||
hook_slit_height = 2.5;
|
||||
|
||||
airslit_height = 1.75;
|
||||
|
||||
ridge_height = 16;
|
||||
ridge_width = 1;
|
||||
ridge_depth = 2.5;
|
||||
|
||||
netconn_width = 17;
|
||||
netcomm_length = 6;
|
||||
netcomm_height = 20;
|
||||
netcomm_tolerance = .3;
|
||||
|
||||
|
||||
|
||||
module posts(x, y, z, h, r){
|
||||
translate([x, y, z])
|
||||
cylinder(r = r, h = h);
|
||||
|
||||
translate([-x, y, z])
|
||||
cylinder(r = r, h = h);
|
||||
|
||||
translate([-x, -y, z])
|
||||
cylinder(r = r, h = h);
|
||||
|
||||
translate([x, -y, z])
|
||||
cylinder(r = r, h = h);
|
||||
}
|
||||
|
||||
|
||||
union() {
|
||||
difference() {
|
||||
// box
|
||||
hull() {
|
||||
posts(
|
||||
x=(width/2 - corner_radius),
|
||||
y=(length/2 - corner_radius),
|
||||
z=0,
|
||||
h=height,
|
||||
r=corner_radius);
|
||||
}
|
||||
|
||||
// hollow
|
||||
hull() {
|
||||
posts(
|
||||
x=(width/2 - corner_radius - wall_thickness),
|
||||
y=(length/2 - corner_radius - wall_thickness),
|
||||
z=wall_thickness,
|
||||
h=height,
|
||||
r=corner_radius);
|
||||
}
|
||||
|
||||
// lip inside box
|
||||
*hull() {
|
||||
posts(
|
||||
x=(width/2 - corner_radius - lid_lip),
|
||||
y=(length/2 - corner_radius - lid_lip),
|
||||
z=(height - lid_thickness),
|
||||
h=(lid_thickness + 1),
|
||||
r=corner_radius);
|
||||
}
|
||||
|
||||
// ventilation slits left 1
|
||||
for(i = [(wall_thickness+post_height+3):(airslit_height*2):(height-5)]) {
|
||||
translate([(-width/2)-wall_thickness, (-length/4), i])
|
||||
cube([10, length/5, airslit_height], center=true);
|
||||
}
|
||||
|
||||
// ventilation slits top
|
||||
for(i = [(wall_thickness+post_height+3):(airslit_height*2):(height-5)]) {
|
||||
translate([0, -(length/2), i])
|
||||
cube([width/2, 10, airslit_height], center=true);
|
||||
}
|
||||
|
||||
// ventilation slits right 1
|
||||
for(i = [(wall_thickness+post_height+3):(airslit_height*2):(height-5)]) {
|
||||
translate([(width/2)-wall_thickness, (-length/4), i])
|
||||
cube([10, length/5, 1.75], center=true);
|
||||
}
|
||||
|
||||
// network connector hole 1
|
||||
translate([(netconn_width-netcomm_tolerance)/2,
|
||||
(length/2),
|
||||
wall_thickness+2+10])
|
||||
cube([netconn_width+netcomm_tolerance,
|
||||
netcomm_length,
|
||||
netcomm_height],
|
||||
center=true);
|
||||
|
||||
// network connector hole 2
|
||||
translate([-(netconn_width-netcomm_tolerance)/2,
|
||||
(length/2),
|
||||
wall_thickness+2+10])
|
||||
cube([netconn_width+netcomm_tolerance,
|
||||
netcomm_length,
|
||||
netcomm_height],
|
||||
center=true);
|
||||
|
||||
// LED holes
|
||||
translate([12, -16, -wall_thickness])
|
||||
cylinder(r = 5.5/2, h = 6);
|
||||
|
||||
translate([4.254, -16, -wall_thickness])
|
||||
cylinder(r = 5.5/2, h = 6);
|
||||
|
||||
translate([-3.484, -16, -wall_thickness])
|
||||
cylinder(r = 5.5/2, h = 6);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// hooks upward facing side
|
||||
translate([-(width/2)-0.25, length/8, height-(hook_height/2)])
|
||||
cube([2.5, 7, hook_height], center=true);
|
||||
translate([-(width/2)-0.25, -length/8, height-(hook_height/2)])
|
||||
cube([2.5, 7, hook_height], center=true);
|
||||
|
||||
// hooks downward facing side
|
||||
translate([(width/2)+0.25, length/8, height-(hook_height/2)])
|
||||
cube([2.5, 7, hook_height], center=true);
|
||||
translate([(width/2)+0.25, -length/8, height-(hook_height/2)])
|
||||
cube([2.5, 7, hook_height], center=true);
|
||||
|
||||
// ridges to hold the pcb
|
||||
translate([(width/2)-wall_thickness, 0, ridge_height/2+(height-ridge_height)])
|
||||
cube([ridge_depth, ridge_width, ridge_height], center=true);
|
||||
|
||||
translate([-((width/2)-wall_thickness),
|
||||
length/8,
|
||||
ridge_height/2+(height-ridge_height)])
|
||||
cube([ridge_depth, ridge_width, ridge_height], center=true);
|
||||
|
||||
translate([-((width/2)-wall_thickness),
|
||||
-length/8,
|
||||
ridge_height/2+(height-ridge_height)])
|
||||
cube([ridge_depth, ridge_width, ridge_height], center=true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* lid */
|
||||
translate([0, 0, 50]) { /* match at Z=16.5, otherwise 50*/
|
||||
difference() {
|
||||
union() {
|
||||
difference() {
|
||||
hull() {
|
||||
posts(
|
||||
x=(width/2 - corner_radius + wall_thickness + lid_tolerance),
|
||||
y=(length/2 - corner_radius + lid_tolerance),
|
||||
z=0,
|
||||
h=lid_height+wall_thickness,
|
||||
r=corner_radius);
|
||||
}
|
||||
|
||||
hull() {
|
||||
posts(
|
||||
x=(width/2 - corner_radius ),
|
||||
y=(length/2 - corner_radius)+5,
|
||||
z=-(wall_thickness),
|
||||
h=lid_height+wall_thickness,
|
||||
r=corner_radius);
|
||||
}
|
||||
|
||||
// slits for hooks (upward facing side)
|
||||
translate([-((width/2)+wall_thickness/2),
|
||||
length/8,
|
||||
lid_height-((hook_slit_height)/2)])
|
||||
cube([4, 9, hook_slit_height], center=true);
|
||||
translate([-((width/2)+wall_thickness/2),
|
||||
-length/8,
|
||||
lid_height-((hook_slit_height)/2)])
|
||||
cube([4, 9, hook_slit_height], center=true);
|
||||
|
||||
// slits for hooks (downward facing side)
|
||||
translate([(width/2)+(wall_thickness/2),
|
||||
length/8,
|
||||
lid_height-((hook_slit_height)/2)])
|
||||
cube([4, 9, hook_slit_height], center=true);
|
||||
translate([(width/2)+(wall_thickness/2),
|
||||
-length/8,
|
||||
lid_height-((hook_slit_height)/2)])
|
||||
cube([4, 9, hook_slit_height], center=true);
|
||||
}
|
||||
|
||||
|
||||
// hooks downward facing side
|
||||
*translate([(width/2)-lid_lip, 0, 1])
|
||||
cube([2, 5, hook_thickness], center=true);
|
||||
*translate([(width/2)-lid_lip, length/4, 1])
|
||||
cube([2, 5, hook_thickness], center=true);
|
||||
*translate([(width/2)-lid_lip, -length/4, 1])
|
||||
cube([2, 5, hook_thickness], center=true);
|
||||
|
||||
}
|
||||
|
||||
// drilling holes
|
||||
translate([0, 0, -wall_thickness])
|
||||
cylinder(r = hole_diameter, h = 10);
|
||||
|
||||
translate([0, -(length/3), -wall_thickness])
|
||||
cylinder(r = hole_diameter, h = 10);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// support posts for pcb
|
||||
/*difference() {
|
||||
translate([0, length/4, wall_thickness])
|
||||
cylinder(r = post_diameter/2, h = post_height);
|
||||
|
||||
translate([0, length/4, wall_thickness])
|
||||
cylinder(r = hole_diameter/2, h = post_height+3);
|
||||
}
|
||||
|
||||
|
||||
difference() {
|
||||
translate([0, -length/4, wall_thickness])
|
||||
cylinder(r = post_diameter/2, h = post_height);
|
||||
|
||||
translate([0, -length/4, wall_thickness])
|
||||
cylinder(r = hole_diameter/2, h = post_height+3);
|
||||
}
|
||||
*/
|
||||
34
avr/devices/n32/main/0BUILD
Normal file
34
avr/devices/n32/main/0BUILD
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml?>
|
||||
|
||||
<gwbuild>
|
||||
|
||||
<target type="AvrHexFile" name="n32_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>
|
||||
|
||||
|
||||
14
avr/devices/n32/main/data.asm
Normal file
14
avr/devices/n32/main/data.asm
Normal 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
|
||||
|
||||
|
||||
221
avr/devices/n32/main/main.asm
Normal file
221
avr/devices/n32/main/main.asm
Normal file
@@ -0,0 +1,221 @@
|
||||
; ***************************************************************************
|
||||
; 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 fan controller node on AtTiny 861
|
||||
;
|
||||
; 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/tn861Adef.inc" ; Define device ATtiny861A
|
||||
.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_LED1
|
||||
;#define MODULES_LED2
|
||||
;#define MODULES_LED3
|
||||
#define MODULES_NETWORK
|
||||
#define MODULES_COM2W
|
||||
;#define MODULES_TWI_MASTER
|
||||
;#define MODULES_LCD
|
||||
;#define LCD_MINIMAL_FONT
|
||||
;#define MODULES_SI7021
|
||||
;#define MODULES_SGP30
|
||||
;#define MODULES_SGP40
|
||||
;#define MODULES_STATS
|
||||
;#define MODULES_OWI_MASTER
|
||||
;#define MODULES_DS18B20
|
||||
;#define MODULES_MOTION
|
||||
;#define MODULES_CCS811
|
||||
;#define MODULES_BRIGHTNESS
|
||||
#define MODULES_MULTIFAN
|
||||
|
||||
|
||||
#define APPS_NETWORK
|
||||
;#define APPS_MOTION
|
||||
#define APPS_REPORTSENSORS
|
||||
#define APPS_STATS
|
||||
;#define APPS_CO2WATCH
|
||||
|
||||
|
||||
; defines for modules
|
||||
|
||||
; #define LED1_NETWORK_ACTIVITY
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; defines for values
|
||||
|
||||
;.equ VALUE_ID_SGP40_TVOC = 0x08
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code segment
|
||||
|
||||
.cseg
|
||||
.org 000000
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Reset and interrupt vectors
|
||||
rjmp BOOTLOADER_ADDR ; 0x00: Reset vector Reset Vector
|
||||
reti ; 0x01: INT0 External Interrupt 0
|
||||
rjmp com2wPcintIsr ; 0x02: PCI Pin Change Interrupt
|
||||
reti ; 0x03: OC1A Timer/Counter1 Compare Match 1A
|
||||
reti ; 0x04: OC1B Timer/Counter1 Compare Match 1B
|
||||
reti ; 0x05: OVF1 Timer/Counter1 Overflow
|
||||
reti ; 0x06: OVF0 Timer/Counter0 Overflow
|
||||
reti ; 0x07: USI_START USI Start
|
||||
reti ; 0x08: USI_OVF USI Overflow
|
||||
reti ; 0x09: ERDY EEPROM Ready
|
||||
reti ; 0x0a: ACI Analog Comparator
|
||||
reti ; 0x0b: ADCC ADC Conversion Complete
|
||||
reti ; 0x0c: WDT Watchdog Time-Out
|
||||
reti ; 0x0d: INT1 External Interrupt 1
|
||||
rjmp baseTimerIrqOC0A ; 0x0e: OC0A Timer/Counter0 Compare Match A
|
||||
reti ; 0x0f: OC0B Timer/Counter0 Compare Match B
|
||||
reti ; 0x10: ICP0 Interrupt Capture Event for Timer/Counter0
|
||||
reti ; 0x11: OC1D Timer/Counter1 Compare Match D
|
||||
reti ; 0x12: FAULT_PROT Timer/Counter1 Fault Protection
|
||||
|
||||
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_tn861.asm"
|
||||
.include "devices/all/includes.asm"
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; defines for network interface
|
||||
|
||||
.equ netInterfaceData = com2w_iface
|
||||
|
||||
|
||||
|
||||
deviceCodeEnd:
|
||||
.if deviceCodeEnd >= BOOTLOADER_ADDR
|
||||
.warning "Code reaches into boot loader!"
|
||||
.endif
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
aqua_n29.xml
|
||||
aqua_n30.xml
|
||||
aqua_n31.xml
|
||||
aqua_n32.xml
|
||||
aqua_r05.xml
|
||||
aqua_r06.xml
|
||||
aqua_s03.xml
|
||||
|
||||
14
devices/nodes/aqua_n32.xml
Normal file
14
devices/nodes/aqua_n32.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
<device name="aqua_n32" driver="nodes">
|
||||
<manufacturer>AQUA</manufacturer>
|
||||
<devicetype>N</devicetype>
|
||||
<deviceversion>32</deviceversion>
|
||||
|
||||
<values>
|
||||
<!--
|
||||
<value name="SGP30_TVOC" id="0x09" type="sensor" dataType="rational" modality="tvoc" denom="1" />
|
||||
<value name="SGP30_CO2" id="0x0a" type="sensor" dataType="rational" modality="co2" denom="1" />
|
||||
-->
|
||||
</values>
|
||||
|
||||
</device>
|
||||
@@ -107,6 +107,14 @@ case $NODE in
|
||||
EFUSE_ARG="-U efuse:w:0xFE:m"
|
||||
FILE_ARG="-U flash:w:./0-build/avr/devices/n31/boot/n31_boot.hex"
|
||||
;;
|
||||
n32)
|
||||
DEVICE_ARG="-p t861"
|
||||
HFUSE_ARG="-U hfuse:w:0xD7:m"
|
||||
LFUSE_ARG="-U lfuse:w:0x62:m"
|
||||
EFUSE_ARG="-U efuse:w:0xFE:m"
|
||||
FILE_ARG="-U flash:w:./0-build/avr/devices/n32/boot/n32_boot.hex"
|
||||
;;
|
||||
|
||||
r05)
|
||||
DEVICE_ARG="-p t841"
|
||||
HFUSE_ARG="-U hfuse:w:0xD7:m"
|
||||
|
||||
Reference in New Issue
Block a user