PRODUCT SPECIFICATION
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
nRF401 Demo Board Kit
*(1(5$/'(6&5,37,21
This document describes the nRF401-DEMO demonstration board kit used with
Nordic VLSI’s Q5) Single chip 433MHz RF Transceiver.
Figure 1. The Q5) Demo Board kit
Q5)'(02
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
,1752'8&7,21
The Demo Board Kit for Q5)single chip 433MHz RF Transceiver, has been developed
to demonstrate the functionality of Q5) in a four-channel communication system.
The functionality and range estimates done with these demo boards will also be valid for
Q5) in both 315MHz and 433MHz.
The demo boards are designed to operate at 3-volt power supply from two AAA cells.
This document specifies the usage of the Demo Board Kit.
*(77,1*67$57('
The Demo Board Kit contains the following items:
Two Q5) Demo Boards with a 35x20mm loop antenna.
Two Q5) Demo Boards with an embedded antenna.
Demo Board Kit Documentation (this document.)
'(02%2$5''(6&5,37,21
)XQFWLRQDOLW\
In principle, the Demo Board Kit is a four-channel, half-duplex transmission system.
The Demo Boards are switched on by pressing one of the four push buttons. The boards will
remain on as long as they are in use. Five minutes after last received valid packet or last
transmitted packet, the board goes into power down modus. Then the user has to press one of
the push buttons to restart the board.
A transmission is initiated by pressing one of the four buttons on one of the Demo Boards,
and a successful transmission is indicated on the other Demo Board with light in the
corresponding LED. The Demo Board will continue to send packets as long as one or more
push buttons are pressed.
The switch marked “Continuos TX” can set the Demo Board in continuos transmit mode.
Then the Demo Board will send two packets, with short delay between, each 250ms with a
command that tells the receiver to light the next LED to the right of the previous lit LED. At
the receiver this will cause the LEDs to light in a circular pattern. If a double packet is lost,
this can be detected by observing that one LED is left out of the circle. Auto power down is
disabled during continuous transmission.
The protocol is based on the oversampling method as described in our application note
nAN400-07.
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
5)VHFWLRQ
The RF section contains Q5) device (U1) with the needed external components as shown
in Figure 2 and Figure 3.
0LFURFRQWUROOHUVHFWLRQ
The micro controller section contains a AT90S1200 micro controller (U2) with the needed
external components as shown in Figure 4.
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
R2
4.7K
0603
C3
15nF
0603
C2
820pF
0603
R3
22K
0603
PLL FILTER
REFERENCE
XC1
1
VSS
3VDD
2
FILT1
4
VCO1
5
VCO2
6
VSS
7
VDD
8VDD 13
VSS 14
ANT2 15
ANT1 16
VSS 17
PWR_UP 18
TXEN 19
XC2 20
DIN
9
DOUT
10 RF_PWR 11
CS 12
U1
nRF401
433MHz Single Chip RF Transceiver
SSOIC20
L1
22nH
0603
C4
4.7uF
1206
C6
1nF
0603
C5
100nF
0603 C7
100pF
0603
aaaaaaaa
R1
1M
0603
C1
5.6pF
0603
XTAL2
+3V
XC1 XC2
XTAL2
DIN
DOUT
TXEN Pwr_Up
C15
1,5pF
C17
8,2pF
C16
8,2pF
C18
470pF
C19
470pF
L2
22nH
L3
22nH
L4
22nH
+3V
Figure 2. Q5) Demo Board, RF section with single ended match
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
R2
4.7K
0603
C3
15nF
0603
C2
820pF
0603
R3
22K
0603
PLL FILTER
REFERENCE
A1
Lo op antenna
35x20 mm
XC1
1
VSS
3VDD
2
FILT1
4
VCO1
5
VCO2
6
VSS
7
VDD
8VDD 13
VSS 14
ANT2 15
ANT1 16
VSS 17
PWR_UP 18
TXEN 19
XC2 20
DIN
9
DOUT
10 RF_PWR 11
CS 12
U1
nRF401
433MHz Si ngl e Chip RF Transceiver
SSOIC20
L1
22nH
0603
C8
100pF
0603
C4
4.7uF
1206
C6
1nF
0603
C5
100nF
0603 C7
100pF
0603
C9
1,8pF
0603
C10
4,7pF
0603
R1
1M
0603
C1
5.6pF
0603
XTAL2
+3V
XC1 XC2
XTAL2
DIN
DOUT
TXEN Pwr_Up
Figure 3.Q5)Demo Board, RF section loop antenna
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
RESET
1
PD0
2
PD1
3
XTAL2
4
XTAL1
5
PD2 (INT0)
6
PD3
7
PD4 (T0)
8
PD5
9
GND
10 PD6 11
(AIN0) PB0 12
(AIN1) PB1 13
PB2 14
PB3 15
PB4 16
(MOSI) PB5 17
(MISO) PB6 18
(SCK) PB7 19
VCC 20
U2
AT90S1200
SOL-20
S1
3CSH9 S2
3CSH9 S3
3CSH9 S4
3CSH9
D8
SLH34YY
LED 3.0mm
Red
D7
SLH34DU
LED 3.0mm
Green
D6
SLH34MG
LED 3.0mm
Orange
D5
SLH34VR
LED 3.0mm
Yellow
R6
330K
0603
C11
100nF
0603
+3V +3V
+
C12
10uF
1206
RST
C13
22pF
0603
Xtal
4.000 MHz C14
22pF
0603
XTAL2 XTAL2 XTAL1
Button_yellow
Button_orange
Button_green
Button_red
R5
22K
0603
Red_LED
Green_LED
Orange_LED
Yellow_LED
DIN/DOUT
D1 D2 D3 D4
DOUT
DIN
TXEN
Ext_Int
SCK
MOSI
MISO
12
S5
Co
1 2
3 4
5 6
JP201
uC programing header
+3V
MOSI
MISO
SCK
1
2
J1
3V
+3V
Pwr_Up
Figure 4. Q5) Demo Board, Controller section. Common for both versions.
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
&RPSRQHQW 'HVFULSWLRQ 9DOXH
A1 Embedded antenna TCA07F
C1 Chip capacitor, ceramic 5.6pF, ±5%, 50V, NPO
C2 Chip capacitor, ceramic 820pF, ±10%, 50V, X7R
C3 Chip capacitor, ceramic 15nF, ±10%, 50V, X7R
C4 Chip capacitor, tantal 4.7uF, ±20%, 6V
C5 Chip capacitor, ceramic 100nF, ±10%, 50V, X7R
C6 Chip capacitor, ceramic 1nF, ±10%, 50V, X7R
C7 Chip capacitor, ceramic 100pF, ±5%, 50V, NPO
C11 Chip capacitor, ceramic 100nF, ±10%, 50V, X7R
C12 Chip capacitor, tantal 10uF, ±20%, 6V
C13 Chip capacitor, ceramic 22pF, ±5%, 50V, NPO
C14 Chip capacitor, ceramic 22pF, ±5%, 50V, NPO
C15 Chip capacitor, ceramic 1,5pF, ±0,1pF, 50V, NPO
C16 Chip capacitor, ceramic 8,2pF, ±0,1pF, 50V, NPO
C17 Chip capacitor, ceramic 8,2pF, ±0,1pF, 50V, NPO
C18 Chip capacitor, ceramic 470pF, ±5%, 50V, NPO
C19 Chip capacitor, ceramic 470pF, ±5%, 50V, NPO
D1 Schottkydiod BAR43
D2 Schottkydiod BAR43
D3 Schottkydiod BAR43
D4 Schottkydiod BAR43
D5 LED 3mm SLH34VR
D6 LED 3mm SLH34MG
D7 LED 3mm SLH34DU
D8 LED 3mm SLH34YY
J1 Battery 2x 1,5V AAA
L1 Chip inductor Coilcraft 0603CS-22NXGBC, PULSE PE-
0603CD220GTT, muRata LQW1608A22NG00, 22nH,
2%
L2 Chip inductor Coilcraft 0603CS-22NXGBC, PULSE PE-
0603CD220GTT, muRata LQW1608A22NG00, 22nH,
2%
L3 Chip inductor Coilcraft 0603CS-22NXGBC, PULSE PE-
0603CD220GTT, muRata LQW1608A22NG00, 22nH,
2%
L4 Chip inductor Coilcraft 0603CS-22NXGBC, PULSE PE-
0603CD220GTT, muRata LQW1608A22NG00, 22nH,
2%
R1 Resistor 1M
R2 Resistor 4.7K
R3 Resistor 22K
R5 Resistor 22K
R6 Resistor 330K
S1 Push button 3CSH9
S2 Push button 3CSH9
S3 Push button 3CSH9
S4 Push button 3CSH9
S5 Switch Cont. TX
U1 Transceiver nRF401
U2 Micro controller AT90S1200-4SI
Xtal Crystal 4.000 MHz ±45ppm
Table 1. Demo Board Component List, Embedded antenna.
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
&RPSRQHQW 'HVFULSWLRQ 9DOXH
A1 Loop antenna 35x20mm
C1 Chip capacitor, ceramic 5.6pF, ±5%, 50V, NPO
C2 Chip capacitor, ceramic 820pF, ±10%, 50V, X7R
C3 Chip capacitor, ceramic 15nF, ±10%, 50V, X7R
C4 Chip capacitor, tantal 4.7uF, ±20%, 6V
C5 Chip capacitor, ceramic 100nF, ±10%, 50V, X7R
C6 Chip capacitor, ceramic 1nF, ±10%, 50V, X7R
C7 Chip capacitor, ceramic 100pF, ±5%, 50V, NPO
C8 Chip capacitor, ceramic 100pF, ±5%, 50V, NPO
C9 Chip capacitor, ceramic 1,8pF, ±0.1pF, 50V, NPO
C10 Chip capacitor, ceramic 4,7pF, ±0.1pF, 50V, NPO
C11 Chip capacitor, ceramic 100nF, ±10%, 50V, X7R
C12 Chip capacitor, tantal 10uF, ±20%, 6V
C13 Chip capacitor, ceramic 22pF, ±5%, 50V, NPO
C14 Chip capacitor, ceramic 22pF, ±5%, 50V, NPO
D1 Schottkydiod
D2 Schottkydiod
D3 Schottkydiod
D4 Schottkydiod
D5 LED 3mm
D6 LED 3mm
D7 LED 3mm
D8 LED 3mm
J1 Battery 2x 1,5V AAA
L1 Chip inductor Coilcraft 0603CS-22NXGBC,
PULSE PE-0603CD220GTT,
muRata LQW1608A22NG00,
22nH, 2%
R1 Resistor 1M
R2 Resistor 4.7K
R3 Resistor 22K
R4 Resistor 68K
R5 Resistor 22K
R6 Resistor 330K
S1 Push button
S2 Push button
S3 Push button
S4 Push button
S5 Switch Cont. TX
U1 Transceiver nRF401
U2 Micro controller AT90S1200-4SI
Xtal Crystal 4.000 MHz ±45ppm
Table 2. Demo Board Component List, Loop antenna.
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
Top silk screen Bottom silk screen
Figure 5. Demo Board Component Placement Chart, Embedded antenna.
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
Top silk screen Bottom silk screen
Figure 6.Demo Board Component Placement Chart, Loop antenna.
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
5HIHUHQFHV
Datasheets for the nRF401: http://www.nvlsi.no/Datablad/nRF401rev1_6.pdf
Application notes: http://www.nvlsi.no/Datablad/RF-Application%20notes.htm
Nordic VLSI ASA support pages: http://www.nvlsi.no/sup/std/index.htm
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
$33(1',;
0LFURFRQWUROOHUSURJUDPOLVWLQJ
;------------------------------------------------------------------------------
; Copyright (C) 2002 Nordic VLSI ASA
;
; This software and any related documentation is provided "as is" without any
; warranty of any kind, either express or implied, including, without
; limitation, the implied warranties or merchantability, fitness for a
; particular purpose, and noninfringment. The entire risk arising out of use
; of this software remains with you.
;
; File : 401dem13.asm
; Modified : 21-03-2002
; Author : Jon Gunnar Sponås
;
; Description:
;
; This program is used to control a nRF0401 transceiver on a small demo board.
; Timer0 is used to time the sampling of the digital output from the ASIC. The
; sampling rate is three times the bit rate (given by the BR value below). The
; samples are shifted in to the "samp" variable. When three samples are read,
; the four last samples are weighted according to this table:
;
; +------+---+
; | ssss | |
; | aaaa | |
; | mmmm | r |
; | pppp | e |
; | 3210 | s |
; +------+---+
; | 0000 | 0 |
; | 0001 | 0 |
; | 0010 | 0 |
; | 0011 | 1 |
; | 0100 | 0 |
; | 0101 | 0 |
; | 0110 | 1 |
; | 0111 | 1 |
; | 1000 | 0 |
; | 1001 | 0 |
; | 1010 | 1 |
; | 1011 | 1 |
; | 1100 | 0 |
; | 1101 | 1 |
; | 1110 | 1 |
; | 1111 | 1 |
; +-----+---+
;
; The resulting bits are shifted in to a 64 bit variable given by data(7-0).
; The main loop of the program is continuously comparing data3 and data2 for
; address bytes. If a match is found the data is taken from data1 and a
; checksum (the sum of data(3-1)) in data0.
;
;----------------------------------------------------------------------------
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
;****************************************************************************
; selected AT90S1200 I/O Register Definitions
;****************************************************************************
.equ SREG = 0x3f
.equ TIMSK = 0x39
.equ GIMSK = 0x3B
.equ TCCR0 = 0x33
.equ TCNT0 = 0x32
.equ PORTB = 0x18
.equ DDRB = 0x17
.equ PORTD = 0x12
.equ DDRD = 0x11
.equ PIND = 0x10
.equ PINB = 0x16
.equ MCUCR = 0x35
;****************************************************************************
; parameters used in the program
;****************************************************************************
.equ FC=4000000 ; AVR clock frequency (Hz)
.equ BR=10000 ; bit rate
.equ DTX=5 ; # of ms before TX enable after power on
.equ TTX=1 ; # of ms before sending first bit after TX enable
.equ DEB=4 ; # of ms between two keyb. readings (debouncing)
.equ TL=255 ; # of ms before clearing LEDs
.equ TC=2 ; timer prescaler select
.equ TD=8 ; timer prescaler value
.equ TN=256-FC/(3*BR)/TD ; timer reload value
.equ TS=300000 ; # of ms before powerdown (2000ms - 16777215ms) (2 sec -
4h40min)
.equ TSH=TS/65535+1 ; sleeptimer high value
.equ TSM=(TS-TSH)/255+1 ; sleeptimer middle value
.equ TSL=TS-TSH-TSM ; sleeptimer low value
.equ S0=0xaa ; clock run in (this byte is sent first)
.equ S1=0x55 ; address, low byte (arbitrary selected)
.equ S2=0x44 ; address, high byte (arbitrary selected)
.equ NMS=3*BR/1000 ; approximate number of ticks/ms
.equ NBIT=8*8 ; # of bits in each transmission
.equ conttxdelay=130 ; #/2 of ms between each packet in continuos tx mode
;****************************************************************************
; AT90S1200 Register definitions
;****************************************************************************
.def samp =r0 ; data from RF chip is placed here for processing
.def flags =r1 ; used to save the flags in the interrupt routine
.def cntled =r2 ; used to count time before clearing LEDs
.def data2 =r3 ; address byte
.def data4 =r4 ; preamble byte
.def data5 =r5 ; preamble byte
.def data6 =r6 ; preamble byte
.def rotLED =r7
.def LEDState=r9 ; image of which LEDs that are lit
.def scount0 =r10 ; sleeptimers, increment each ms
.def scount1 =r11 ; sleeptimers, increment each 256 ms
.def scount2 =r12 ; sleeptimers, increment each 65536 ms
.def data0 =r16 ; check sum byte
.def data1 =r17 ; data byte
.def data3 =r18 ; address byte
.def data7 =r19 ; preamble byte
.def bitcnt =r20 ; count total number of samples when sending
.def state =r21 ; state register. bit0=send, bit1=inc timer
; bit2=rf transceiver is off
; bit4=toggle (0=off,1=on)
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
.def count1 =r22 ; count # of ticks in one ms
.def count2 =r23 ; counter, used for keyboard debouncing
.def countt =r24 ; count # of ms before sending after TXEN
.def tempi =r27 ; temporary variable used in interrupt routine
.def tempj =r28 ; temporary variable used in interrupt routine
.def tempm =r29 ; temporary variable used in main program
.def tempn =r30 ; temporary variable used in main program
.def waittim =r31 ; timer used to handle short breaks
;****************************************************************************
; Macro definitions
;
; Macro CLR_DATA, reset all data registers
; Macro CLR_SLEEPTIMER, reset all sleeptimers
; Macro ROL_DATA, shift all data registers logical one bit to the left
;****************************************************************************
.macro CLR_DATA
clr data0
clr data1
clr data2
clr data3
clr data4
clr data5
clr data6
clr data7
.endm
.macro CLR_SLEEPTIMER
clr scount0
clr scount1
clr scount2
.endm
.macro ROL_DATA
lsl data0
rol data1
rol data2
rol data3
rol data4
rol data5
rol data6
rol data7
.endm
;****************************************************************************
; Here does the program start
;****************************************************************************
rjmp reset ; jump to reset handler
rjmp int0 ; jump to INT0 when ext_int occurs
rjmp tim0_ovf ; timer0 overflow handler
reti ; analog comparator interrupt not used
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
;****************************************************************************
; External interrupt handler.
; Number of registers used:
; 1, tempm
; Called from:
; This routine is called when an external interrupt occurs on PORTD,2.
; Function:
; This routine is the first to be run when the microcontroller wakes
; up from POWER DOWN. It disables the external interrupt and resets the
; microcontroller.
;****************************************************************************
int0: cli
ldi tempm,0x00
out GIMSK,tempm ; disable INT0
sei
rjmp reset
reti
;****************************************************************************
; TIMER0 overflow routine:
; Number of registers used:
; 10, flags,tempi,count1,state,cntoff,cnton,count2,countt,scount0
; Called from:
; This routine is called when timer 0 flags overflow in TCNT0.
; Function:
; This routine has the responsibility of keeping track of time and timing.
; It increments all the timers each millisecond. If the state is receive
then it
; samples incoming data, and it clock bits out if the state is send.
;****************************************************************************
tim0_ovf: in flags,SREG ; save status register
ldi tempi,TN
out TCNT0,tempi ; reload timer0
cpi count1,NMS ; only increment timers once per ms
brne nocnt
clr count1
inc count2 ; increment count2
inc cntled ; increment cntled
inc countt ; increment countt
inc scount0 ; increment scount0
inc waittim ; increment waittim
nocnt: inc count1 ; increment count1 every time routine is ran
sbrs state,0 ; receive when state[0]=0, send when 1
rjmp receive
; Sending:
cpi bitcnt,3*NBIT ; all bits sent?
brne send
andi state,~0x01 ; clear sending state
rjmp tret
sret: out SREG,flags ; restore status register
reti
send: cpi bitcnt,0 ; any bits sent yet?
brne t4 ; yes, continue
cpi countt,TTX ; no, check if time to send first bit
brlo sret ; must wait before sending first bit
t4: inc tempj ; increment "sample" counter
cpi tempj,3
brne t3
clr tempj
t0: cpi data7,0x80 ; is next bit 1?
brlo t1
nop ; equalise
sbi PORTB,4 ; yes, set data out to 1
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
rjmp t2
t1: cbi PORTB,4 ; no, set data out to 0
t2: ROL_DATA ; prepare for next bit
t3: inc bitcnt
rjmp tret
;----------------------------------------------------------------------------
; Receiver subroutine
;----------------------------------------------------------------------------
receive: rjmp sleepcontr ; check if it’s time to put the card in sleep
mode
rec3: clr tempi
sbic pinb,4 ; sample incoming bit stream
sbr tempi,0b00000001
lsl samp ; make room for new bit
or samp,tempi
inc bitcnt ; increment bit count
cpi bitcnt,0x03 ; must read three bits before
brne tret ; processing
ldi bitcnt,0x00 ; clear bit count
ROL_DATA
; process data according to table above
mov tempi,samp
andi tempi,0x0f
cpi tempi,0x03
breq one
cpi tempi,0x06
brlo zero
cpi tempi,0x08
breq zero
cpi tempi,0x09
breq zero
cpi tempi,0x0c
breq zero
one: ori data0,0x01 ; it was a one
rjmp tret
zero:
tret: out SREG,flags ; restore status register
reti
;****************************************************************************
; Sleepcontroll:
; Number of registers used:
; 5, count1,tempj,scount0,scount1,scount2
; Called from:
; This routine is called from TIMER0 overflow routine.
; Function:
; This routine increment all the sleeptimers and checks if it’s time to
; put the microcontroller in POWER DOWN mode. If it’s time, it turns off
; power to the transceiver, enables external interrupt on PORTD,2 and
; goes to sleep.
;****************************************************************************
sleepcontr: cpi count1,NMS ; only check each ms
brne rec2
mov tempj, scount0 ; update sleeptimers
cpi tempj, TSL
brne rec2
inc scount1
mov tempj, scount1 ;
cpi tempj, TSM
brne rec2
inc scount2
mov tempj, scount2 ;
cpi tempj, TSH ;
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
brne rec2
CLR_SLEEPTIMER ;
sbis PIND,2 ; do not sleep if any button is pressed
rjmp rec2 ;
sbis PIND,1 ; do not sleep if PD1 and PD0 are connected
rjmp rec2 ;
cli
cbi PORTB,5 ; turn off transmitter (TXEN=0)
cbi PORTB,6 ; turn off transceiver
ldi tempj,0x40
out GIMSK,tempj ; enable INT0
ldi tempj,0x30 ; enable sleep, and set sleep mode to power
down.
out MCUCR,tempj
sei ; enable global interrupt
sleep ;
rec2: rjmp rec3
;****************************************************************************
; Sendkey:
; Number of registers used:
; 13, data0,data1,data2,data3,data4,data5,data6,data7,tempm,tempj,state,
; LEDState,bitcnt
; Called from:
; This routine is called from the Key routine.
; Function:
; This routine arranges the data packet to be send, and gives a visual
; feedback to the user by illuminating the corresponding LED on his
; board when a button is pushed.
;****************************************************************************
sendkey: cli
mov data1,tempm ; byte to send in data1
bst data1,4 ; switch bits into right place
bld data1,2 ;
bst data1,5 ;
bld data1,1 ;
bst data1,6 ;
bld data1,0 ;
andi data1,0x0f ; clear all unwanted bits
mov data0,data1 ; check sum in data0
ldi tempm,S2
mov data2,tempm
add data0,data2 ; update check sum
ldi data3,S1
add data0,data3 ; update check sum
ldi tempm,S0
mov data4,tempm ; 32 bit preamble
mov data5,tempm ;
mov data6,tempm ;
mov data7,tempm ;
clr bitcnt ; clear number of bits sent
ldi tempj,2 ; used to count # of samples in each bit
ori state,1 ; tell interrupt routine to start sending
sei ; enable interrupts
mov LEDState,data1 ; makes the Led on the transmitting board
indicate transmission
k2: sbrc state,0 ; wait until sending is finished
rjmp k2
ret
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
;****************************************************************************
; Rdkey:
; Number of registers used:
; 1, tempm
; Called from:
; This routine is called from the Key routine.
; Function:
; This routine reads the keypad, and determines if any button has been
; pushed.
;****************************************************************************
rdkey: in tempm,PIND ; read keys
andi tempm,0b01111000; remove unwanted bits
com tempm ; invert
andi tempm,0b01111000; check if any key pressed
ret
;****************************************************************************
; Key:
; Number of registers used:
; 5, count2,tempm,tempn,LEDState,countt
; Called from:
; This routine is called from the Main routine.
; Function:
; This routine calls RDKEY to detect if any buttons has been pushed.
; If so it ensures to turn the transceiver on, and puts it in transmit
; mode after a delay time. Then the sleeptimer is cleared, PORTD,0 is set
; to be an output pin, and the SENDKEY routine is called twice to send the
; data to the receiving board. Finally it puts the transceiver in receive
; mode and let PORTD,0 be an input pin again.
;****************************************************************************
key: rcall rdkey ; read keyboard
breq kret ; return if no key pressed
clr count2 ; wait a while before
k0: cpi count2,DEB ; .. reading keyboard again
brne k0
rcall rdkey ; read keyboard again
breq kret ; return if no key pressed
rcall rfon ; turn on RF transceiver
clr count2 ; wait a while before enabling
k1: cpi count2,DTX ; ...transmitter after transceiver
brne k1 ; ...is turned on
CLR_SLEEPTIMER ; Clear sleeptimers, the card has been used.
in tempn,PORTB
andi tempn,0xF0
out PORTB,tempn ; clear all LED
clr LEDState
sbi DDRB,4 ; let PORTB, pin4 be output
sbi PORTB,5 ; enable RF transmitter (TXEN=1)
clr countt ; counts # of ms before first bit is sent
mov tempn,tempm ; save value
rcall sendkey ; send
mov tempm,tempn ; restore saved value
rcall sendkey ; send again
kret: cbi PORTB,5 ; turn off RF transmitter (TXEN=0)
cbi DDRB,4 ; let PORTB, pin4 be input
ret
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
;****************************************************************************
; Conttx:
; Number of registers used:
; 5, count2,tempm,LEDState,countt, rotLED
; Called from:
; This routine is called from the Main routine.
; Function:
; This routine runs if the continuos TX button is switched on.
; The routine sends a packet each 2*conttxdelay ms.
;****************************************************************************
conttx: clr count2 ; wait a while before enabling
ct1: cpi count2,DTX ; ...transmitter after transceiver
brne ct1 ; ...is turned on
sbi DDRB,4 ; let PORTB, pin4 be output
sbi PORTB,5 ; turn on transmitter (TXEN=1)
clr countt ; counts # of ms before first bit is sent
ldi tempm,64 ;
mov rotLED,tempm ; load start value in rotLED
ct2: CLR_SLEEPTIMER ; Clear sleeptimers, the card has been used.
mov tempm,rotLED ;
mov tempn,tempm ; save value
rcall sendkey ; send
mov tempm,tempn ; restore saved value
rcall sendkey ; send again
clr waittim
lsr rotLED ; prepare next value
mov tempm,rotled
cpi tempm,8 ; check if last LED is lit
brsh ct3 ; if not, continue to ct3
ldi tempm,64 ;
mov rotLED,tempm ; load start value in rotLED
ct3: cpi tempm,32 ;\
breq LED5 ; \
cpi tempm,64 ; \
breq LED6 ; |checks what LED to be lit on the local
board cpi tempm,8 ; |
breq LED7 ; /
cpi tempm,16 ; /
breq LED8 ;/
ct4: cpi waittim, conttxdelay
brlo ct4 ; wait until it’s time for a new packet to be
send clr waittim
ct5: cpi waittim, conttxdelay
brlo ct5 ; wait until it’s time for a new packet to be
send
sbic PINB,7 ; check if cont.tx is on
rjmp conret ; return if no
rjmp ct2 ; jump to ct2 if yes.
conret: cbi DDRB,4 ; let PORTB, pin4 be input
cbi PORTB,5 ; turn off transmitter (TXEN=0)
ret
LED5: sbi PORTB,0 ; the following lines are used to light the
right cbi PORTB,1 ; LED when the board is sending continuously
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
cbi PORTB,2
cbi PORTB,3
rjmp ct4
LED6: cbi PORTB,0
cbi PORTB,1
cbi PORTB,2
sbi PORTB,3
rjmp ct4
LED7: cbi PORTB,0
cbi PORTB,1
sbi PORTB,2
cbi PORTB,3
rjmp ct4
LED8: cbi PORTB,0
sbi PORTB,1
cbi PORTB,2
cbi PORTB,3
rjmp ct4
;****************************************************************************
; Checkd:
; Number of registers used:
; 6, data0,data1,data2,data3,tempm,tempn
; Called from:
; This routine is called from the Main routine.
; Function:
; This routine check if received data is valid. That is if both address
; bytes match (found in data3 and data2) and if received check sum
; matches calculated check sum.
;****************************************************************************
checkd: clr tempm ; check sum in "tempm"
cpi data3,S1 ; check 1st byte (address, low byte)
brne cret ; address mismatch, start over
add tempm,data3 ; 1st byte match, update check sum
mov tempn,data2
cpi tempn,S2 ; check 2nd byte (address, high byte)
brne cret ; signature mismatch, start over
add tempm,data2 ; 2nd byte match, update check sum
add tempm,data1 ; data byte, update check sum
cp tempm,data0 ; compare check sum with expected value
cret: ret
;****************************************************************************
; Checkl:
; Number of registers used:
; 4, tempm,state,LEDState,cntled
; Called from:
; This routine is called from the Main routine.
; Function:
; This routine toggles the LEDs on and off to reduce power consumption,
; and determines when the LED shall be turned off after the board has
; received a valid data packet
;****************************************************************************
checkl: sbrc state,4 ; check if LED is to be toggled
rjmp ch0 ; jump to ch0 if no
in tempm,PORTB ; read LED states
andi tempm,0x0F
cpi tempm,0x01 ; check if they are lit
brlo ch1 ; jump to ch1 if not
in tempm,PORTB ; switch LEDs off if yes
andi tempm,0xF0
out PORTB,tempm
rjmp ch0
ch1: in tempm,PORTB ; switch LEDs on
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
or tempm,LEDState
out PORTB,tempm
ch0: mov tempm,cntled ; check if we must turn off LEDs
cpi tempm,TL
brne clret
in tempm,PORTB
andi tempm,0xF0 ; remove all bits that lit LEDs
out PORTB,tempm ; ... turn off LEDS
clr LEDState ; clear LEDState
cbr state,4 ; indicate LED off in state
andi state,~0x02 ; tell int. routine to stop inc. count1
clret: ret
;****************************************************************************
; Rfoff:
; Number of registers used:
; 2, state, cntoff
; Called from:
; This routine is called from Sleepcontroll.
; Function:
; This routine turns the power to the transceiver off, and reset
; the "RF is off counter"
;****************************************************************************
rfoff: cbi PORTB,5 ; turn off transmitter
cbi PORTB,4 ; set data out to zero
cbi PORTB,6 ; turn off transceiver
cli ; disable interupt
ori state,0x04 ; set bit 2 in state to one when off
sei ; enable interupt
ret
;****************************************************************************
; Rfon:
; Number of registers used:
; 2, state, cnton
; Called from:
; This routine is called from Main.
; Function:
; This routine turnes the power to the transceiver on, and reset
; the "RF is on counter"
;****************************************************************************
rfon: sbi PORTB,6 ; turn on transceiver
cli ; disable interupt
andi state,~0x04 ; set bit 2 in state to zero when on
sei ; enable interupt
ret
;****************************************************************************
; Reset:
; Number of registers used:
; 1, tempm
; Called from:
; This routine is called every time the microcontroller is powered up.
; Function:
; This routine set pull-ups and directions on IO ports, start the timer
; and prepare the registers for use.
;****************************************************************************
reset: clr state ; ensure a clear state registry
ldi tempm,0b01111110; turn on pull-ups on PORTD(1-6)
out PORTD,tempm
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
ldi tempm,0b00000001; PORTD(0) is output pin
out DDRD,tempm
ldi tempm,0b10010000; turn on pull-ups on PORTB(4,7)
out PORTB,tempm
ldi tempm,0b01101111; PORTB(0-3,5-6) are output pins (pin 4 are
bi-directional,starts as a input)
out DDRB,tempm
ldi tempm,TN ; load timer with start value
out TCNT0,tempm
ldi tempm,0x02
out TIMSK,tempm ; enable timer overflow interrupt
ldi tempm,TC
out TCCR0,tempm ; load timer divider
clr bitcnt
clr tempj
clr samp
CLR_SLEEPTIMER ; ensure clear sleep timer
sei ; enable interrupts
;****************************************************************************
; Main routine:
; Number of registers used:
; 4, LEDState, data1,cntled,state
;****************************************************************************
main: rcall rfon ; ensure that the transceiver is on
rcall checkl ; check if we shall turn off LEDs
sbis PINB,7 ; check if cont.tx is on (Continuos
transmission wnated)
rcall conttx ; jump to conttx if yes
sbic PINB,7 ; check if cont.tx is off
rcall key ; jump to keys and send if any key is pressed.
rcall checkd ; check data
brne main
m0: ori data1,0x80 ; ensure pullup @ portb, pin 7
mov LEDState,data1 ; store LED status in LEDState
sbrc state,2 ; is transceiver on?
rjmp m1 ; no
andi data1,~0xC0 ; yes, reflect that in data byte
rjmp m2
m1: ori data1,0xC0
m2: out PORTB,data1 ; check sum correct, turn on LEDS
sbr state,4 ; indicate LED on in state
ori state,0x02 ; tell int. routine to start increment count1
clr cntled ; clear timer that tells #ms before switch LED
off CLR_SLEEPTIMER
m3: CLR_DATA ; clear data bytes for next round
rjmp main ; loop forever
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
'(),1,7,216
3URGXFWVSHFLILFDWLRQ
This Demo Board Kit documentation contains final product specifications. Nordic VLSI ASA reserves the right
to make changes at any time without notice in order to improve design and supply the best possible product.
/LPLWLQJYDOXHV
Stress above one or more of the limiting values may cause permanent damage to the device. These are stress
ratings only and operation of the device at these or at any other conditions above those given in the
Specifications sections of the specification is not implied. Exposure to limiting values for extended periods may
affect device reliability.
$SSOLFDWLRQLQIRUPDWLRQ
Where application information is given, it is advisory and does not form part of the specification.
Table 2. Definitions.
Nordic VLSI ASA reserves the right to make changes without further notice to the
product to improve reliability, function or design. Nordic VLSI does not assume any
liability arising out of the application or use of any product or circuits described
herein.
/,)(6833257$33/,&$7,216
These products are not designed for use in life support appliances, devices, or systems
where malfunction of these products can reasonably be expected to result in personal
injury. Nordic VLSI ASA customers using or selling these products for use in such
applications do so at their own risk and agree to fully indemnify Nordic VLSI ASA
for any damages resulting from such improper use or sale.
Product specification. Revision Date: 22.03.2002
nRF401 Demo Board Kit order code: 220302-nRF401-DEMO
All rights reserved ®. Reproduction in whole or in part is prohibited without the prior
written permission of the copyright holder.
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Nordic VLSI ASA - Vestre Rosten 81, N-7075 Tiller, Norway - Phone +4772898900 - Fax +4772898989
Revision: 1 .0
3DJHRI
March 2002
<285127(
PRODUCT SPECIFICATION
Q5)'HPR%RDUG.LW
Revision 1.0
3DJHRI
March 2002
1RUGLF9/6,$6$±:RUOG:LGH'LVWULEXWRUV
)RU<RXUQHDUHVWGHDOHUSOHDVHVHHKWWSZZZQYOVLQR
0DLQ2IILFH
Vestre Rosten 81, N-7075 Tiller, Norway
Phone: +47 72 89 89 00, Fax: +47 72 89 89 89
(PDLOQ5)#QYOVLQR
9LVLWWKH1RUGLF9/6,$6$ZHEVLWHDWKWW
S
ZZZQYOVLQR