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

Chip kit support #210

Merged
merged 3 commits into from Aug 9, 2015
Merged

Chip kit support #210

merged 3 commits into from Aug 9, 2015

Conversation

EmbeddedMan
Copy link
Contributor

Adding chipKIT board support to Firmata.

…D, FubarinoMini, UNO32, uC32, DP32, WF32, WiFire. MAX32, chipKIT Pi.

* Created a new StandardFirmataChipKIT sketch with chipKIT specific code in it
* Updated Board.h to include definitions for all of the new boards
break;
case PWM:
if (IS_PIN_PWM(pin))
servoWrite(PIN_TO_PWM(pin), value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without SoftPWMServo.h that library does the chipKIT have no PWM functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we have our own version of Servo.h that works just fine on some pins. But SoftPWMServo works on every pin, thus it's a better choice for Firmata, I feel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And our version of analog output (PWM output) also works just fine, but again can only be done with a small number of pins. SoftPWMServo allows us to do PWM (Analog output) and Servo on all pins.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this will work fine then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have looked at this first: https://github.com/chipKIT32/chipKIT32-MAX/blob/master/hardware/pic32/libraries/SoftPWMServo/SoftPWMServo.h. I think everything should work. Ignore my comments.

@soundanalogous
Copy link
Member

It looks like this may need more work. You should test servo support against a popular Firmata client library like johnny-five. I know @rwaldron is eager to get chipKIT support for johnny-five so maybe he is also available to do some testing here. I don't have any chipKIT boards to test with myself so I'll be relying on you to ensure it's working well with popular client libraries.

@EmbeddedMan
Copy link
Contributor Author

Excellent suggestion. I've been going through every johnny-five Servo based example (that I have hardware for - i.e. not the I2C based expander ones) and everything works great, with one minor exception. The only API call I can find that doesn't seem to do what it's supposed to is servo.stop(). I'll figure out why that's not working, and then update the PR. Every other servo API in johnny-five seems to work identically on chipKIT and Arduino boards.

@soundanalogous
Copy link
Member

@EmbeddedMan is it possible to use an Arduino ethernet shield with a chipKIT board?


See file LICENSE.txt for further informations on licensing terms.

Last updated by Jeff Hoefs: April 11, 2015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add your name and the date here since you will be the most recent updater :)

@rwaldron
Copy link
Contributor

rwaldron commented Aug 9, 2015

The only API call I can find that doesn't seem to do what it's supposed to is servo.stop(). I'll figure out why that's not working,

Keep in mind that stop is meaningless unless the program:

  • has specified a time-to-position for standard servos
  • is controlling a continuous servo and the correct neutral point is known (generally, that defaults to 90°, but some continuous servos don't have manual calibration, but instead allow a wide neutral zone)

@EmbeddedMan
Copy link
Contributor Author

Ohhh! In that case, stop is working great. :-) I thought servo.stop();
would kill the pulses coming out of the pin (i.e. "stop" sending RC servo
pulses). But you're saying that it actually only stops the pulses from
changing (for standard servos) or moves the pulses back to neutral point
(probably 1.5ms) for continuous rotation.

Let me do some more testing, and I'll let you know if the everything is
working correctly as far as stop. (I want to confirm my understanding based
on your description of what stop does.)

On Sat, Aug 8, 2015 at 8:55 PM, Rick Waldron notifications@github.com
wrote:

The only API call I can find that doesn't seem to do what it's supposed to
is servo.stop(). I'll figure out why that's not working,

Keep in mind that stop is meaningless unless the program:

  • has specified a time-to-position for standard servos
  • is controlling a continuous servo and the correct neutral point is
    known (generally, that defaults to 90°, but some continuous servos don't
    have manual calibration, but instead allow a wide neutral zone)


Reply to this email directly or view it on GitHub
#210 (comment).

Tested with johnny-five for Servo compatibility - works exactly like Arduino Firmata. All tests pass.
@EmbeddedMan
Copy link
Contributor Author

OK, I've done more testing comparing my PR chipKIT version of StandardFirmata with the normal Arduino version, with respect to the Servo API. I can find no differences. Stop() appears to work exactly the same on both boards. I've also updated StandardFirmataChipKIT.ino with my name.

Are there any other things you'd like to see fixed before moving forward with the PR?

