jig: sync with nearly-final version

This is nearly the final version of the factory test jig.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2019-05-26 13:31:36 +08:00
parent 337e1a370c
commit 18178e4a71
6 changed files with 154 additions and 15 deletions

View File

@ -4,3 +4,23 @@ Install wiringpi to get the `gpio` command:
``` ```
apt install wiringpi apt install wiringpi
``` ```
There are five LEDs on the front. The indicate which subsystems work.
1: An error occurred
2: Test Error
3: Test Error
4: Test Error
5: Tester is IDLE (also, tester is READY)
LEDs 2, 3, and 4 form a pattern that indicate which test failed:
Test name | 2 (Green) | 3 (Blue) | 4 (White) | Reason for Failure |
====================+===========+===========+===========+====================+
SPI Valid | | x | x | The SPI flash was not found, or was not the correct model |
USB Communication | x | | | The FPGA isn't assembled correctly, the USB pullup isn't correct, or the crystal is bad |
Load Test Bitstream | | | | The FPGA isn't assembled correctly |
Test SPI | | x | | Not all four wires are connected between the FPGA and the SPI |
Test RGB | x | x | | TOUCH2 or the RGB LED are not assembled correctly |
Test Touch | | x | x | TOUCH1, TOUCH3, or TOUCH4 are not assembled correctly |
Final Bitstream | | | x | The final program could not be loaded |

View File

@ -1,13 +1,17 @@
#!/bin/sh #!/bin/sh
green_led=11 led_1=19
yellow_led=9 led_2=13
red_led=10 led_3=6
led_4=5
led_5=0
all_off() { all_off() {
gpio -g write ${green_led} 0 gpio -g write ${led_1} 0
gpio -g write ${yellow_led} 0 gpio -g write ${led_2} 0
gpio -g write ${red_led} 0 gpio -g write ${led_3} 0
gpio -g write ${led_4} 0
gpio -g write ${led_5} 0
} }
green_on() { green_on() {
@ -29,11 +33,49 @@ red_also_on() {
gpio -g write ${red_led} 1 gpio -g write ${red_led} 1
} }
led_on() {
case $1 in
1) gpio -g write ${led_1} on ;;
2) gpio -g write ${led_2} on ;;
3) gpio -g write ${led_3} on ;;
4) gpio -g write ${led_4} on ;;
5) gpio -g write ${led_5} on ;;
esac
}
led_off() {
case $1 in
1) gpio -g write ${led_1} off ;;
2) gpio -g write ${led_2} off ;;
3) gpio -g write ${led_3} off ;;
4) gpio -g write ${led_4} off ;;
5) gpio -g write ${led_5} off ;;
esac
}
gpio_setup() { gpio_setup() {
gpio -g mode ${green_led} out gpio -g mode ${led_1} out
gpio -g mode ${yellow_led} out gpio -g mode ${led_2} out
gpio -g mode ${red_led} out gpio -g mode ${led_3} out
green_on gpio -g mode ${led_4} out
gpio -g mode ${led_5} out
all_off
led_on 5
}
fail_test() {
case $1 in
load-tester-bitstream) ;;
run-all-tests) led_on 2 ;;
validate-spi) led_on 3 ; led_on 4 ;;
test-spi) led_on 3 ;;
test-rgbg) led_on 2 ; led_on 3 ;;
test-rgbb) led_on 2 ; led_on 3 ;;
test-rgbr) led_on 2 ; led_on 3 ;;
test-touch) led_on 3 ; led_on 4 ;;
load-final-bitstream) led_on 4 ;;
verify-final-bitstream) led_on 4 ;;
esac
} }
gpio_setup gpio_setup
@ -43,21 +85,29 @@ while read line
do do
if echo "${line}" | grep -iq '^start' if echo "${line}" | grep -iq '^start'
then then
yellow_on all_off
failures=0
elif echo "${line}" | grep -iq '^fail' elif echo "${line}" | grep -iq '^fail'
then then
red_also_on if [ $failures -ne 1 ]
then
failures=1
fail_test $(echo "${line}" | awk '{print $2}')
fi
led_on 1
elif echo "${line}" | grep -iq '^finish' elif echo "${line}" | grep -iq '^finish'
then then
led_on 5
result=$(echo ${line} | awk '{print $3}') result=$(echo ${line} | awk '{print $3}')
if [ ${result} -ge 200 -a ${result} -lt 300 ] if [ ${result} -ge 200 -a ${result} -lt 300 ]
then then
green_on led_on 5
else else
red_on led_on 1
fi fi
elif echo "${line}" | grep -iq '^exit' elif echo "${line}" | grep -iq '^exit'
then then
all_off
exit 0 exit 0
fi fi
done done

41
jig/bin/validate-spi.sh Normal file
View File

@ -0,0 +1,41 @@
#!/bin/sh
infofile=/tmp/spi-info.txt
rm -f $infofile
fomu-flash -i | tee $infofile
# Manufacturer ID: Macronix (c2)
# Memory model: MX25R1635F (28)
# Memory size: 16 Mbit (15)
# Device ID: 15
error_count=0
if ! grep -q 'Manufacturer ID: Macronix (c2)' $infofile
then
echo -n "Unrecognized SPI manufacturer: "
grep 'Manufacturer ID: ' $infofile
error_count=$(($error_count+1))
fi
if ! grep -q 'Memory model: MX25R1635F (28)' $infofile
then
echo -n "Unrecognized memory model: "
grep 'Memory model: ' $infofile
error_count=$(($error_count+1))
fi
if ! grep -q 'Memory size: 16 Mbit (15)' $infofile
then
echo -n "Unrecognized memory size: "
grep 'Memory size: ' $infofile
error_count=$(($error_count+1))
fi
if ! grep -q 'Device ID: 15' $infofile
then
echo -n "Unrecognized device id: "
grep 'Device ID: ' $infofile
error_count=$(($error_count+1))
fi
exit $error_count

View File

@ -1,5 +1,6 @@
[Test] [Test]
ExecStart=fomu-flash -f evt-tester-bitstream.bin ExecStart=fomu-flash -f pvt-tester-bitstream.bin
Name=Load Tester Bitstream Name=Load Tester Bitstream
Description=Use fomu-flash to load the tester bitstream Description=Use fomu-flash to load the tester bitstream
Requires=validate-spi
Timeout=1 Timeout=1

View File

@ -0,0 +1,5 @@
[Test]
ExecStart=./validate-spi.sh
Name=Validate SPI
Description=Validate that the SPI part number is what we expect
Timeout=1

22
jig/exclave.service Normal file
View File

@ -0,0 +1,22 @@
# copy this file to /etc/systemd/system
# then run:
# sudo systemctl start exclave
# sudo systemctl stop exclave
# sudo systemctl enable exclave
[Unit]
Description=Exclave tester automation framework service
After=network.target
After=systemd-user-sessions.service
[Service]
User=pi
ExecStart=/home/pi/code/netv2-tests/run_exclave.sh
#Restart=always
#TimeoutSec=60 # I have no idea how to tell systemd the script has started...
#RestartSec=10
#StartTimeLimitInterval=60
#StartLimitBurst=10
[Install]
WantedBy=multi-user.target