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 basic support for PWM using TCC on D51/E54 #245

Merged
merged 4 commits into from
Aug 29, 2020
Merged

Add basic support for PWM using TCC on D51/E54 #245

merged 4 commits into from
Aug 29, 2020

Conversation

jessebraham
Copy link
Contributor

This is almost verbatim from the thumbv6m module, just some minor adjustments. Initial testing looks promising, but I will be doing some more tonight. If somebody else is able to try it out that'd be appreciated!

@jessebraham
Copy link
Contributor Author

jessebraham commented Aug 29, 2020

@jacobrosenthal had pointed out last night that I was missing the pinout Enums for the TCC implementation, which take ownership of the pin once it has been set to the appropriate function. Should I add these in for the thumbv6m implementations as well, just for consistency since they don't currently exist?

One new issue that has cropped up is that the different TCCn instances appear to have different numbers of channels.

@jacobrosenthal
Copy link
Member

If you can stomach it, it harmonizes all the thumb6 stuff with the thumb7 versions. Its obviously also 'safer' since we know you had to set your pin into the correct function. But more than that I was trying to implement an example to test yesterday and i had to drop to datasheet to figure out which timer offered which pin as an output, and thats discoverable by the thumbv7 implementations enums.

I updated my examples, but the pwm_tcc0 example isnt blinking my led.(where the tc0 version does) I dont have my scope here, perhaps you can see what im doing wrong?
https://github.com/jacobrosenthal/atsamd/tree/features/pwm

@jessebraham
Copy link
Contributor Author

If you can stomach it, it harmonizes all the thumb6 stuff with the thumb7 versions. Its obviously also 'safer' since we know you had to set your pin into the correct function.

Sure thing, the thumbv6m chips tend to be a lot smaller anyways. I agree, it was a little awkward calling .into_function_x() before and just kinda not doing anything with the result.

But more than that I was trying to implement an example to test yesterday and i had to drop to datasheet to figure out which timer offered which pin as an output, and thats discoverable by the thumbv7 implementations enums.

That's another excellent point, I found myself doing the same thing.

I updated my examples, but the pwm_tcc0 example isnt blinking my led.(where the tc0 version does) I dont have my scope here, perhaps you can see what im doing wrong?
https://github.com/jacobrosenthal/atsamd/tree/features/pwm

Looks reasonable to me, I may have made some errors. Let me review.

@jessebraham
Copy link
Contributor Author

@jacobrosenthal due to some difficulties in adding the enums for the thumbv6m I think they will be in a separate PR at this point. This should be good to merge if you're happy with it.

@jacobrosenthal jacobrosenthal merged commit bec8c11 into atsamd-rs:master Aug 29, 2020
@jessebraham jessebraham deleted the features/pwm branch August 29, 2020 17:57
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

2 participants