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 support for Atmel SAML21, SAMR34, SAMR35 parts #41308

Merged
merged 5 commits into from
Jul 18, 2022

Conversation

attie-argentum
Copy link
Member

@attie-argentum attie-argentum commented Dec 17, 2021

This PR implements support for SAML21, SAMR34 and SAMR35 parts.

I've named the SAMR34 / SAMR35 parts samr34 in the sources, because samr3x would not be correct here (see SAMR30 which is a SAML21 with an AT86RF212B / 802.15.4 radio), and SAMR35 is just "SAMR34 without USB".

The SAMR34 and SAMR35 parts are fundamentally a SAML21 with a LoRa radio built in.
I will not be using the LoRa radio for LoRa in my application (I'll be using FSK), but I have run the LoRa send/receive samples between two boards to verify operation.

Dependencies

This PR depends on:

@carlescufi
Copy link
Member

carlescufi commented Dec 17, 2021

Dependencies

This PR depends on zephyrproject-rtos/hal_atmel#17.

Can you please update west.yml in this PR to point to the PR above?
See: https://docs.zephyrproject.org/latest/guides/modules.html#process-for-submitting-changes-to-existing-modules

@attie-argentum
Copy link
Member Author

attie-argentum commented Dec 17, 2021

Can you please update west.yml in this PR to point to the PR above?

What a good idea, thanks!

@github-actions
Copy link

github-actions bot commented Dec 17, 2021

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
hal_atmel zephyrproject-rtos/hal_atmel@78c5567 zephyrproject-rtos/hal_atmel@7518d0b zephyrproject-rtos/[email protected]

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@attie-argentum attie-argentum force-pushed the saml21 branch 5 times, most recently from 62fc515 to 0540211 Compare December 17, 2021 23:09
@nandojve nandojve added the platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) label Dec 18, 2021
@nandojve
Copy link
Member

Hi @attie-argentum ,

Thank you for your contribution!

I think there are three things in this PR:

  • introduce a new SoC
  • improve ADC
  • fix pinctrl

My preference is split PR in two for organization purposes.

In order to add a newer SoC the preference is have a single commit that update hal_atmel using pull/17/head. It should be first commit in the series. The pull/XX/head signal PR must not be merged because it handles DNM (Do Not Merge) automatically. You can keep the pinctrl fix here or create another PR (trivial) that could be merged faster.

ADC is a general improvement and don't need to be part of a newer SoC series as you, in fact, fixed ADC before add the SoC.

The split can help to speed up acceptance.

@attie-argentum
Copy link
Member Author

Address @gmarull's comments and rebase.

@attie-argentum
Copy link
Member Author

Rebase to address conflicts.

@gmarull @nandojve, any chance of another review?

@attie-argentum attie-argentum requested review from gmarull and nandojve and removed request for gmarull July 6, 2022 12:26
@nandojve
Copy link
Member

nandojve commented Jul 9, 2022

Hi @mbolivar-nordic , @gmarull

I was wondering if you may revisit this PR to check if @attie-argentum addressed all your concerns.

Implement support for SAML21 parts, tested on a SAML21 Xplained Pro dev
board. Confirmed operational peripherals: UART, GPIO, PWM, ADC.

Signed-off-by: Attie Grande <[email protected]>
Implement support for SAML21 Xplained Pro dev board.

Signed-off-by: Attie Grande <[email protected]>
Implement support for SAMR34 and SAMR35 parts, tested on a SAMR34
Xplained Pro dev board. Confirmed operational peripherals: UART, GPIO,
PWM, ADC.

NOTE: The SAMR34 datasheet lists NVIC line 20 for the ADC's interrupt,
but the SAML21 datasheet gives line 22. It appears that the SAMR34 sheet
is incorrect (the ADC doesn't function with line 20), and as such, I have
also omitted the adjustments for TC4 and AC...

Signed-off-by: Attie Grande <[email protected]>
Implement support for SAMR34 Xplained Pro dev board.

Signed-off-by: Attie Grande <[email protected]>
For SAML21-based parts, the REFCTRL register is locked while the ADC is
enabled. Permit some parts to declare that they need the ADC to be
disabled before modifying REFCTRL.

Signed-off-by: Attie Grande <[email protected]>
@attie-argentum
Copy link
Member Author

@gmarull - thanks for your comments... I'm going to hang on to the GPIO (magic numbers / device tree) for the moment, if that's okay... but I've addressed the others.

Very keen to get this merged now, I seem to be periodically playing catch-up with a moving target.

Copy link
Member

@gmarull gmarull left a comment

Choose a reason for hiding this comment

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

Thanks for the patience and continued effort

@attie-argentum
Copy link
Member Author

attie-argentum commented Jul 13, 2022

@nandojve / @mbolivar-nordic - please could you re-check too? 🤞

@attie-argentum
Copy link
Member Author

@mbolivar-nordic - please could you have a look over this again, I'd love to get this merged and complete.

@mbolivar-nordic
Copy link
Contributor

@mbolivar-nordic - please could you have a look over this again, I'd love to get this merged and complete.

Done; you're just down to @stephanosio 's NAK now

Copy link
Member

@stephanosio stephanosio left a comment

Choose a reason for hiding this comment

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

LGTM

@fabiobaltieri fabiobaltieri merged commit 7ded40d into zephyrproject-rtos:main Jul 18, 2022
@attie-argentum
Copy link
Member Author

Amazing, thanks all! 🥳

@attie-argentum attie-argentum deleted the saml21 branch July 18, 2022 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ADC Analog-to-Digital Converter (ADC) area: Boards area: Clock Control area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree area: Documentation area: Modules area: Samples Samples area: UART Universal Asynchronous Receiver-Transmitter manifest manifest-hal_atmel platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants