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

Adding Clock and Clock Generator Options for atmel_sam0 #36649

Open
photonthunder opened this issue Jun 30, 2021 · 3 comments
Open

Adding Clock and Clock Generator Options for atmel_sam0 #36649

photonthunder opened this issue Jun 30, 2021 · 3 comments
Assignees
Labels
area: Clock Control Enhancement Changes/Updates/Additions to existing features platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM)

Comments

@photonthunder
Copy link
Contributor

I am interested in improving the atmel sam0 drivers so they provide better ability to adjust the clock. The challenge with this set of chips (I have worked on the samd21 and the samd51) is that you have a variety of clock sources (crystals, oscillators, DFLL, DPLL) that can run at a variety of frequencies and then you tie those to clock generators that can be connected to the different peripherals. In my current design I run off a 20 MHz external oscillator but run my peripherals at 5 MHz. The current code uses CONFIGS added to the fork of the zephyr code. The hard part is if you tried to add CONFIGS for all options it will explode. One option would be to do like what is done in pinmux.c where you set the appropriate pin/peripheral mux. This isn't ideal but it is better than making changes to the zephyr code and ties it to the board. I am sure this has been discussed before so just curious what people currently do and if there is any solid options for handling the clock options?

@photonthunder photonthunder added the Enhancement Changes/Updates/Additions to existing features label Jun 30, 2021
@trunifom
Copy link

trunifom commented Aug 3, 2021

I'm working with the nRF53 microcontroller from Nordic.
When I was working with the DevKit, everything was running fine. When I switched to my own hardware (customboard), suddenly nothing worked anymore (when I wasn't debugging). The problem was that I didn't have an external 32kHz clock equipped. The solution was the configurations.

So Nordic seems to solve this problem via configs

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=n
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_20PPM=y
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_DEBUG=n

@photonthunder
Copy link
Contributor Author

@truniform, thanks for the input. That is one method and I do something similar in my hacks fo the sam0 code (so I can activate my 20 MHz external oscillator and setup GCLK3 as a 5 MHz divisor. This is where the samd/same family of atmel/microchip processors get hard to "setup". You would have configs for system clocks, then configs to setup the GCLK, and then configs to tell the peripheral which GCLK to connect. I think the best way would be to do it in the device tree so you could account for all the options, but it would be a lot of work to try and make it all inclusive and it wouldn't really scale out to other processors so was curious what others had done or if there was even interest in the effort. It may be that just doing some custom hacking of the drivers is the best option?

@henrikbrixandersen henrikbrixandersen added area: Clock Control platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) labels Nov 17, 2022
@zephyrbot zephyrbot added Needs review This PR needs attention from Zephyr's maintainers and removed Needs review This PR needs attention from Zephyr's maintainers labels Feb 8, 2024
@zephyrbot
Copy link
Collaborator

Hi @nordic-krch, @nandojve,

This issue, marked as an Enhancement, was opened a while ago and did not get any traction. It was just assigned to you based on the labels. If you don't consider yourself the right person to address this issue, please re-assing it to the right person.

Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.

@photonthunder you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Clock Control Enhancement Changes/Updates/Additions to existing features platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM)
Projects
None yet
Development

No branches or pull requests

6 participants