Not sure if this is a bug or user error....Trying to access wpilib DO channel 21 (High Current DIO Pin 10)

30 views
Skip to first unread message

Charlie Peppler

unread,
Apr 27, 2020, 2:51:27 PM4/27/20
to vmx-pi
After having some success with CAN, I'm moving on to testing Digital Outputs.
The plan is to use an external relay driven by a 5V Digital Output to power a 12V LED for lighting up vision.

I went through the hardware manual and the 

This is what I did:

Went down to section "Digital I/O (DIO) Channel Addressing"
Selected wpilib channel 21, which should map to High Current DIO pin 10.
Wired Ground, Power, and signal to the inputs on the relay (Got a green LED, so relay is happy).
Assumed High Current DIO is set to 5V (as shipped), and direction set to output.
in 
in class Robot:
  private static final int ledChannelID = 21;
  private DigitalOutput ledOutput = new DigitalOutput(ledChannelID);


This the result (from Console):

VMX HAL:  pigpio library version 69 opened. 
 VMX HAL:  SPI Aux Channel 2 opened with baudrate of 4000000. 
 VMX HAL:  Established communication with VMX-pi model 0x32, hardware rev 60, firmware version 3.0.411 
 VMX HAL:  Acquired navX-Sensor configuration. 
 VMX HAL:  Library version 1.1.220 
 Set VMX CAN Mode to NORMAL. 
 Server Running... 
 ********** Robot program starting ********** 
 In disabledInit() 
 Default disabledPeriodic() method... Override me! 
 Default robotPeriodic() method... Override me! 
ERROR  1  Unhandled exception: edu.wpi.first.hal.util.UncleanStatusException:  Code: -1098. HAL: A handle parameter was passed incorrectly  frc.robot.Main.main(Main.java:27) 
 Error at frc.robot.Main.main(Main.java:27): Unhandled exception: edu.wpi.first.hal.util.UncleanStatusException:  Code: -1098. HAL: A handle parameter was passed incorrectly 
 at edu.wpi.first.hal.DIOJNI.getDIO(Native Method) 
 at edu.wpi.first.wpilibj.DigitalOutput.get(DigitalOutput.java:69) 
 at edu.wpi.first.wpilibj.smartdashboard.SendableBuilderImpl.lambda$addBooleanProperty$0(SendableBuilderImpl.java:219) 
 at edu.wpi.first.wpilibj.smartdashboard.SendableBuilderImpl.updateTable(SendableBuilderImpl.java:95) 
 at edu.wpi.first.wpilibj.livewindow.LiveWindow.updateValues(LiveWindow.java:290) 
 at edu.wpi.first.wpilibj.IterativeRobotBase.loopFunc(IterativeRobotBase.java:263) 
 at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:81) 
 at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:263) 
 at frc.robot.Main.main(Main.java:27) 
  
Warning  1  Robots should not quit, but yours did!  edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:274) 
 Warning at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:274): Robots should not quit, but yours did! 
ERROR  1  The startCompetition() method (or methods called by it) should have handled the exception above.  edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:276) 
 Error at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:276): The startCompetition() method (or methods called by it) should have handled the exception above. 
 # 
 # A fatal error has been detected by the Java Runtime Environment: 
 # 
 #  SIGSEGV (0xb) at pc=0x739ccf28, pid=11649, tid=11698 
 # 
 # JRE version: OpenJDK Runtime Environment (11.0.7+10) (build 11.0.7+10-post-Raspbian-3deb10u1) 
 # Java VM: OpenJDK Server VM (11.0.7+10-post-Raspbian-3deb10u1, mixed mode, g1 gc, linux-) 
 # Problematic frame: 
 # C  [libvmxpi_hal_cpp.so+0xa3f28][thread 11704 also had an error] 
 [thread 11725 also had an error] 
   spiGoA+0x2a8 
 # 
 # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again 
 # 
 # An error report file with more information is saved as: 
 # //hs_err_pid11649.log 
Warning  44004  FRC:  The Driver Station has lost communication with the robot.  Driver Station 



If I comment out the reference to DigitalOutput, all is happy.

Am I doing something wrong, or is this a bug?

(Just a note:  I just did a Raspi update/upgrade, and it looks like a new java runtime came down...not sure if that might have an effect.


Jacob Roth-Ritchie

unread,
Apr 27, 2020, 4:18:59 PM4/27/20
to vmx-pi
Hello,
I think the high output DI/DO need to be set using the jumper (either all output or all input), though I think they are set to output as default.
Did you set the jumper to Output?  I have only used that section as PWM, but I did get the flex DIO working with a button, and it works.  The channel mappings in WPILIB seem to be the same as the docs.
Barring that, did you update the VMX-Pi Software after the update to the Raspberry pi OS?  I wonder if that could have reset something.

Other than those two things, I am out of ideas.  Sorry.  Oh, I think it would be a different error, but if you instantiated pin10 for PWM, that would also cause a similar issue (though I think the error would say something to that effect).

Charlie Peppler

unread,
Apr 27, 2020, 5:21:28 PM4/27/20
to vmx-pi
Hello Jacob,

I powered VMX down, opened it up, and rechecked all the jumpers.  HiCurrent DIO set to output, all power level jumpers
set to 5V.

The code is stripped down to just a single call to allocate the Digital Output on a single channel (wpilib 21, HiCurr DIO physical channel 10).  No PWMs.

$ java --version
openjdk 11.0.7 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Raspbian-3deb10u1)
OpenJDK Server VM (build 11.0.7+10-post-Raspbian-3deb10u1, mixed mode)


Raspberry Pi 4 Model B Rev 1.2

sudo apt-cache show vmxpi-frc
Package: vmxpi-frc
Version: 1.1.220
Architecture: armhf
Maintainer: Kauai Labs
Installed-Size: 500
Depends: vmxpi-hal
Filename: ./vmxpi-frc_1.1.220_armhf.deb

sudo apt-cache show vmxpi-hal
Package: vmxpi-hal
Version: 1.1.220
Architecture: armhf
Maintainer: Kauai Labs
Installed-Size: 3000
Filename: ./vmxpi-hal_1.1.220_armhf.deb

 I submitted an issue on the beta github site.  Will update it with this info.

Thank you for checking in!

Charlie
Message has been deleted

Scott Libert

unread,
Apr 27, 2020, 11:09:27 PM4/27/20
to vmx-pi
Thanks for reporting this, it is indeed a bug.

After some research, the issue is specifically w Digital IO channel #21.  As it stands now, this single digital IO channel number fails to allocate correctly, due to a bug in the VMX-pi WPI Library HAL.  I'll have more details soon in the Github issue you've entered - and will be working on a solution.  

Your workaround until this is fixed is to not use Channel #s 21 as a Digital Input or Output.  It should work OK for PWM.

Charlie Peppler

unread,
Apr 28, 2020, 9:42:26 AM4/28/20
to vmx-pi
Thank you Scott.  I confirmed that Digital Output works on channels 18-20, and I can happily click my relay.
Reply all
Reply to author
Forward
0 new messages