Perhaps I'm misunderstanding something, but it seems that IOPlus V4 card does not properly count falling edges. I've written a small test script which I run with the test cable installed on the OPTO 5-8 end of the card. The card is installed on a Pi 5-8GB and has the latest firmware installed (Hardware 04.00, Firmware 01.33, CPU temperature 31 C, voltage 3.31 V) . IOPlus software version is v1.3.6.
The script commands and output are listed here:
#!/bin/bash -v
#
# Test rising edges
ioplus 0 optcntrst 5; ioplus 0 optcntrd 5 # clear/display OPTO 5 counter
0
ioplus 0 optedgewr 5 1; ioplus 0 optedgerd 5 # set OPTO 5 to count rising edges only and display
1
ioplus 0 optcntrd 5 # display counter - should be 0
0
ioplus 0 iotest 3 # run 1 test pass
Relay 5 to OPTO 5...PASS
Relay 6 to OPTO 6...PASS
Relay 7 to OPTO 7...PASS
Relay 8 to OPTO 8...PASS
OD 4 to OPTO 5...PASS
OD 3 to OPTO 6...PASS
OD 2 to OPTO 7...PASS
OD 1 to OPTO 8...PASS
ioplus 0 optcntrd 5 # display counter - should be 2 rising edges
2 # Right!
#
# Test falling edges
ioplus 0 optcntrst 5; ioplus 0 optcntrd 5 # clear/display OPTO 5 counter
0
ioplus 0 optedgewr 5 2; ioplus 0 optedgerd 5 # set OPTO 5 to count falling edges only and display
2
ioplus 0 optcntrd 5 # display counter - should be 0
0
ioplus 0 iotest 3 # run 1 test pass
Relay 5 to OPTO 5...PASS
Relay 6 to OPTO 6...PASS
Relay 7 to OPTO 7...PASS
Relay 8 to OPTO 8...PASS
OD 4 to OPTO 5...PASS
OD 3 to OPTO 6...PASS
OD 2 to OPTO 7...PASS
OD 1 to OPTO 8...PASS
ioplus 0 optcntrd 5 # display counter - should be 2 falling edges
0 # Wrong!
#
# Test both edges
ioplus 0 optcntrst 5; ioplus 0 optcntrd 5 # clear/display OPTO 5 counter
0
ioplus 0 optedgewr 5 3; ioplus 0 optedgerd 5 # set OPTO 5 to count both edges only and display
3
ioplus 0 optcntrd 5 # display counter - should be 0
0
ioplus 0 iotest 3 # run 1 test pass
Relay 5 to OPTO 5...PASS
Relay 6 to OPTO 6...PASS
Relay 7 to OPTO 7...PASS
Relay 8 to OPTO 8...PASS
OD 4 to OPTO 5...PASS
OD 3 to OPTO 6...PASS
OD 2 to OPTO 7...PASS
OD 1 to OPTO 8...PASS
ioplus 0 optcntrd 5 # display counter - should be 4 edges counted
2 # Wrong!
exit
It appears to not count any falling edges. I've also tried other OPTO inputs which fail the same way. I've looked through the code for ioplus.c and opto.c but I don't see anything that looks out-of-place. Could anyone tell me what I'm doing wrong. (Sorry about the poor formatting).
Thanks!
The script commands and output are listed here:
#!/bin/bash -v
#
# Test rising edges
ioplus 0 optcntrst 5; ioplus 0 optcntrd 5 # clear/display OPTO 5 counter
0
ioplus 0 optedgewr 5 1; ioplus 0 optedgerd 5 # set OPTO 5 to count rising edges only and display
1
ioplus 0 optcntrd 5 # display counter - should be 0
0
ioplus 0 iotest 3 # run 1 test pass
Relay 5 to OPTO 5...PASS
Relay 6 to OPTO 6...PASS
Relay 7 to OPTO 7...PASS
Relay 8 to OPTO 8...PASS
OD 4 to OPTO 5...PASS
OD 3 to OPTO 6...PASS
OD 2 to OPTO 7...PASS
OD 1 to OPTO 8...PASS
ioplus 0 optcntrd 5 # display counter - should be 2 rising edges
2 # Right!
#
# Test falling edges
ioplus 0 optcntrst 5; ioplus 0 optcntrd 5 # clear/display OPTO 5 counter
0
ioplus 0 optedgewr 5 2; ioplus 0 optedgerd 5 # set OPTO 5 to count falling edges only and display
2
ioplus 0 optcntrd 5 # display counter - should be 0
0
ioplus 0 iotest 3 # run 1 test pass
Relay 5 to OPTO 5...PASS
Relay 6 to OPTO 6...PASS
Relay 7 to OPTO 7...PASS
Relay 8 to OPTO 8...PASS
OD 4 to OPTO 5...PASS
OD 3 to OPTO 6...PASS
OD 2 to OPTO 7...PASS
OD 1 to OPTO 8...PASS
ioplus 0 optcntrd 5 # display counter - should be 2 falling edges
0 # Wrong!
#
# Test both edges
ioplus 0 optcntrst 5; ioplus 0 optcntrd 5 # clear/display OPTO 5 counter
0
ioplus 0 optedgewr 5 3; ioplus 0 optedgerd 5 # set OPTO 5 to count both edges only and display
3
ioplus 0 optcntrd 5 # display counter - should be 0
0
ioplus 0 iotest 3 # run 1 test pass
Relay 5 to OPTO 5...PASS
Relay 6 to OPTO 6...PASS
Relay 7 to OPTO 7...PASS
Relay 8 to OPTO 8...PASS
OD 4 to OPTO 5...PASS
OD 3 to OPTO 6...PASS
OD 2 to OPTO 7...PASS
OD 1 to OPTO 8...PASS
ioplus 0 optcntrd 5 # display counter - should be 4 edges counted
2 # Wrong!
exit
It appears to not count any falling edges. I've also tried other OPTO inputs which fail the same way. I've looked through the code for ioplus.c and opto.c but I don't see anything that looks out-of-place. Could anyone tell me what I'm doing wrong. (Sorry about the poor formatting).
Thanks!