Root/prod/atusb

Source at commit ba6dd86b2453d6e9ed550a22ce2b08590c4e3953 created 9 years 3 months ago.
By Werner Almesberger, prod/atusb (led): added the LED test
1#!/bin/sh
2
3. ./Common
4
5
6USB_ID=20b7:1540
7CLOCK_DRIFT_PPM=50
8
9
10enumerate()
11{
12    step "Enumeration"
13    cmd "usbwait -t 5 $USB_ID && echo okay"
14    expect okay
15}
16
17
18led()
19{
20#
21# BBBBBBBB CCCCCCCC DDDDDDDD
22# 01234567 01234567 01234567
23#
24# -xxxS-L- -x-----n InMM-S--
25# T E R RSIO C
26#
27    step "LED"
28    cmd "echo >/dev/tty; \
29        echo 'Press [P]ass if the LED blinks, [F]ail if not' \
30          >/dev/tty; \
31        atrf-gpio -c -p \
32                xxxxxx1x.xxxxxxxx.xxxxxxxx \
33        delay=50 \
34                xxxxxx0x.xxxxxxxx.xxxxxxxx \
35        delay=200"
36    doit
37}
38
39
40gpio_usb()
41{
42    # P_ON state (after reset; transceiver pull-up/downs active)
43
44#
45# BBBBBBBB CCCCCCCC DDDDDDDD
46# 01234567 01234567 01234567
47#
48# -xxxS-L- -x-----n InMM-S--
49# T E R RSIO C
50#
51# Pull in P_ON v ^ -^-v v
52#
53
54    step "GPIO scan (P_ON)"
55    cmd "$LOCAL_EXEC atrf-gpio -d $LOCAL_DUT -p \
56        HHHHoHxH.HxHxHxHh.ohzoHoHH '# reset state (H)' \
57        HHHH0HxH.HxHxHxHh.ohzoHoHH '# test SLP_TR (0)' \
58        HHHHoH0H.HxHxHxHh.ohzoHoHH '# test LED (0)' \
59        HHHHoHxH.HxHxHxHh.LhzoHoHH '# test IRQ_RF (0)' \
60        HHHHoHxH.HxHxHxHh.o0zoHoHH '# test nSEL (0)' \
61        HHHHoHxH.HxHxHxHh.ohz0HoHH '# test MOSI (0)' \
62        HHHHoHxH.HxHxHxHh.ohzoH0HH '# test SCLK (0)' \
63        0000o0x0.0x0x0x0h.ohzo0o00 '# reset state (0)' \
64        000010x0.0x0x0x0h.ohzo0o00 '# test SLP_TR (1)' \
65        0000o010.0x0x0x0h.ohzo0o00 '# test LED (1)' \
66        0000o0x0.0x0x0x0h.o1zo0o00 '# test nSEL (1)' \
67        0000o0x0.0x0x0x0h.ohz10o00 '# test MOSI (1)' \
68        0000o0x0.0x0x0x0h.ohzo0100 '# test SCLK (1)'"
69    doit
70
71    # TRX_OFF state (transceiver pull-up/downs inactive)
72
73    # -xxxS-L- -x-----n InMM-S--
74    # T E R RSIO C
75
76    step "GPIO scan (TRX_OFF)"
77    cmd "$LOCAL_EXEC atrf-gpio -d $LOCAL_DUT \
78        HHHH0HzH.HxHxHxHh.oHzHHHHH '# TRX_OFF state (H)' \
79        HHHH0H0H.HxHxHxHh.oHzHHHHH '# test LED' \
80        HHHH0HzH.HxHxHxHh.o0zHHHHH '# test nSEL' \
81        HHHH0HzH.HxHxHxHh.oHz0HHHH '# test MOSI' \
82        HHHH0HzH.HxHxHxHh.oHzHH0HH '# test SCLK'"
83    doit
84
85    # INT
86
87    # -xxxS-L- -x-----n InMM-S--
88    # T E R RSIO C
89
90    step "GPIO scan (INT)"
91    cmd "$LOCAL_EXEC atrf-gpio -d $LOCAL_DUT -p \
92        xxxxxxxx.xxxxxxxx.oxxxxxxx '# reset state' \
93        0x04=1 '# IRQ_POLARITY = 1' \
94        xxxxxxxx.xxxxxxxx.hxxxxxxx '# test INT (1)' \
95        xxxxxxxx.xxxxxxxx.h0xxxxxx '# test INT (2)' \
96        xxxxxxxx.xxxxxxxx.h1xxxxxx '# restore nSEL' \
97        0x04=0 '# IRQ_POLARITY = 0' \
98        xxxxxxxx.xxxxxxxx.o1xxxxxx '# test INT again'"
99    doit
100
101    # SLP_TR
102
103    # -xxxS-L- -x-----n InMM-S--
104    # T E R RSIO C
105
106    step "GPIO scan (SLP_TR)"
107    cmd "$LOCAL_EXEC atrf-gpio -d $LOCAL_DUT \
108        02=9 delay '# enter PLL_ON' \
109        02:9/0x1f '# verify state' \
110        frame '# one-byte frame' \
111        0xf: '# clear interrupts' \
112        0xe=8 '# enable TRX_END intr' \
113        xxxxxxxx.xxxxxxxx.oxxxxxxx '# confirm INT' \
114        slp_tr delay '# send frame' \
115        xxxxxxxx.xxxxxxxx.hxxxxxxx '# check INT'"
116    doit
117
118    # nRST
119
120    step "GPIO scan (nRST)"
121    cmd "$LOCAL_EXEC atrf-gpio -d $LOCAL_DUT \
122        02:8/0x1f '# verify TRX_OFF' \
123        reset '# reset transceiver' \
124        02:0/0x1f '# verify P_ON'"
125    doit
126}
127
128
129xtal_usb()
130{
131    step "Crystal frequency"
132    cmd "$LOCAL_EXEC atrf-xtal -d $LOCAL_DUT -p $CLOCK_DRIFT_PPM"
133    expect_re ppm # we catch any problems via the exit code
134}
135
136
137begin usb.profile
138enumerate
139led
140# power ?
141gpio_usb
142identify
143xtal_usb
144spectrum
145transmit
146

Archive Download this file



interactive