1
0
Fork 0

Grunddaten

This commit is contained in:
Anna Christina Naß 2018-06-01 10:49:06 +02:00
parent 7034fec407
commit a5987b00cb
76 changed files with 20446 additions and 2 deletions

View File

@ -1,4 +1,5 @@
# minibtx-acn
Ein Klon des miniBtx-Codes aus dem bildschirmtrix-Paket von Philipp Fabian Benedikt Maier
https://github.com/cccbdexter/bildschirmtrix
Ein Klon des miniBtx-Codes aus dem bildschirmtrix-Paket von Philipp Fabian Benedikt Maier
Quelle: https://github.com/cccbdexter/bildschirmtrix

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 KiB

BIN
doc/board_wirewrap_top.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 KiB

BIN
doc/connectors.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
doc/first_tests.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 KiB

BIN
doc/fusemap.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

BIN
doc/miniBTX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

12820
doc/miniBTX.sch Normal file

File diff suppressed because it is too large Load Diff

BIN
doc/miniBTX_module.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 KiB

BIN
doc/prototype_setup.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 KiB

55
doc/readme Normal file
View File

@ -0,0 +1,55 @@
miniBTX
=======
==Abstract==
MiniBTX is an intelligent adapter that adapts the dbt03 interface to a normal V.24 serial interface. It is useful if you whish to connect a BTX (Videotex) terminal to your PC to use it with the pcPAD software.
==Control signals==
The device emulates a real dbt03 modem. If the device is hooked to another device via RS232 you will want to know if a terminal is connected and if the (fake) dialin process is done. When the START line turns to high the miniBTX adaptor sends a 0x01 by itsself. When the dialin is complete and the terminal is ready for data the miniBTX adaptor sends a 0x00. For the use in embedded devices TTL signals somethimes are a better way to indicate the state miniBTX serves sough signals too, see section "Control lines".
==Control lines==
There are 4 control lines. /Reset, /Inhibit /Terminate and Ready. Reset is directly connected to the START signal pin of the terminal (see dbt03.h for detailed description of dbt03 signals). START is mentiond here because you cen use it in an embedded device for activating power or something.
Inhibt and /Ready are also for use in embedded devices when the miniBTX circuit is integrated in another device. /Ready and /Inhibit are low active. /Ready goes to low level when a (faked) dialin process is finished. /Inhibit can be used to lock the receiving part of the miniBTX circuit. If you do not want to receive anything from the terminal just pull /Inhibt low.
The /Terminate signal can be used to cause a termination of the connection between the miniBTX circuit and the BTX-Terminal. To be sure that the termination signal is proper detected you must send at least one character (e.g. 0x00 or something). Effectively it drives the sending I/O line to the terminal to a constant high level. The BTX-Terminal interprets that as a termination of the connection and switches of the circuit immediately (If that fails the user should press the termination button on the terminal to terminate manualy) and the next connection cycle can begin.
Note: It is very important that the START line from the terminal is connected with the Reset input of the controller. The Firmware expects that a hardware reset is caused after every connection cycle! Keep that in mind when you layout your embedded circuit!
==Power supply==
The circuit needs 5V DC-Powersupply.
==How the dbt03 works==
The dbt03 is a very easy and straight forward implementation of e modem. You just have to pull an I/O pin to high level and 3 seconds later, the modem starts to dial. While the modem is dialing in you get the dialtones handed through to the TX I/O pin. While all this happens the neutral status of the I/O line is high. When the dialin process is finished the TX I/O line goes to low level (This is the new neutral status) and we are ready to transmit serial data. That is all.
==What is the problem?==
There are two problems to solve when you connect a BTX-Terminal to PC. The first thing is that the Terminals have thier own special way to set up a connection and the sacond thing is that you have an asymetric baudrate (V.23). The adapter solves this problem by acting like a real dbt03 on the one side and like a normal V.24 interface on the other side. To do this an ATmega8 is used.
==Duplex==
The original dbt03 was designed to operate in full duplex. miniBTX up to now leaks full duplex support. That is really a problem because if the terminal starts a transmission while you transmit data to the terminal the data will be garbeled. To make this missfeature less painful you can use the /inhibit signal line to lock up the receiver.
==Talking CEPT?==
The adapter has nothing to do with the CEPT-Protocol. Al it does is handing the data through. The included PC-Software illustrates how to talk to a BTX-Terminal. It implements a testpage that can be transmitted again an again by pressing the terminator (#) key. All transmission events are logged on the screen. But please be careful with the software, it is only a quick and dirty reference implementation, you should rewrite it to get a serious implementation.
Getting information about the CEPT-Protocol is a bit problematic, but not impossible if you know the magic words. You will find lots of useful information at http://www.etsi.org
The document numbers are:
T/TE 06-01 / T/CD 06-01 = ETS 300 072
T/TE 06-01 = ETS 300 073
T/TE 06-03 = ETS 300 074
T/TE 06-04 / T/CD 06-04 = ETS 300 075
T/TE 06-05 / T/CD 06-05 = ETS 300 076
Note: The article "INTERPRETATION OF THE INTERFACE SIGNALS BY THE D-BT03", published in the Hackerbibel by the CCC is not really recomandable. Especially the explaination of the dbt03 signals seems to be wrong. However you can get the article at: http://www.trust-us.ch/habi1/156_dbt03.html
08072015 Philipp Fabian Benedikt Maier

91
doc/readme.avrisp Normal file
View File

@ -0,0 +1,91 @@
==Abstract==
This file contains some hints that might be useful to solve some beginners
programming problems.
==Changing the programmer==
The progject makes use of the avrdude programmer tool which supports several
types of programmers. I prefer the avrispMKII and the stk200 Parallport
programmer. Anyway, you can change the makefile to use your favourite programmer
Find the section that is labeled with:
"Programming Options (avrdude)"
Set the variable AVRDUDE_PROGRAMMER to the programmer type you use. To find
out which programmer types are supported type
avrdude -c x
to get a list of the supported programmers. Then pick out your programmer and
configure it in the makefile. Here are two examples:
AVRDUDE_PROGRAMMER = stk200 #Parallelport
AVRDUDE_PROGRAMMER = avrispv2 #USB
Then find and set the AVRDUDE_PORT variable acording your needs:
AVRDUDE_PORT = /dev/parport0 #Parallelport
AVRDUDE_PORT = usb #USB
Now you should be ready to program the AVR device directly via the makefile.
==Set programming speed==
When using an AVRispMKII the following hints might be useful:
When you use your AVR isp you might want to change the programming speed
acording your needs. A slow clocked device needs a slow programming speed
a fast clocked device cen be programmed at a higher speed. To change
the programming speed do the following:
* Enter the terminal mode:
avrdude -p m16 -c avrispmkII -P usb -t
Note: change the -p option to the device you are using. In this
example a mega 16 is used. The terminal mode can only be
entered when an AVR device is connected correctly.
* Set the sck clock devider by typing:
sck 1 for a fast programming speed (e.g. Avr with 16 Mhz)
sck 10 for a slow programming speed
sck 100 for a very slow programming speed
Note: You might think that the programmer works without a VCC supply. (Because
it gets its power from the USB port) But this is not correct. You need
to contact the VCC pin in your layout. Otherwise the programmer will
refuse to work.
==Pinout of the ISP Header==
The most of my projects are using a customized ISP-Pinheader. It has only one
row of pins instead of two. That makes it much easier to layout. Here is the
pinout:
+---------------------+
| o o o o o o |
| 1 2 3 4 5 6 |
+---------------------+
1 = VCC
2 = SCK
3 = RESET
4 = MOSI
5 = MISO
6 = GND
20112009 Philipp Fabian Benedikt Maier

BIN
doc/software-screenshot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
doc/testpage_on_BtxTV.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

28
firmware/.dep/ctrl.o.d Normal file
View File

@ -0,0 +1,28 @@
ctrl.o: ctrl.c /usr/lib/avr/include/avr/io.h \
/usr/lib/avr/include/avr/sfr_defs.h /usr/lib/avr/include/inttypes.h \
/usr/lib/gcc/avr/4.8.2/include/stdint.h /usr/lib/avr/include/stdint.h \
/usr/lib/avr/include/avr/iom8.h /usr/lib/avr/include/avr/portpins.h \
/usr/lib/avr/include/avr/common.h /usr/lib/avr/include/avr/version.h \
/usr/lib/avr/include/avr/fuse.h /usr/lib/avr/include/avr/lock.h
/usr/lib/avr/include/avr/io.h:
/usr/lib/avr/include/avr/sfr_defs.h:
/usr/lib/avr/include/inttypes.h:
/usr/lib/gcc/avr/4.8.2/include/stdint.h:
/usr/lib/avr/include/stdint.h:
/usr/lib/avr/include/avr/iom8.h:
/usr/lib/avr/include/avr/portpins.h:
/usr/lib/avr/include/avr/common.h:
/usr/lib/avr/include/avr/version.h:
/usr/lib/avr/include/avr/fuse.h:
/usr/lib/avr/include/avr/lock.h:

45
firmware/.dep/dbt03.o.d Normal file
View File

@ -0,0 +1,45 @@
dbt03.o: dbt03.c /usr/lib/avr/include/avr/io.h \
/usr/lib/avr/include/avr/sfr_defs.h /usr/lib/avr/include/inttypes.h \
/usr/lib/gcc/avr/4.8.2/include/stdint.h /usr/lib/avr/include/stdint.h \
/usr/lib/avr/include/avr/iom8.h /usr/lib/avr/include/avr/portpins.h \
/usr/lib/avr/include/avr/common.h /usr/lib/avr/include/avr/version.h \
/usr/lib/avr/include/avr/fuse.h /usr/lib/avr/include/avr/lock.h \
/usr/lib/gcc/avr/4.8.2/include/stdbool.h \
/usr/lib/avr/include/avr/interrupt.h /usr/lib/avr/include/util/parity.h \
dbt03.h uart.h delay.h ctrl.h
/usr/lib/avr/include/avr/io.h:
/usr/lib/avr/include/avr/sfr_defs.h:
/usr/lib/avr/include/inttypes.h:
/usr/lib/gcc/avr/4.8.2/include/stdint.h:
/usr/lib/avr/include/stdint.h:
/usr/lib/avr/include/avr/iom8.h:
/usr/lib/avr/include/avr/portpins.h:
/usr/lib/avr/include/avr/common.h:
/usr/lib/avr/include/avr/version.h:
/usr/lib/avr/include/avr/fuse.h:
/usr/lib/avr/include/avr/lock.h:
/usr/lib/gcc/avr/4.8.2/include/stdbool.h:
/usr/lib/avr/include/avr/interrupt.h:
/usr/lib/avr/include/util/parity.h:
dbt03.h:
uart.h:
delay.h:
ctrl.h:

40
firmware/.dep/delay.o.d Normal file
View File

@ -0,0 +1,40 @@
delay.o: delay.c /usr/lib/avr/include/util/delay.h \
/usr/lib/avr/include/inttypes.h /usr/lib/gcc/avr/4.8.2/include/stdint.h \
/usr/lib/avr/include/stdint.h /usr/lib/avr/include/util/delay_basic.h \
/usr/lib/avr/include/math.h /usr/lib/avr/include/avr/interrupt.h \
/usr/lib/avr/include/avr/io.h /usr/lib/avr/include/avr/sfr_defs.h \
/usr/lib/avr/include/avr/iom8.h /usr/lib/avr/include/avr/portpins.h \
/usr/lib/avr/include/avr/common.h /usr/lib/avr/include/avr/version.h \
/usr/lib/avr/include/avr/fuse.h /usr/lib/avr/include/avr/lock.h delay.h
/usr/lib/avr/include/util/delay.h:
/usr/lib/avr/include/inttypes.h:
/usr/lib/gcc/avr/4.8.2/include/stdint.h:
/usr/lib/avr/include/stdint.h:
/usr/lib/avr/include/util/delay_basic.h:
/usr/lib/avr/include/math.h:
/usr/lib/avr/include/avr/interrupt.h:
/usr/lib/avr/include/avr/io.h:
/usr/lib/avr/include/avr/sfr_defs.h:
/usr/lib/avr/include/avr/iom8.h:
/usr/lib/avr/include/avr/portpins.h:
/usr/lib/avr/include/avr/common.h:
/usr/lib/avr/include/avr/version.h:
/usr/lib/avr/include/avr/fuse.h:
/usr/lib/avr/include/avr/lock.h:
delay.h:

50
firmware/.dep/main.o.d Normal file
View File

@ -0,0 +1,50 @@
main.o: main.c /usr/lib/avr/include/avr/io.h \
/usr/lib/avr/include/avr/sfr_defs.h /usr/lib/avr/include/inttypes.h \
/usr/lib/gcc/avr/4.8.2/include/stdint.h /usr/lib/avr/include/stdint.h \
/usr/lib/avr/include/avr/iom8.h /usr/lib/avr/include/avr/portpins.h \
/usr/lib/avr/include/avr/common.h /usr/lib/avr/include/avr/version.h \
/usr/lib/avr/include/avr/fuse.h /usr/lib/avr/include/avr/lock.h \
/usr/lib/avr/include/stdio.h /usr/lib/gcc/avr/4.8.2/include/stdarg.h \
/usr/lib/gcc/avr/4.8.2/include/stddef.h \
/usr/lib/avr/include/avr/pgmspace.h /usr/lib/avr/include/avr/interrupt.h \
uart.h dbt03.h ctrl.h delay.h
/usr/lib/avr/include/avr/io.h:
/usr/lib/avr/include/avr/sfr_defs.h:
/usr/lib/avr/include/inttypes.h:
/usr/lib/gcc/avr/4.8.2/include/stdint.h:
/usr/lib/avr/include/stdint.h:
/usr/lib/avr/include/avr/iom8.h:
/usr/lib/avr/include/avr/portpins.h:
/usr/lib/avr/include/avr/common.h:
/usr/lib/avr/include/avr/version.h:
/usr/lib/avr/include/avr/fuse.h:
/usr/lib/avr/include/avr/lock.h:
/usr/lib/avr/include/stdio.h:
/usr/lib/gcc/avr/4.8.2/include/stdarg.h:
/usr/lib/gcc/avr/4.8.2/include/stddef.h:
/usr/lib/avr/include/avr/pgmspace.h:
/usr/lib/avr/include/avr/interrupt.h:
uart.h:
dbt03.h:
ctrl.h:
delay.h:

45
firmware/.dep/uart.o.d Normal file
View File

@ -0,0 +1,45 @@
uart.o: uart.c /usr/lib/avr/include/avr/io.h \
/usr/lib/avr/include/avr/sfr_defs.h /usr/lib/avr/include/inttypes.h \
/usr/lib/gcc/avr/4.8.2/include/stdint.h /usr/lib/avr/include/stdint.h \
/usr/lib/avr/include/avr/iom8.h /usr/lib/avr/include/avr/portpins.h \
/usr/lib/avr/include/avr/common.h /usr/lib/avr/include/avr/version.h \
/usr/lib/avr/include/avr/fuse.h /usr/lib/avr/include/avr/lock.h \
/usr/lib/avr/include/avr/interrupt.h \
/usr/lib/gcc/avr/4.8.2/include/stdbool.h \
/usr/lib/avr/include/util/delay.h \
/usr/lib/avr/include/util/delay_basic.h /usr/lib/avr/include/math.h \
uart.h
/usr/lib/avr/include/avr/io.h:
/usr/lib/avr/include/avr/sfr_defs.h:
/usr/lib/avr/include/inttypes.h:
/usr/lib/gcc/avr/4.8.2/include/stdint.h:
/usr/lib/avr/include/stdint.h:
/usr/lib/avr/include/avr/iom8.h:
/usr/lib/avr/include/avr/portpins.h:
/usr/lib/avr/include/avr/common.h:
/usr/lib/avr/include/avr/version.h:
/usr/lib/avr/include/avr/fuse.h:
/usr/lib/avr/include/avr/lock.h:
/usr/lib/avr/include/avr/interrupt.h:
/usr/lib/gcc/avr/4.8.2/include/stdbool.h:
/usr/lib/avr/include/util/delay.h:
/usr/lib/avr/include/util/delay_basic.h:
/usr/lib/avr/include/math.h:
uart.h:

512
firmware/Makefile Normal file
View File

@ -0,0 +1,512 @@
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, J<>rg Wunsch, et al.
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# MCU name
MCU = atmega8
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
F_CPU = 16000000
# Output format. (can be srec, ihex, binary)
FORMAT = binary
# Target file name (without extension).
TARGET = main
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c uart.c delay.c dbt03.c ctrl.c
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT =s
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
#DEBUG = dwarf-2
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS =
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here
CDEFS = -DF_CPU=$(F_CPU)UL
# Place -I options here
CINCS =
#---------------- Compiler Options ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
#CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS) $(CINCS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -Wall -Wstrict-prototypes
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -ahlms: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
#---------------- External Memory Options ----------------
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()).
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
EXTMEMOPTS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#---------------- Programming Options (avrdude) ----------------
# Programming hardware: alf avr910 avrisp bascom bsd
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ?
# to get a full listing.
#
#AVRDUDE_PROGRAMMER = stk200 #Parallelport
AVRDUDE_PROGRAMMER = avrispv2 #USB
# com1 = serial port. Use lpt1 to connect to parallel port.
#AVRDUDE_PORT = /dev/parport0 # programmer connected to serial device
AVRDUDE_PORT = usb
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Debugging Options ----------------
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr
# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
NM = avr-nm
AVRDUDE = avrdude
REMOVE = rm -f
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
# Define all object files.
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
# Define all listing files.
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
all: begin gccversion sizebefore build sizeafter end
build: elf hex eep lss sym
elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) -A $(TARGET).elf
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
$(AVRMEM) 2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
$(AVRMEM) 2>/dev/null; echo; fi
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
program: $(TARGET).hex $(TARGET).eep
sudo $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
fuse:
$(AVRDUDE) $(AVRDUDE_FLAGS) -q -U lfuse:w:0x20:m -U hfuse:w:0xd9:m
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@echo end >> $(GDBINIT_FILE)
@echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
@echo load >> $(GDBINIT_FILE)
endif
@echo break main >> $(GDBINIT_FILE)
debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
@$(WINSHELL) /c pause
else
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
$(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT=$(OBJCOPY) --debugging \
--change-section-address .data-0x800000 \
--change-section-address .bss-0x800000 \
--change-section-address .noinit-0x800000 \
--change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list end
clean_list :
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(OBJ)
$(REMOVE) $(LST)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) .dep/*
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff \
clean clean_list program debug gdb-config

61
firmware/ctrl.c Normal file
View File

@ -0,0 +1,61 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V1.0.0 #
# Control-line-Handler #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <avr/io.h> /* Include I/O definitions */
#include <stdint.h> /* Include Integer types */
/* #################################################################################### */
/* #################################################################################### */
/* Initalize Control lines */
void systemCtrlInit(void)
{
PORTB |= (1 << PB1); /* Set PB1 to high level */
DDRB |= (1 << DDB1); /* Set PB1 as output */
PORTB |= (1 << PB2); /* Enable PB2 (inhibit) pullup resistor */
PORTD |= (1 << PD4); /* Enable PD4 (terminate) pullup resistor */
return;
}
/* Toggle ready signal (ready => low) */
void systemCtrlReady(void)
{
PORTB &= ~(1 << PB1); /* Set PB1 to low level */
}
/* Check if inhibit signal is present (Low=Inhibit=0 , High=Normal=1) */
uint8_t systemCtrlCheckInhibit(void)
{
return ((PINB >> PB2) & 1);
}
/* Check if terminate signal is present (Low=Terminate=0 , High=Normal=1 */
uint8_t systemCtrlCheckTerminate(void)
{
return ((PIND >> PD4) & 1);
}
/* #################################################################################### */