(Oh, and I believe that there are some folks who have gotten the Arduino Ethernet shield to work with a chipKIT board, but I've never tried it, and it sounds like it takes some hardware modifications to the shield to get it to work.)

@soundanalogous
Copy link
Member

I think this is good to go then. I'll merge it and then make some minor changes as I want to pull in some changes I made in the v2.5beta1 branch (basically everything except the addition of SET_DIGITAL_PIN_VALUE feature which requires the bump from 2.4 to 2.5). After I make those changes I can tag a new release (Firmata 2.4.4) and it will show up for users in the Arduino IDE library manager.

@soundanalogous
Copy link
Member

Who should I credit in the release notes for the contribution? Yourself and Rick Anderson? I'm not sure what the extend of the collaboration is on the ChipKIT side.

@EmbeddedMan
Copy link
Contributor Author

Jeff,

Thanks for asking. It should be me, Rick Anderson and Keith Vogel.

*Brian

On Sun, Aug 9, 2015 at 1:08 PM, Jeff Hoefs notifications@github.com wrote:

Who should I credit in the release notes for the contribution? Yourself
and Rick Anderson? I'm not sure what the extend of the collaboration is on
the ChipKIT side.


Reply to this email directly or view it on GitHub
#210 (comment).

@soundanalogous
Copy link
Member

How soon will ChipKIT support be available in the Arduino Board manager?

@EmbeddedMan
Copy link
Contributor Author

Jeff, we're not sure. It's one of the things Rick is currently working on,
and we're getting close, but we're not there yet. Maybe a few weeks?

*Brian

On Sun, Aug 9, 2015 at 1:16 PM, Jeff Hoefs notifications@github.com wrote:

How soon will ChipKIT support be available in the Arduino Board manager?


Reply to this email directly or view it on GitHub
#210 (comment).

@soundanalogous
Copy link
Member

Okay, so until then you just merge Firmata master into MPIDE?

@EmbeddedMan
Copy link
Contributor Author

Yup, I just took care of putting my latest files in there, and when you do
your new release, I'll update them again with your latest.

On Sun, Aug 9, 2015 at 1:21 PM, Jeff Hoefs notifications@github.com wrote:

Okay, so until then you just merge Firmata master into MPIDE?


Reply to this email directly or view it on GitHub
#210 (comment).

soundanalogous added a commit that referenced this pull request Aug 9, 2015
@soundanalogous soundanalogous merged commit 0d028c0 into firmata:master Aug 9, 2015
@soundanalogous
Copy link
Member

Done! https://github.com/firmata/arduino/releases/tag/v2.4.4

Let me know if I should change anything in the first couple of sentences regarding how people can start using Firmata with ChipKIT.

@EmbeddedMan
Copy link
Contributor Author

Jeff, that looks fantastic. My only suggestion would be to say something
like "Be sure to use MPIDE 20150801 or later to get the most out of
Firmata" or something along those lines. (It wasn't until 20150801 that we
made the necessary changes in our own variant files to properly handle
analog inputs with Firmata on every board.)

*Brian

On Sun, Aug 9, 2015 at 2:54 PM, Jeff Hoefs notifications@github.com wrote:

Done! https://github.com/firmata/arduino/releases/tag/v2.4.4

Let me know if I should change anything in the first couple of sentences
regarding how people can start using Firmata with ChipKIT.


Reply to this email directly or view it on GitHub
#210 (comment).

@soundanalogous
Copy link
Member

Looks like the default download for OS X is 20140821.

@soundanalogous
Copy link
Member

Should the instructions say to download one of the 20150802 test releases from the top of this list?
http://chipkit.s3.amazonaws.com/index.html

@EmbeddedMan
Copy link
Contributor Author

Jeff,

Well, users should probably download the latest test release, whatever
version that is, but it should be at least 20150801. The problem with
showing that list is that it has all of our builds in it, and it can be
confusing for somebody who's not familiar with the current state of chipKIT
development. For example, you probably don't want one of the 0023 builds,
but should rather start with the 0150 builds (the prefix at the beginning
of the name). So, at this point in time, the right build for folks is the
builds/mide-0150-XXXXXXX-20150801-test.zip builds.

*Brian

On Sun, Aug 9, 2015 at 3:14 PM, Jeff Hoefs notifications@github.com wrote:

Should the instructions say to download one of the 20150802 test releases
from the top of this list?
http://chipkit.s3.amazonaws.com/index.html


Reply to this email directly or view it on GitHub
#210 (comment).

@EmbeddedMan
Copy link
Contributor Author

And yes, the state of chipKIT releases - at this point in time - is not
only kind of a mess but is not documented properly. We will be fixing that
in the near future, when we have chipKIT-core working 100% and we can point
all users to that as being the 'latest' (from within Arduino IDE of course).

*Brian

On Sun, Aug 9, 2015 at 3:25 PM, Brian Schmalz brian@schmalzhaus.com wrote:

Jeff,

Well, users should probably download the latest test release, whatever
version that is, but it should be at least 20150801. The problem with
showing that list is that it has all of our builds in it, and it can be
confusing for somebody who's not familiar with the current state of chipKIT
development. For example, you probably don't want one of the 0023 builds,
but should rather start with the 0150 builds (the prefix at the beginning
of the name). So, at this point in time, the right build for folks is the
builds/mide-0150-XXXXXXX-20150801-test.zip builds.

*Brian

On Sun, Aug 9, 2015 at 3:14 PM, Jeff Hoefs notifications@github.com
wrote:

Should the instructions say to download one of the 20150802 test releases
from the top of this list?
http://chipkit.s3.amazonaws.com/index.html


Reply to this email directly or view it on GitHub
#210 (comment).

@rwaldron
Copy link
Contributor

But you're saying that it actually only stops the pulses from
changing (for standard servos) or moves the pulses back to neutral point
(probably 1.5ms) for continuous rotation.

You got it :)

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

Successfully merging this pull request may close these issues.

None yet

3 participants