Root/prod/atusb

Source at commit 1f003f1c2100f7f3670106fd13df0eaec7a0e4e1 created 7 years 6 months ago.
By Werner Almesberger, atusb/atusb.kicad_pcb: grow RF feed trace to 1.9 mm, for 1.0 mm PCB
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        g_echo 'Press \033[7m P \033[mass if the LED blinks, \033[7m F \033[mail 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    # TRX_OFF state (transceiver pull-up/downs inactive)
43
44    # -xxxS-L- -x-----n InMM-S--
45    # T E R RSIO C
46
47    step "GPIO scan (TRX_OFF)"
48    cmd "$LOCAL_EXEC atrf-gpio -d $LOCAL_DUT \
49        HHHH0HzH.HxHxHHHh.oHHHHHHH '# TRX_OFF state (H)' \
50        0HHH0HzH.HxHxHHHh.oHHHHHHH '# test B0' \
51        H0HH0HzH.HxHxHHHh.oHHHHHHH '# test B1 (ICSP SCK)' \
52        HH0H0HzH.HxHxHHHh.oHHHHHHH '# test B2 (ICSP MOSI)' \
53        HHH00HzH.HxHxHHHh.oHHHHHHH '# test B3 (ICSP MISO)' \
54        HHHH00zH.HxHxHHHh.oHHHHHHH '# test B5' \
55        HHHH0H0H.HxHxHHHh.oHHHHHHH '# test B6 (LED, 0)' \
56        HHHH0H1H.HxHxHHHh.oHHHHHHH '# test B6 (LED, 1)' \
57        HHHH0Hz0.HxHxHHHh.oHHHHHHH '# test B7' \
58        HHHH0HzH.0xHxHHHh.oHHHHHHH '# test C0' \
59        HHHH0HzH.Hx0xHHHh.oHHHHHHH '# test C2' \
60        HHHH0HzH.HxHx0HHh.oHHHHHHH '# test C4' \
61        HHHH0HzH.HxHxH0Hh.oHHHHHHH '# test C5' \
62        HHHH0HzH.HxHxHH0h.oHHHHHHH '# test C6' \
63        HHHH0HzH.HxHxHHH1.oHHHHHHH '# test C7 (nRST_RF)' \
64        HHHH0HzH.HxHxHHHh.0HHHHHHH '# test D0 (IRQ_RF)' \
65        HHHH0HzH.HxHxHHHh.o0zHHHHH '# test D1 (nSS)' \
66        HHHH0HzH.HxHxHHHh.oH0HHHHH '# test D2 (MISO)' \
67        HHHH0HzH.HxHxHHHh.oHz0HHHH '# test D3 (MOSI)' \
68        HHHH0HzH.HxHxHHHh.oHzH0HHH '# test D4' \
69        HHHH0HzH.HxHxHHHh.oHzHH0HH '# test D5 (SCLK)' \
70        HHHH0HzH.HxHxHHHh.oHzHHH0H '# test D6' \
71        HHHH0HzH.HxHxHHHh.oHzHHHH0 '# test D7' \
72        HHHH0HzH.HxHxHHHh.oHzHHHHH '# test LED'"
73    doit
74
75    # INT
76
77    # -xxxS-L- -x-----n InMM-S--
78    # T E R RSIO C
79
80    step "GPIO scan (INT)"
81    cmd "$LOCAL_EXEC atrf-gpio -d $LOCAL_DUT \
82        xxxxxxxx.xxxxxxxx.oxxxxxxx '# reset state' \
83        0x04=1 '# IRQ_POLARITY = 1' \
84        xxxxxxxx.xxxxxxxx.hxxxxxxx '# test INT (1)' \
85        xxxxxxxx.xxxxxxxx.h0xxxxxx '# test INT (2)' \
86        xxxxxxxx.xxxxxxxx.h1xxxxxx '# restore nSEL' \
87        0x04=0 '# IRQ_POLARITY = 0' \
88        xxxxxxxx.xxxxxxxx.o1xxxxxx '# test INT again'"
89    doit
90
91    # SLP_TR
92
93    # -xxxS-L- -x-----n InMM-S--
94    # T E R RSIO C
95
96    step "GPIO scan (SLP_TR)"
97    cmd "$LOCAL_EXEC atrf-gpio -d $LOCAL_DUT \
98        02=9 delay '# enter PLL_ON' \
99        02:9/0x1f '# verify state' \
100        frame '# one-byte frame' \
101        0xf: '# clear interrupts' \
102        0xe=8 '# enable TRX_END intr' \
103        xxxxxxxx.xxxxxxxx.oxxxxxxx '# confirm INT' \
104        slp_tr delay '# send frame' \
105        xxxxxxxx.xxxxxxxx.hxxxxxxx '# check INT'"
106    doit
107
108    # nRST
109
110    step "GPIO scan (nRST)"
111    cmd "$LOCAL_EXEC atrf-gpio -d $LOCAL_DUT \
112        02:8/0x1f '# verify TRX_OFF' \
113        reset '# reset transceiver' \
114        02:0/0x1f '# verify P_ON'"
115    doit
116}
117
118
119xtal_usb()
120{
121    step "Crystal frequency"
122    cmd "$LOCAL_EXEC atrf-xtal -d $LOCAL_DUT -p $CLOCK_DRIFT_PPM"
123    expect_re ppm # we catch any problems via the exit code
124}
125
126
127begin usb.profile
128enumerate
129led
130# power ?
131gpio_usb
132identify
133xtal_usb
134spectrum
135transmit
136

Archive Download this file



interactive