38
firmware/ctrl.h Normal file
View File

@ -0,0 +1,38 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V1.0.0 #
# Control-line-Handler #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CTRL_H
#define CTRL_H
void systemCtrlInit(void); /* Initalize Control lines */
void systemCtrlReady(void); /* Toggle ready signal (ready => low) */
uint8_t systemCtrlCheckInhibit(void); /* Check if inhibit signal is present (Low=Inhibit=0 , High=Normal=1) */
uint8_t systemCtrlCheckTerminate(void); /* Check if terminate signal is present (Low=Terminate=0 , High=Normal=1 */
#endif /*CTRL_H*/
/* #################################################################################### */

61
firmware/ctrl.lst Normal file
View File

@ -0,0 +1,61 @@
1 .file "ctrl.c"
2 __SP_H__ = 0x3e
3 __SP_L__ = 0x3d
4 __SREG__ = 0x3f
5 __tmp_reg__ = 0
6 __zero_reg__ = 1
7 .text
8 .global systemCtrlInit
10 systemCtrlInit:
11 /* prologue: function */
12 /* frame size = 0 */
13 /* stack size = 0 */
14 .L__stack_usage = 0
15 0000 C19A sbi 0x18,1
16 0002 B99A sbi 0x17,1
17 0004 C29A sbi 0x18,2
18 0006 949A sbi 0x12,4
19 0008 0895 ret
21 .global systemCtrlReady
23 systemCtrlReady:
24 /* prologue: function */
25 /* frame size = 0 */
26 /* stack size = 0 */
27 .L__stack_usage = 0
28 000a C198 cbi 0x18,1
29 000c 0895 ret
31 .global systemCtrlCheckInhibit
33 systemCtrlCheckInhibit:
34 /* prologue: function */
35 /* frame size = 0 */
36 /* stack size = 0 */
37 .L__stack_usage = 0
38 000e 86B3 in r24,0x16
39 0010 82FB bst r24,2
40 0012 8827 clr r24
41 0014 80F9 bld r24,0
42 0016 0895 ret
44 .global systemCtrlCheckTerminate
46 systemCtrlCheckTerminate:
47 /* prologue: function */
48 /* frame size = 0 */
49 /* stack size = 0 */
50 .L__stack_usage = 0
51 0018 80B3 in r24,0x10
52 001a 8295 swap r24
53 001c 8170 andi r24,1
54 001e 0895 ret
56 .ident "GCC: (GNU) 4.8.2"
DEFINED SYMBOLS
*ABS*:0000000000000000 ctrl.c
/tmp/ccdBCC9Q.s:2 *ABS*:000000000000003e __SP_H__
/tmp/ccdBCC9Q.s:3 *ABS*:000000000000003d __SP_L__
/tmp/ccdBCC9Q.s:4 *ABS*:000000000000003f __SREG__
/tmp/ccdBCC9Q.s:5 *ABS*:0000000000000000 __tmp_reg__
/tmp/ccdBCC9Q.s:6 *ABS*:0000000000000001 __zero_reg__
/tmp/ccdBCC9Q.s:10 .text:0000000000000000 systemCtrlInit
/tmp/ccdBCC9Q.s:23 .text:000000000000000a systemCtrlReady
/tmp/ccdBCC9Q.s:33 .text:000000000000000e systemCtrlCheckInhibit
/tmp/ccdBCC9Q.s:46 .text:0000000000000018 systemCtrlCheckTerminate
NO UNDEFINED SYMBOLS

197
firmware/dbt03.c Normal file
View File

@ -0,0 +1,197 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V2.0.0 #
# dbt03 emulator layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <avr/io.h> /* Include I/O definitions */
#include <stdbool.h> /* Include Boolean types */
#include <avr/interrupt.h> /* Include Interrupt control */
#include <util/parity.h> /* Include parity calculation functions */
#include "dbt03.h" /* Include own header file */
#include "uart.h" /* Include serial port control */
#include "delay.h" /* Include Delay control mechanisms */
#include "ctrl.h" /* Include control line handler */
/* #################################################################################### */
/* #################################################################################### */
/* Internal subroutine: Toggle display I/O pin */
static void dbt03IoCtrl(const uint8_t status)
{
if(status == 1)
PORTB |= (1 << PB0);
else
PORTB &= ~(1 << PB0);
return;
}
/* Internal subroutine: Perform 425Hz tone (as a TTL signal) */
static void dbt03Dialtone(const uint16_t cycles)
{
uint16_t i;
for(i=0; i<cycles; i++)
{
dbt03IoCtrl(0);
systemDelay100us(10);
dbt03IoCtrl(1);
systemDelay100us(10);
}
}
/* Internal subroutine: Perform 1300Hz tone (as a TTL signal) */
static void dbt03Carriertone(const uint16_t cycles)
{
uint16_t i;
for(i=0; i<cycles; i++)
{
dbt03IoCtrl(0);
systemDelay10us(38);
dbt03IoCtrl(1);
systemDelay10us(38);
}
}
/* Initalize dbt03 emulation layer */
void systemDbt03Init(void)
{
dbt03IoCtrl(1); /* Set initial state of serial output line */
DDRB |= (1 << DDB0); /* Set PB0 as output */
PORTD &= ~(1 << PD2); /* Disable pullup resistor on PB2 */
GIMSK |= (1<<INT0); /* Configure interrupt driven receiver */
MCUCR |= (1<<ISC01);
sei();
return;
}
/* Send character to the BTX-Terminal */
void systemDbt03Transmit(uint8_t character)
{
uint8_t i;
cli();
dbt03IoCtrl(1); /* Perform start bit */
systemDelay10us(DBT03_TX_BAUDRATE);
for(i=0; i<=7; i++) /* Transmit data bits */
{
dbt03IoCtrl((~character >> i) & 1);
systemDelay10us(DBT03_TX_BAUDRATE);
}
dbt03IoCtrl(0);
systemDelay10us(DBT03_TX_BAUDRATE);
sei();
return;
}
/* Receive a character from the BTX-Terminal */
uint8_t systemDbt03Receive(void)
{
uint8_t i;
uint8_t result = 0;
if(systemCtrlCheckInhibit() == 0)
{
cli();
while(((PIND >> PD2) & 1) == 1); /* Wait for incoming start bit */
systemDelay100us(DBT03_RX_BAUDRATE);
for(i=0; i<=7; i++) /* Read data bits */
{
systemDelay100us(DBT03_RX_BAUDRATE / 2);
result |= (((PIND >> PD2) & 1) << i);
systemDelay100us(DBT03_RX_BAUDRATE / 2);
}
sei();
}
return result;
}
/* Tell the BTX-Terminal that connection went ok */
void systemDbt03ConnectionOk(void)
{
systemDelay100ms(DBT03_HOOK_OFF_DELAY); /* Modem startup time (about 3s) */
dbt03Dialtone(DBT03_DAILTONE_CYCLES); /* Perform dialtone */
systemDelay100ms(DBT03_DIALIN_DELAY); /* Delay dialintime (Terminal beleves now that the modem dials) */
dbt03Dialtone(DBT03_RINGTONE_CYCLES); /* Perform ringtone */
systemDelay100ms(DBT03_POST_RINGTONE_DELAY); /* Delay aftr ringtone */
dbt03Carriertone(DBT03_CARRIERTONE_CYCLES); /* Perform carrier tone */
dbt03IoCtrl(0); /* Pull I/O line to low level */
systemDelay100ms(DBT03_POST_DIALIN_DELAY); /* Delay time after dailin */
return;
}
/* Tell the BTX-Terminal that the connection has terminated */
void systemDbt03ConnectionTerminate(void)
{
dbt03IoCtrl(1); /* Pull I/O line to high level */
while(1); /* Halt in endless loop (Terminal will cause reset of power off, so do not worry about deadlock) */
return;
}
/* Receive a character from the BTX-Terminal via interrupt and pass it through the UART */
SIGNAL(INT0_vect)
{
uint8_t i;
uint8_t result = 0;
if(systemCtrlCheckInhibit() == 1)
{
systemDelay100us(DBT03_RX_BAUDRATE/2); /* let start bit pass by and check whether it is a real start bit */
if(((PIND >> PD2) & 1) != 0)
return;
systemDelay100us(DBT03_RX_BAUDRATE / 2);
for(i=0; i<=7; i++) /* Read data bits */
{
systemDelay100us(DBT03_RX_BAUDRATE / 2);
result |= (((PIND >> PD2) & 1) << i);
systemDelay100us(DBT03_RX_BAUDRATE / 2);
}
systemDelay100us(DBT03_RX_BAUDRATE/2); /* let start bit pass by */
systemUartTransmit(result);
}
}
/* #################################################################################### */

