Skip to content

fix(PeriphDrivers): Fix clock speed configuration of SPI3 for MAX32650#1566

Merged
ttmut merged 1 commit into
analogdevicesinc:mainfrom
cameronpacileo-adi:spi3-clock-speed-configuration
Jun 1, 2026
Merged

fix(PeriphDrivers): Fix clock speed configuration of SPI3 for MAX32650#1566
ttmut merged 1 commit into
analogdevicesinc:mainfrom
cameronpacileo-adi:spi3-clock-speed-configuration

Conversation

@cameronpacileo-adi

Copy link
Copy Markdown
Contributor

Description

spi_me10.c assumes the SPI3 peripheral clock is twice the frequency as other SPI instances. Looking at the MAX32650 UG there is no indication SPI3 peripheral clock is twice the frequency.

Checklist Before Requesting Review

  • PR Title follows correct guidelines.
  • Description of changes and all other relevant information.
  • (Optional) Link any related GitHub issues using a keyword
  • (Optional) Provide info on any relevant functional testing/validation. For API changes or significant features, this is not optional.

@github-actions github-actions Bot added the MAX32650 Related to the MAX32650 (ME10) label May 28, 2026
@ttmut ttmut requested a review from hfakkiz June 1, 2026 08:20
@ttmut ttmut changed the title fix(PeriphDrivers): Fix clock speed configuration of SPI3 fix(PeriphDrivers): Fix clock speed configuration of SPI3 for MAX32650 Jun 1, 2026
@ttmut ttmut merged commit fd76f44 into analogdevicesinc:main Jun 1, 2026
11 checks passed
@lorne-maxim

Copy link
Copy Markdown
Contributor

Were the changes of PR #1566 tested on actual hardware? On the MAX32650, SPI3 is on the AHB bus not the APB bus and is therefore clocked twice as fast as the other SPI peripherals. This can be confirmed in Table 2-3 of the user guide. These changes may need to be reverted.

@ttmut

ttmut commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Were the changes of PR #1566 tested on actual hardware? On the MAX32650, SPI3 is on the AHB bus not the APB bus and is therefore clocked twice as fast as the other SPI peripherals. This can be confirmed in Table 2-3 of the user guide. These changes may need to be reverted.

Makes sense but there is conflicting information in Table 19-7 (scaling formula uses PCLK). Also, in Table 1 in datasheet the maximum frequency is the same for all SPI instances.

@lorne-maxim

Copy link
Copy Markdown
Contributor

I think you (and the PR) may be correct). I've checked with a logic analyzer and having clocked from PCLK seems to be correct. I am still investigating, but you can ignore my comment for now.

@ttmut

ttmut commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for the clarification.

@lorne-maxim

lorne-maxim commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

After further investigation, it turns out the HW is internally scaling the values written to the clk_cfg register. Although SPI3 is on the AHB, the resulting output SPI clock is half of what should be expected given the values written to that register. Here are the exact changes the HW does internally for the fields in the clk_cfg register:

image

The bottom line -- This PR is correct as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MAX32650 Related to the MAX32650 (ME10)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants