Post by Frisbone on Jul 25, 2013 9:20:31 GMT -5
As much as I would like to start wiring up my xbox controller it seems like it would be a bad idea. I need to be methodical about this. These are the major areas to test in the software:
1. Responding to DIO interrupts
2. Verifying usable data from AM and conversion to PWM output (so, verifying the PWM output).
3. Converting DIO interrupts to DIO outputs, verify we can map it and have the xbox controller trigger.
4. Converting a DIO interrupt to a PWM output (like the trigger)
5. Handling software initialized events and converting them to DIO outputs (aiming, jumping)
-----------------------------------------------
Given that initial list of test items I need to work out a test platform for each one.
For DIO inputs the most important thing would be for me to validate that every DIO input that I think is usable actually is and I can detect the change. I also need to be able to handle simultaneous inputs - so I can't get away with just a single button. Need two or three buttons for this test wired. Needs list:
- 3 buttons, tied to ground on one side - jumpered to pins on the other (breadboard).
- VERIFICATION: Press a button, verify the value is seen as logic 1 or "enabled" in the software. Press two & three buttons - verify no race conditions with simultaneous activation. Track on/off/on/off and verify no debounce required (no fluttering). Move jumpers to all 7 DIO input positions and verify that software sees all transitions.
Now verify input to output DIO mapping.
- hook up power direct from either the RPi (verify we won't burn it out), or from a divider circuit off the inbound power, or from a battery using a common ground.
- Hook up a button that controls the power to the controller
- Hook up two buttons that map to B and X
- Hook up B & X outputs so that they go through the transistor/resistor combo to enable the output - Do this on a breadboard first (so need the resistors and transistors).
- Verify that the button used for power can lead to the power turning on the controller
- Verify that the buttons (while software is running) serve as replacements for the B and X buttons. Use the xbox login process to verify - any buttons needed can be triggered manually.
For PWM outputs the important thing is not to destroy equipment. I have seen warnings about over-driving them in the xboxpc project and am a little concerned about the setting that could cause problems. The joysticks seem like litte more than two-axis potentiometers - so I'm not sure how a digital signal comes out of it. The xboxpc project injected their "pwm" signal into the middle pin location - which does go directly to the Microsoft microcontroller - so it makes sense, but the nature of the signal is a mystery. Here are the steps I should take to test this:
- Determine the nature of the signal to the microcontroller. Either get reliable information on-line, or use an oscilloscope on a working controller to look at the signal.
- Determine if our approach with the 16 port device is going to work (frequency and DC configuration , constant freq between the 4 channels we are using)
- Wire up a single PWM to the controller - connect to the channel output on the device. Connect power up to the controller, hook up to an xbox and power it up. Keep everything disconnected until you can get into an app where you can see the fine movements of the controller.
- Write a test driver that enables the PWM output to 10% DC (fixed) periodically in our program loop (1 second rate). Run program, verify that the amount of movement makes sense.
- Slowly increase the DC until we achieve a value that moves the stick at max - use this in the software as a protective maximum.
- Hook up a 2nd PWM device. Modify the test driver so that it turns both on - verify they both work simultaneously
Now we need to verify that DIO inputs can map to the PWM. This will be done by verifying the trigger functionality
- Hook up a button to the DIO for the trigger
- Hook up a PWM device output to the trigger PWM input on the controller
- Test program should automatically convert and pull the trigger, use an xbox test program to verify
Verify software driven outputs
- Hook up the PWM for the left trigger to a PWM output mapped to the left trigger
- Hook up the DIO output to the A button mapped to the jump button.
- Write test code to trigger a jump periodically and to alternately trigger an aim (every other second). Verify in a game this is working.
Verify AM Events.
- Hook up all PWMs (right joystick, left trigger, right trigger) to controller
- Hook up A button to controller
- Hook up button for trigger and connect ti DIO
- Remove AM from gun and put in a vertical free position so it can be moved around.
- Run program without driver, move AM around to trigger JY movements, AIM, and jump. Verify trigger still works.
1. Responding to DIO interrupts
2. Verifying usable data from AM and conversion to PWM output (so, verifying the PWM output).
3. Converting DIO interrupts to DIO outputs, verify we can map it and have the xbox controller trigger.
4. Converting a DIO interrupt to a PWM output (like the trigger)
5. Handling software initialized events and converting them to DIO outputs (aiming, jumping)
-----------------------------------------------
Given that initial list of test items I need to work out a test platform for each one.
For DIO inputs the most important thing would be for me to validate that every DIO input that I think is usable actually is and I can detect the change. I also need to be able to handle simultaneous inputs - so I can't get away with just a single button. Need two or three buttons for this test wired. Needs list:
- 3 buttons, tied to ground on one side - jumpered to pins on the other (breadboard).
- VERIFICATION: Press a button, verify the value is seen as logic 1 or "enabled" in the software. Press two & three buttons - verify no race conditions with simultaneous activation. Track on/off/on/off and verify no debounce required (no fluttering). Move jumpers to all 7 DIO input positions and verify that software sees all transitions.
Now verify input to output DIO mapping.
- hook up power direct from either the RPi (verify we won't burn it out), or from a divider circuit off the inbound power, or from a battery using a common ground.
- Hook up a button that controls the power to the controller
- Hook up two buttons that map to B and X
- Hook up B & X outputs so that they go through the transistor/resistor combo to enable the output - Do this on a breadboard first (so need the resistors and transistors).
- Verify that the button used for power can lead to the power turning on the controller
- Verify that the buttons (while software is running) serve as replacements for the B and X buttons. Use the xbox login process to verify - any buttons needed can be triggered manually.
For PWM outputs the important thing is not to destroy equipment. I have seen warnings about over-driving them in the xboxpc project and am a little concerned about the setting that could cause problems. The joysticks seem like litte more than two-axis potentiometers - so I'm not sure how a digital signal comes out of it. The xboxpc project injected their "pwm" signal into the middle pin location - which does go directly to the Microsoft microcontroller - so it makes sense, but the nature of the signal is a mystery. Here are the steps I should take to test this:
- Determine the nature of the signal to the microcontroller. Either get reliable information on-line, or use an oscilloscope on a working controller to look at the signal.
- Determine if our approach with the 16 port device is going to work (frequency and DC configuration , constant freq between the 4 channels we are using)
- Wire up a single PWM to the controller - connect to the channel output on the device. Connect power up to the controller, hook up to an xbox and power it up. Keep everything disconnected until you can get into an app where you can see the fine movements of the controller.
- Write a test driver that enables the PWM output to 10% DC (fixed) periodically in our program loop (1 second rate). Run program, verify that the amount of movement makes sense.
- Slowly increase the DC until we achieve a value that moves the stick at max - use this in the software as a protective maximum.
- Hook up a 2nd PWM device. Modify the test driver so that it turns both on - verify they both work simultaneously
Now we need to verify that DIO inputs can map to the PWM. This will be done by verifying the trigger functionality
- Hook up a button to the DIO for the trigger
- Hook up a PWM device output to the trigger PWM input on the controller
- Test program should automatically convert and pull the trigger, use an xbox test program to verify
Verify software driven outputs
- Hook up the PWM for the left trigger to a PWM output mapped to the left trigger
- Hook up the DIO output to the A button mapped to the jump button.
- Write test code to trigger a jump periodically and to alternately trigger an aim (every other second). Verify in a game this is working.
Verify AM Events.
- Hook up all PWMs (right joystick, left trigger, right trigger) to controller
- Hook up A button to controller
- Hook up button for trigger and connect ti DIO
- Remove AM from gun and put in a vertical free position so it can be moved around.
- Run program without driver, move AM around to trigger JY movements, AIM, and jump. Verify trigger still works.