127
firmware/dbt03.h Normal file
View File

@ -0,0 +1,127 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V2.0.0 #
# dbt03 emulator layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef DBT03_H
#define DBT03_H
/*
==OVERVIEW==
Note: Every BTX Terminal was connected to a propritary modem that that could only dial the number
of the BTX-Mainframe (PAD). The microcontroller in the modem also conained a secret that was
necessary to associate with the BTX-Mainfraime. The Modem were sealed and opening was a
punishable offence.
2 7=START (Power modem up and initaiate connection)
o 5=ED (Data receive and status report, 1200 baud, 8n1)
4 o o 5 6=SD (Data send port, 75 baud)
1 o o 3 2=E (GND)
6 o o 7
^
View at the
terminal/modem
side
The DBT03 was a V.23 modem from the BUNDESPOST (a telecommunications service in germany, now history)
to dial into the BTX (=BILDSCHIRMTEXT) system. This modem was switched on by pulling the the START
line to high. Then the modem dials automaticly and does the BTX negotiation. Then the modem reports
the connection status in a very easy way: It just takes the dialtones and hands them through as normal
TTL signals.
________________________________________________________________________________________
START ___|
___ Start bits ____
| Stop bit ___ |
V | V
_______________ ______________ ______ _ _ _ _ _ _ V _
ED ___| |||||||| ||||||| ||||||_____| |_| |_| |_| |_|.|____ And so on....
<---------------><-----><------------><-----><----><----><----><---Serial data at 1200 Baud-->
T1 T2 T3 T4 T5 T6 T7
(dialtone) (dialing) (ring)
T1: Time between modem activision and hook-off, typicaly 3s.
Configurable with DBT03_HOOK_OFF_DELAY macro.
T2: Dialtone appeareance time, a dialtone cycle is about 2,35ms long.
Number of cyceles is configurable with DBT03_DAILTONE_CYCLES
T3: Dialin delay time, time that goes by whil a real modem dials the BTX-PAD number (019 or 01910)
Typicaly it takes 4 seconds to dial that number. The dialin delay time is configurable
with DBT03_DIALIN_DELAY
T4: Ringtone appearance time, nealy the same as T2 but in this case this tone stands for
a successful dial process and tells the BTX-Terminal that the pone of the BTX-PAD is ringing.
In this emulation we assume that the BTX-PAD is fast and hooks off with the first ringtone.
The ringtone-appeareance-time is configurable with DBT03_RINGTONE_CYCLES
T5: Post ringtone delay, time between the dialtone and the carrier signal. This time can be configured
with DBT03_POST_RINGTONE_DELAY
T6: Carrier tone appereance time: The original DBT-03 modem needed about 1,6 - 1,7 ms time to detect the
carrier signal. As long as the carrier signal is not recognized the modem passes the signal through.
That is why the carrier signal is also a part of this simulation.
T7: To finish the dialin procedure the modem pulls the ED line to low level and waits some time.
This time is configurable with DBT03_POST_DIALIN_DELAY
Note: The configured values are based on some old documentation i found on the net as well as on
experiments with various types of terminals. if this does not work on your setup or if you
unhappy with the long dialin procedure you can try to tune the timing.
==CONFIGURATION== */
/* Timing configuration for serial data transmission */
#define DBT03_TX_BAUDRATE 82 /* (x10us) Should be 1200 baud/833,333us bit legth */
#define DBT03_RX_BAUDRATE 133 /* (x100us) Should be 75 baud/13,333ms bit legth */
/* Timing configuration for dialin simulation */
#define DBT03_HOOK_OFF_DELAY 30 /* (x100ms) Hook off delay time, typical 3,0s */
#define DBT03_DAILTONE_CYCLES 800 /* (x2,35ms) Dialtone appearance time */
#define DBT03_DIALIN_DELAY 40 /* (x100ms) Dailin delay time, maximum 4,3s */
#define DBT03_RINGTONE_CYCLES 200 /* (x2,35ms) Ringtone appearance time */
#define DBT03_POST_RINGTONE_DELAY 5 /* (x100ms) Time between ringtone and carrier tone */
#define DBT03_CARRIERTONE_CYCLES 2080 /* (x760us) Carrier tone appereance time */
#define DBT03_POST_DIALIN_DELAY 5 /* (x100ms) Time between successful dialin notification and transmission start */
/* ==Function set==
This proviedes a set of basic functions that emulate the typical dbt03 signals */
void systemDbt03Init(void); /* Initalize dbt03 emulation layer */
void systemDbt03Transmit(uint8_t character); /* Send character to the BTX-Terminal */
uint8_t systemDbt03Receive(void); /* Receive a character from the BTX-Terminal */
void systemDbt03ConnectionOk(void); /* Tell the BTX-Terminal that connection went ok */
void systemDbt03ConnectionTerminate(void); /* Tell the BTX-Terminal that the connection has terminated */
#endif /*DBT03_H*/
/* #################################################################################### */

355
firmware/dbt03.lst Normal file
View File

@ -0,0 +1,355 @@
1 .file "dbt03.c"
2 __SP_H__ = 0x3e
3 __SP_L__ = 0x3d
4 __SREG__ = 0x3f
5 __tmp_reg__ = 0
6 __zero_reg__ = 1
7 .text
9 dbt03IoCtrl.part.0:
10 /* prologue: function */
11 /* frame size = 0 */
12 /* stack size = 0 */
13 .L__stack_usage = 0
14 0000 C09A sbi 0x18,0
15 0002 0895 ret
18 dbt03Dialtone:
19 0004 0F93 push r16
20 0006 1F93 push r17
21 0008 CF93 push r28
22 000a DF93 push r29
23 /* prologue: function */
24 /* frame size = 0 */
25 /* stack size = 4 */
26 .L__stack_usage = 4
27 000c 8C01 movw r16,r24
28 000e C0E0 ldi r28,0
29 0010 D0E0 ldi r29,0
30 .L3:
31 0012 C017 cp r28,r16
32 0014 D107 cpc r29,r17
33 0016 01F0 breq .L6
34 0018 C098 cbi 0x18,0
35 001a 8AE0 ldi r24,lo8(10)
36 001c 00D0 rcall systemDelay100us
37 001e 00D0 rcall dbt03IoCtrl.part.0
38 0020 8AE0 ldi r24,lo8(10)
39 0022 00D0 rcall systemDelay100us
40 0024 2196 adiw r28,1
41 0026 00C0 rjmp .L3
42 .L6:
43 /* epilogue start */
44 0028 DF91 pop r29
45 002a CF91 pop r28
46 002c 1F91 pop r17
47 002e 0F91 pop r16
48 0030 0895 ret
50 .global systemDbt03Init
52 systemDbt03Init:
53 /* prologue: function */
54 /* frame size = 0 */
55 /* stack size = 0 */
56 .L__stack_usage = 0
57 0032 00D0 rcall dbt03IoCtrl.part.0
58 0034 B89A sbi 0x17,0
59 0036 9298 cbi 0x12,2
60 0038 8BB7 in r24,0x3b
61 003a 8064 ori r24,lo8(64)
62 003c 8BBF out 0x3b,r24
63 003e 85B7 in r24,0x35
64 0040 8260 ori r24,lo8(2)
65 0042 85BF out 0x35,r24
66 /* #APP */
67 ; 90 "dbt03.c" 1
68 0044 7894 sei
69 ; 0 "" 2
70 /* #NOAPP */
71 0046 0895 ret
73 .global systemDbt03Transmit
75 systemDbt03Transmit:
76 0048 0F93 push r16
77 004a 1F93 push r17