Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add force mode to input ports and output ports #123

Closed
dlech opened this issue Aug 22, 2014 · 19 comments
Closed

Add force mode to input ports and output ports #123

dlech opened this issue Aug 22, 2014 · 19 comments

Comments

@dlech
Copy link
Member

dlech commented Aug 22, 2014

Currently, input and output ports only auto-detect sensors. We need to add a module parameter (or sysfs attribute - but I think module parameter is better for this on second thought sysfs attribute is better) that allows users to force ports into a specific mode. In fact, maybe we remove the disable_in/out_port parameters and just have mode fore parameters that include a disable mode. Nope. we better keep these.

For input ports, the modes will be:

Name Description
disabled The legoev3 port driver won't touch the underlying gpios or other system devices so that they are free to be used directly
auto The current autodetection algorithms will control the port mode by selecting one of the following modes when a sensor in plugged in.
nxt-analog The nxt-analog-host will be loaded whether a sensor is plugged in or not. A driver can then be loaded using the set_sensor attribute.
nxt-i2c The input port will be configured to communicate with I2C devices. Device specific I2C driver modules can then be loaded manually.
ev3-uart The input port will be configured to communicate with MINDSTORMS UART sensors (serial port will not be usable for other things).
other-uart No host will be loaded. The input port will be configured to communicate with UART devices. The UART sensor line discipline will not be loaded, so the port will be usable as a regular serial port (i.e. this mode would be compatible with printing kernel messages on input port 1).
raw No host will be loaded. Attributes will be added to the host to directly access the A/DC values and the gpios.

For output ports...

Name Description
disabled The legoev3 port driver won't touch the underlying gpios, pwms or other system devices so that they are free to be used directly
auto The current autodetection algorithms will control the port mode by selecting one of the following modes when a motor in plugged in.
tacho-motor Configures the port for a motor that provides positional and directional feedback. The EV3 Large and Medium motors and the NXT motors are in the category.
servo-motor Hobby-type servo motor that only turns 90 degrees in either direction.
dc-motor A regular DC motor that does not provide any type of feedback. LEGO Power Functions motors fall into this category.
led Configures the port as an LED using the leds-pwm module
raw Configures the port to provide raw pwm ouput and gpio inputs.
@BertLindeman
Copy link
Contributor

Tiny thing, I assume ev3-meium-motor in the output port table should be ev3-medium-motor?
To prevent someone do a copy/paste and endup in error ;-)

@dlech
Copy link
Member Author

dlech commented Sep 6, 2014

Fixed. Thanks!

@fuzzycow
Copy link

fuzzycow commented Sep 7, 2014

This should help with Mindsensors Touch Sensor Multiplexer, which is currently autodetected as an nxt touch sensor.

It is currently possible to trick ev3dev into detecting it as a generic nxt analog sensor by pressing nxt touch sensor connected to TouchMUX port T3 while plugging TouchMUX into ev3.
This seems to stumble ev3dev kernel module touch sensor auto-detection, and it falls back to nxt analog.
Still a little awkward workaround.

(hope this is the right place to file this note)

@dlech
Copy link
Member Author

dlech commented Sep 8, 2014

(hope this is the right place to file this note)

Yes. And you should also open a new issue for the touch sensor multiplexer since we don't have a driver for it yet. Would you be interested in writing the driver? If not, I would like to at least enlist you to do some homework for us. Open a new issue and we will pick up the conversation there.

@dlech
Copy link
Member Author

dlech commented Sep 8, 2014

Added led to the list of possible output ports. Use case - issue #121.

@JorgePe
Copy link
Contributor

JorgePe commented Sep 8, 2014

Added led to the list of possible output ports. Use case - issue #121.

Thanks. But I think "pwm" might be preferable to "led". I was thinking that instead of a LED one can connect one of those RC servo motors or a poor man' DAC... and probably much more interesting devices.
(sorry for disrupting; you are doing a fantastic job)

@dlech
Copy link
Member Author

dlech commented Sep 8, 2014

Linux already has a leds class that we are using for the built-in leds, so I don't see a reason to not use it. If you really want raw pwm device, then you can disable the port completely as discussed in #121.

Also, I will soon be adding a new device class for servo motors, so I need to rethink the list above.

@dlech
Copy link
Member Author

dlech commented Sep 8, 2014

Added servo-motor and dc-motor to the list. Also consolidated EV3 motors into one type.

@dlech
Copy link
Member Author

dlech commented Sep 8, 2014

@JorgePe, Actually, the raw mode would be the catch-all rather than disabling a port.

@JorgePe
Copy link
Contributor

JorgePe commented Sep 8, 2014

@dlech I agree with you (raw as catch-all).
servo-motor and dc-motor are also very welcome. As soon as I return from holidays I'll try it (with my DIY cable and again with LEGO NXT-to-9V cable).

@rhempel
Copy link
Member

rhempel commented Sep 8, 2014

dc-motor will work pretty much the same as an LED, except it's not controlled by the LED class :-) And as @dlech and I have already discussed, servo-motor it its own special kind of driver ...

@dlech
Copy link
Member Author

dlech commented Sep 14, 2014

The input portion of this is done in 283f0be.

@dlech
Copy link
Member Author

dlech commented Sep 26, 2014

The input ports implementation is included in kernel version 3.16.1-3-ev3dev. If there are any problems, please open a new issue.

@BertLindeman
Copy link
Contributor

Uhrm, I am missing something.
For sensors I can find the mode and modes attributes.like in
/sys/devices/platform/legoev3-ports/in2/modes
Situation: kernel 3.16.1-3-ev3dev booted with outA port ENabled.
Now I want to set dc-motor as mode for outA port, so I can work with a powerfunstions motor or led.
But where/how. Did I mss a part of the doc somewhere?

@rhempel
Copy link
Member

rhempel commented Sep 28, 2014

I have not yet implemented force mode for motors

@BertLindeman
Copy link
Contributor

OK, than I understand.
Thanks.

@dlech
Copy link
Member Author

dlech commented Oct 19, 2014

Output ports is implemented in ev3dev/ev3-kernel@8f76af4

@dlech
Copy link
Member Author

dlech commented Oct 21, 2014

These changes have been released in kernel v3.16.1-6-ev3dev. No more resistors required!

@dlech dlech closed this as completed Oct 21, 2014
@JorgePe
Copy link
Contributor

JorgePe commented Oct 23, 2014

Confirmed: Power Functions Motor M running as "rcx-motor" with just a 8528 NXT->RCX conversion cable, no need for resistors at all.
Thanks, you've doing a great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants