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 SAMD5x/E5x and all missing SAMx7x devices #827

Merged
merged 35 commits into from
Sep 30, 2022

Conversation

chris-durand
Copy link
Member

@chris-durand chris-durand commented Feb 9, 2022

  • Add SAMD51 / SAME5x device family
    • UART
    • Clock
    • USB
  • Add SAME54 Xplained Pro board with blink example
  • Rename UART drivers
    • sam -> sam-sercom
    • samg -> sam
  • Improve support for SAMx7x device family
    • Add UART / USART
    • Add SAMS70, SAME70, SAMV71 devices
  • Fix data reception in the SAMx7x and SAMG UART driver
  • Add SAMV71 Xplained Ultra board with blink example
  • Refactor GCLK driver
    • Expose flexible clock generator / clock source configuration in API
    • Remove hardcoded assumptions of available clock sources
    • DFLL48 configuration
    • DPLL configuration with automatic coefficient calculation
    • API to enable peripheral clocks
  • Fix selection of device headers. In some cases headers belonging to the wrong device variant were chosen.
  • Adapt family naming scheme
    Not all devices which belong to one logical family share a common name prefix (e.g. the E70/S70/V70/V71 device family). The identifier scheme is changed to
    {platform}{series}{pin}{flash}{variant}-{package}{grade}
    
    and families are assigned based on logical grouping and not by name prefix.
  • Hardware test
    • SAMD21 Xplained Pro
      • UART
      • GCLK
        • DFLL48 open-loop
        • DFLL48 closed-loop
        • DPLL96
        • OSC8M
        • Peripheral clock configuration
      • USB
    • SAME54 Xplained Pro
      • UART
      • GCLK
      • USB
    • SAMV71 Xplained Ultra

SAMx7x have both UART and USART peripherals with the same id. The driver is adapted to provide :platform:uart:* and :platform:usart:* modules. This driver is also shared with the SAMG devices. For implementation simplicity and consistency I have changed the SAMG USART peripheral to also use the :platform:usart module and naming (see this commit). This is a breaking change. Would that be fine with you @mcbridejc @salkinium ?

I have also renamed the previous "samg" UART driver to "sam" because this one is used by all SAM devices without SERCOM peripheral. The SERCOM based driver driver is renamed from "sam" to "sam-sercom". That renaming is a bit too much for github to display correctly in the diff.

@chris-durand
Copy link
Member Author

@salkinium In a lot of places we are making the assumption that device families have unique device name prefixes. For SAM this is not true, e.g. SAMD51 and SAME51, SAME53, SAME54 are a device family as well as SAME70, SAMS70, SAMV70 and SAMV71. This makes the family field of the device identifier a lot less useful in the driver implementations. Can we live with it for now?

@chris-durand
Copy link
Member Author

The auto-generated HAL matrix table makes not much sense anymore with these devices added. The shown device families are D21, E, G55, S, V70.

@mcbridejc
Copy link
Contributor

This is a breaking change. Would that be fine for you?

That's fine by me.

@chris-durand chris-durand force-pushed the feature/sam_x5x_x7x branch 2 times, most recently from c5ca24d to ed3c76e Compare April 1, 2022 22:08
@rleh rleh added this to the 2022q2 milestone Apr 2, 2022
@chris-durand chris-durand force-pushed the feature/sam_x5x_x7x branch 5 times, most recently from db44fa5 to ce65fd8 Compare April 5, 2022 16:57
@chris-durand chris-durand modified the milestones: 2022q2, 2022q3 Jun 30, 2022
@chris-durand chris-durand force-pushed the feature/sam_x5x_x7x branch 3 times, most recently from b82ef5f to 27b972a Compare August 22, 2022 17:35
@chris-durand chris-durand force-pushed the feature/sam_x5x_x7x branch 4 times, most recently from 0fef8a1 to 0572fc7 Compare August 29, 2022 21:53
@chris-durand chris-durand added the ci:hal Triggers the exhaustive HAL compile CI jobs label Aug 30, 2022
@salkinium
Copy link
Member

Do you already want review feedback at this point?

@chris-durand
Copy link
Member Author

Do you already want review feedback at this point?

I would appreciate a first review. Keep in mind that I haven't updated the PR description yet. There is a lot more stuff in there than mentioned.

@chris-durand
Copy link
Member Author

Just FYI, the diff does not correctly show that in this commit the uart drivers have been renamed. It might look like entirely new code in the diff but it isn't.

- Parse synchronous APB clock enable information from device headers
- Add GCLK API to enable / disable bus clocks

This change applies to all SAM devices with GCLK peripheral.
Extended and refactored GCLK driver. All implicit assumption that should
be in user code were removed from the driver. Clock generators can be
freely configured from user code.

Features:
- Flexible generator configuration
- Clock sources and peripheral sinks from device data
- External crystal, external 32k crystal support
- Internal oscillator configuration
- Dfll48 open/closed loop configuration
setInput(InputType) erroneously reset the type to floating after
enabling pull-ups.
In case a header version with a variant suffix and one without
exist it was not defined which one was selected.
@chris-durand chris-durand added ci:hal Triggers the exhaustive HAL compile CI jobs and removed ci:hal Triggers the exhaustive HAL compile CI jobs labels Sep 29, 2022
Copy link
Member

@salkinium salkinium left a comment

Choose a reason for hiding this comment

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

Thanks a lot! I will merge this at the latest tomorrow together with the modm-devices PR and update the Q3 release.

@salkinium
Copy link
Member

@rleh do you still want to review this PR?

@salkinium salkinium merged commit 8230fef into modm-io:develop Sep 30, 2022
@chris-durand chris-durand deleted the feature/sam_x5x_x7x branch September 30, 2022 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

SAM sercom UART only works for some pin mappings
4 participants