PRODUCT SPECIFICATION Q5)'(02 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 Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW ,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. Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW 5)VHFWLRQ The RF section contains Q5) device (U1) with the needed external components as shown in Figure 2 and Figure 3. 0LFURFRQWUROOHUVHFWLRQ The micro controller section contains a AT90S1200 micro controller (U2) with the needed external components as shown in Figure 4. Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW +3V XTAL2 C4 4.7uF 1206 C1 XTAL2 R1 5.6pF 0603 1M 0603 REFERENCE XC1 XC2 C17 8,2pF U1 C3 15nF 0603 C2 820pF 0603 L1 22nH 0603 R2 4.7K 0603 C5 100nF 0603 C6 1nF 0603 DIN DOUT 1 2 3 4 5 6 7 8 9 10 XC1 VDD VSS FILT1 VCO1 VCO2 VSS VDD DIN DOUT XC2 TXEN PWR_UP VSS ANT1 ANT2 VSS VDD CS RF_PWR nRF401 433MHz Single Chip RF Transceiver SSOIC20 20 19 18 17 16 15 14 13 12 11 C18 TXEN L3 22nH Pwr_Up C15 1,5pF 470pF L2 22nH aaaaaaaa +3V R3 22K 0603 C7 100pF 0603 C16 8,2pF L4 22nH C19 470pF PLL FILTER Figure 2. Q5) Demo Board, RF section with single ended match Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW +3V C1 XTAL2 XTAL2 C4 4.7uF 1206 R1 5.6pF 0603 1M 0603 REFERENCE XC1 XC2 U1 C3 15nF 0603 C2 820pF 0603 L1 22nH 0603 R2 4.7K 0603 C5 100nF 0603 C6 1nF 0603 DIN DOUT 1 2 3 4 5 6 7 8 9 10 XC1 VDD VSS FILT1 VCO1 VCO2 VSS VDD DIN DOUT XC2 TXEN PWR_UP VSS ANT1 ANT2 VSS VDD CS RF_PWR nRF401 433MHz Single Chip RF Transceiver SSOIC20 20 19 18 17 16 15 14 13 12 11 TXEN C9 1,8pF 0603 Pwr_Up C8 100pF 0603 R3 22K 0603 PLL FILTER C7 100pF 0603 C10 4,7pF 0603 A1 Loop antenna 35x20 mm Figure 3.Q5)Demo Board, RF section loop antenna Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW SCK MISO +3V JP201 1 3 5 2 4 6 MOSI uC programing header +3V +3V C12 10uF 1206 R6 330K 0603 RST + DIN R5 C11 0603 100nF DOUT 22K 0603 U2 D2 D3 D4 Button_red Button_green VCC (SCK) PB7 (MISO) PB6 (MOSI) PB5 PB4 PB3 PB2 (AIN1) PB1 (AIN0) PB0 PD6 20 19 18 17 16 15 14 13 12 11 SCK MISO MOSI DIN/DOUT Red_LED Green_LED Orange_LED Yellow_LED Pwr_Up TXEN 1 D1 RESET PD0 PD1 XTAL2 XTAL1 PD2 (INT0) PD3 PD4 (T0) PD5 GND D5 XTAL2 XTAL2 C13 22pF 0603 S3 3CSH9 D8 SLH34VR SLH34MG SLH34DU SLH34YY LED 3.0mm LED 3.0mm LED 3.0mm LED 3.0mm Yellow Orange Green Red Button_yellow S2 3CSH9 D7 S5 Co Button_orange S1 3CSH9 D6 AT90S1200 SOL-20 2 Ext_Int 1 2 3 4 5 6 7 8 9 10 S4 3CSH9 XTAL1 Xtal 4.000 MHz +3V C14 22pF 0603 J1 2 1 3V Figure 4. Q5) Demo Board, Controller section. Common for both versions. Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW &RPSRQHQW A1 C1 C2 C3 C4 C5 C6 C7 C11 C12 C13 C14 C15 C16 C17 C18 C19 D1 D2 D3 D4 D5 D6 D7 D8 J1 L1 'HVFULSWLRQ Embedded antenna Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, tantal Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, tantal Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Schottkydiod Schottkydiod Schottkydiod Schottkydiod LED 3mm LED 3mm LED 3mm LED 3mm Battery Chip inductor L2 Chip inductor L3 Chip inductor L4 Chip inductor R1 R2 R3 R5 R6 S1 S2 S3 S4 S5 U1 U2 Xtal Resistor Resistor Resistor Resistor Resistor Push button Push button Push button Push button Switch Transceiver Micro controller Crystal 9DOXH TCA07F 5.6pF, 5%, 50V, NPO 820pF, 10%, 50V, X7R 15nF, 10%, 50V, X7R 4.7uF, 20%, 6V 100nF, 10%, 50V, X7R 1nF, 10%, 50V, X7R 100pF, 5%, 50V, NPO 100nF, 10%, 50V, X7R 10uF, 20%, 6V 22pF, 5%, 50V, NPO 22pF, 5%, 50V, NPO 1,5pF, 0,1pF, 50V, NPO 8,2pF, 0,1pF, 50V, NPO 8,2pF, 0,1pF, 50V, NPO 470pF, 5%, 50V, NPO 470pF, 5%, 50V, NPO BAR43 BAR43 BAR43 BAR43 SLH34VR SLH34MG SLH34DU SLH34YY 2x 1,5V AAA Coilcraft 0603CS-22NXGBC, PULSE PE0603CD220GTT, muRata LQW1608A22NG00, 22nH, 2% Coilcraft 0603CS-22NXGBC, PULSE PE0603CD220GTT, muRata LQW1608A22NG00, 22nH, 2% Coilcraft 0603CS-22NXGBC, PULSE PE0603CD220GTT, muRata LQW1608A22NG00, 22nH, 2% Coilcraft 0603CS-22NXGBC, PULSE PE0603CD220GTT, muRata LQW1608A22NG00, 22nH, 2% 1M 4.7K 22K 22K 330K 3CSH9 3CSH9 3CSH9 3CSH9 Cont. TX nRF401 AT90S1200-4SI 4.000 MHz 45ppm Table 1. Demo Board Component List, Embedded antenna. Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW &RPSRQHQW A1 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 D1 D2 D3 D4 D5 D6 D7 D8 J1 L1 'HVFULSWLRQ Loop antenna Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, tantal Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, ceramic Chip capacitor, tantal Chip capacitor, ceramic Chip capacitor, ceramic Schottkydiod Schottkydiod Schottkydiod Schottkydiod LED 3mm LED 3mm LED 3mm LED 3mm Battery Chip inductor 9DOXH 35x20mm 5.6pF, 5%, 50V, NPO 820pF, 10%, 50V, X7R 15nF, 10%, 50V, X7R 4.7uF, 20%, 6V 100nF, 10%, 50V, X7R 1nF, 10%, 50V, X7R 100pF, 5%, 50V, NPO 100pF, 5%, 50V, NPO 1,8pF, 0.1pF, 50V, NPO 4,7pF, 0.1pF, 50V, NPO 100nF, 10%, 50V, X7R 10uF, 20%, 6V 22pF, 5%, 50V, NPO 22pF, 5%, 50V, NPO R1 R2 R3 R4 R5 R6 S1 S2 S3 S4 S5 U1 U2 Xtal Resistor Resistor Resistor Resistor Resistor Resistor Push button Push button Push button Push button Switch Transceiver Micro controller Crystal 1M 4.7K 22K 68K 22K 330K 2x 1,5V AAA Coilcraft 0603CS-22NXGBC, PULSE PE-0603CD220GTT, muRata LQW1608A22NG00, 22nH, 2% Cont. TX nRF401 AT90S1200-4SI 4.000 MHz 45ppm Table 2. Demo Board Component List, Loop antenna. Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW Top silk screen Bottom silk screen Figure 5. Demo Board Component Placement Chart, Embedded antenna. Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW Top silk screen Bottom silk screen Figure 6.Demo Board Component Placement Chart, Loop antenna. Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW 5HIHUHQFHV Datasheets for the nRF401: Application notes: Nordic VLSI ASA support pages: Nordic VLSI ASA Revision: 1.0 - http://www.nvlsi.no/Datablad/nRF401rev1_6.pdf http://www.nvlsi.no/Datablad/RF-Application%20notes.htm http://www.nvlsi.no/sup/std/index.htm Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW $33(1',; 0LFURFRQWUROOHUSURJUDPOLVWLQJ ;-----------------------------------------------------------------------------; 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 Sponas ; ; 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. ; ;---------------------------------------------------------------------------- Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW ;**************************************************************************** ; 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 .def .def .def LEDState=r9 scount0 =r10 scount1 =r11 scount2 =r12 ; ; ; ; image of which LEDs that are lit sleeptimers, increment each ms sleeptimers, increment each 256 ms sleeptimers, increment each 65536 ms .def .def .def .def .def .def data0 data1 data3 data7 bitcnt state ; ; ; ; ; ; ; ; check sum byte data byte address byte preamble byte count total number of samples when sending state register. bit0=send, bit1=inc timer bit2=rf transceiver is off bit4=toggle (0=off,1=on) Nordic VLSI ASA Revision: 1.0 =r16 =r17 =r18 =r19 =r20 =r21 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW .def .def .def count1 count2 countt =r22 =r23 =r24 ; count # of ticks in one ms ; counter, used for keyboard debouncing ; count # of ms before sending after TXEN .def .def .def .def .def tempi tempj tempm tempn waittim =r27 =r28 =r29 =r30 =r31 ; ; ; ; ; temporary variable used in temporary variable used in temporary variable used in temporary variable used in timer used to handle short interrupt routine interrupt routine main program main program 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 clr clr .endm CLR_SLEEPTIMER scount0 scount1 scount2 .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 rjmp rjmp reti Nordic VLSI ASA Revision: 1.0 reset int0 tim0_ovf - ; ; ; ; jump to reset handler jump to INT0 when ext_int occurs timer0 overflow handler analog comparator interrupt not used Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW ;**************************************************************************** ; 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: t4: t0: Nordic VLSI ASA Revision: 1.0 cpi brne cpi brlo inc cpi brne clr cpi brlo nop sbi - bitcnt,0 t4 countt,TTX sret tempj tempj,3 t3 tempj data7,0x80 t1 PORTB,4 ; ; ; ; ; any bits sent yet? yes, continue no, check if time to send first bit must wait before sending first bit increment "sample" counter ; is next bit 1? ; equalise ; yes, set data out to 1 Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW t1: t2: t3: rjmp t2 cbi PORTB,4 ROL_DATA inc bitcnt rjmp tret ; no, set data out to 0 ; prepare for next bit ;---------------------------------------------------------------------------; 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 ; Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW brne rec2 CLR_SLEEPTIMER sbis PIND,2 rjmp rec2 sbis PIND,1 rjmp rec2 cli cbi PORTB,5 cbi PORTB,6 ldi tempj,0x40 out GIMSK,tempj ldi tempj,0x30 ; ; do not sleep if any button is pressed ; ; do not sleep if PD1 and PD0 are connected ; ; turn off transmitter (TXEN=0) ; turn off transceiver ; enable INT0 ; enable sleep, and set sleep mode to power down. rec2: out sei sleep rjmp MCUCR,tempj ; enable global interrupt ; 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: Nordic VLSI ASA Revision: 1.0 sbrc rjmp ret - state,0 k2 ; wait until sending is finished Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW ;**************************************************************************** ; 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 andi com andi ret tempm,PIND ; tempm,0b01111000; tempm ; tempm,0b01111000; read keys remove unwanted bits invert check if any key pressed ;**************************************************************************** ; 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: k1: kret: Nordic VLSI ASA Revision: 1.0 cpi brne rcall breq rcall clr count2,DEB k0 rdkey kret rfon count2 ; .. reading keyboard again ; ; ; ; read keyboard again return if no key pressed turn on RF transceiver wait a while before enabling cpi count2,DTX brne k1 CLR_SLEEPTIMER in tempn,PORTB andi tempn,0xF0 out PORTB,tempn clr LEDState sbi DDRB,4 sbi PORTB,5 clr countt mov tempn,tempm rcall sendkey mov tempm,tempn rcall sendkey ; ...transmitter after transceiver ; ...is turned on ; Clear sleeptimers, the card has been used. cbi cbi ret ; turn off RF transmitter (TXEN=0) ; let PORTB, pin4 be input PORTB,5 DDRB,4 - ; clear all LED ; ; ; ; ; ; ; let PORTB, pin4 be output enable RF transmitter (TXEN=1) counts # of ms before first bit is sent save value send restore saved value send again Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW ;**************************************************************************** ; 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: ct1: ct2: ct3: clr cpi brne sbi sbi clr ldi mov count2 count2,DTX ct1 DDRB,4 PORTB,5 countt tempm,64 rotLED,tempm ; ; ; ; ; ; ; ; wait a while before enabling ...transmitter after transceiver ...is turned on let PORTB, pin4 be output turn on transmitter (TXEN=1) counts # of ms before first bit is sent load start value in rotLED CLR_SLEEPTIMER ; Clear sleeptimers, the card has been used. mov mov rcall mov rcall clr lsr mov cpi brsh ldi mov tempm,rotLED tempn,tempm sendkey tempm,tempn sendkey waittim rotLED tempm,rotled tempm,8 ct3 tempm,64 rotLED,tempm ; ; ; ; ; cpi breq cpi breq tempm,32 LED5 tempm,64 LED6 ;\ ; \ ; \ ; |checks what LED to be lit on the local cpi breq cpi breq tempm,8 LED7 tempm,16 LED8 ; | ; / ; / ;/ cpi brlo waittim, conttxdelay ct4 ; wait until it's time for a new packet to be clr waittim cpi brlo waittim, conttxdelay ct5 ; wait until it's time for a new packet to be sbic rjmp rjmp cbi cbi ret PINB,7 conret ct2 DDRB,4 PORTB,5 ; ; ; ; ; sbi PORTB,0 ; the following lines are used to light the cbi PORTB,1 ; LED when the board is sending continuously save value send restore saved value send again ; prepare next value ; check if last LED is lit ; if not, continue to ct3 ; ; load start value in rotLED board ct4: send ct5: send conret: LED5: right Nordic VLSI ASA Revision: 1.0 - check if cont.tx is on return if no jump to ct2 if yes. let PORTB, pin4 be input turn off transmitter (TXEN=0) Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW 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 Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW ch0: clret: or out mov cpi brne in andi out clr cbr andi ret tempm,LEDState PORTB,tempm tempm,cntled tempm,TL clret tempm,PORTB tempm,0xF0 PORTB,tempm LEDState state,4 state,~0x02 ; check if we must turn off LEDs ; ; ; ; ; remove all bits that lit LEDs ... turn off LEDS clear LEDState indicate LED off in state tell int. routine to stop inc. count1 ;**************************************************************************** ; 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: Nordic VLSI ASA Revision: 1.0 clr ldi out state ; ensure a clear state registry tempm,0b01111110; turn on pull-ups on PORTD(1-6) PORTD,tempm - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW ldi tempm,0b00000001; out DDRD,tempm ldi tempm,0b10010000; out PORTB,tempm ldi tempm,0b01101111; bi-directional,starts as a input) out DDRB,tempm ldi tempm,TN ; out TCNT0,tempm ldi tempm,0x02 out TIMSK,tempm ; ldi tempm,TC out TCCR0,tempm ; clr bitcnt clr tempj clr samp CLR_SLEEPTIMER ; sei ; PORTD(0) is output pin turn on pull-ups on PORTB(4,7) PORTB(0-3,5-6) are output pins (pin 4 are load timer with start value enable timer overflow interrupt load timer divider ensure clear sleep timer 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 Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW '(),1,7,216 3URGXFWVSHFLILFDWLRQ 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. /LPLWLQJYDOXHV 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. $SSOLFDWLRQLQIRUPDWLRQ 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 (R). Reproduction in whole or in part is prohibited without the prior written permission of the copyright holder. Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW <285127( Nordic VLSI ASA Revision: 1.0 - Vestre Rosten 81, N-7075 Tiller, Norway 3DJHRI - Phone +4772898900 - Fax +4772898989 March 2002 PRODUCT SPECIFICATION Q5)'HPR%RDUG.LW 1RUGLF9/6,$6$:RUOG:LGH'LVWULEXWRUV )RU