Skip to content
New issue

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

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

Already on GitHub? # to your account

cpu/samd21: Add samd21 pwm driver #2473

Closed
wants to merge 4 commits into from

Conversation

PeterKietzmann
Copy link
Member

This is an implementation of a pwm lowlevel driver for samr21-xpro boards. Please note that the pwm_mode_t mode is not yet implemented for this board.

/* ignore file in case no PWM devices are defined */
#if PWM_NUMOF

int round_to_prescaler(unsigned int frequency, unsigned int resolution, int *presc);
Copy link
Member

Choose a reason for hiding this comment

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

Could be static, right?

@PeterKietzmann
Copy link
Member Author

addressed latest comments

#define PWM_1_PM PM_APBCMASK_TCC1
/* PWM 1 pin configuration */
#define PWM_1_PORT (PORT->Group[0])
#define PWM_1_PIN_CH0 (6)
Copy link
Member Author

Choose a reason for hiding this comment

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

We should be aware that this pin is used for ADC_0 in PR #2063

@thomaseichinger
Copy link
Member

@PeterKietzmann needs rebase.

@PeterKietzmann
Copy link
Member Author

I rebased and squashed. We should not forget that the pwm_mode_t mode is still not handled

@PeterKietzmann
Copy link
Member Author

@thomaseichinger I tried to implement the left and right aligned pwm modes for the samr21-xpro. According to the reference manual (section 28.6.2.5 page 617) I wanted to use the up-counting mode for the left-aligned pwm and the down-counting mode for the right-aligned pwm. The corresponding register-content (PWM_0_DEV->CTRLBCLR.reg or PWM_0_DEV->CTRLBSET.reg) seems to be correct in both cases. However, running the REMOVE_ME_pwm_test with a connected logic analyzer shows nearly no difference between the modes. Any ideas?

@PeterKietzmann
Copy link
Member Author

In addition: Do you know a way to measure the regarding clock signal?

@haukepetersen
Copy link
Contributor

@PeterKietzmann: I just opened a new PR with a slightly adapted version of your PWM driver: #3127. Should we close this then?

@PeterKietzmann
Copy link
Member Author

Yes of course! Will test the new one soon

@PeterKietzmann PeterKietzmann deleted the add_samd21_pwm branch June 5, 2015 12:19
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area: drivers Area: Device drivers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants