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

App PLL magic values #65

Open
xross opened this issue May 21, 2024 · 2 comments
Open

App PLL magic values #65

xross opened this issue May 21, 2024 · 2 comments

Comments

@xross
Copy link
Contributor

xross commented May 21, 2024

Ideally defines such as

#define APP_PLL_CTL_24M 0x0A006500

Would be built up from the required values using macros such as:

#define XS1_SS_FRAC_N_PERIOD_CYC_CNT_SHIFT 0x0
#define XS1_SS_FRAC_N_F_HIGH_CYC_CNT_SHIFT 0x8
#define XS1_SS_FRAC_N_ENABLE_SHIFT 0x1f

etc.

This would go some way for the code to self document, also means code should work on future device if bits are moved around in registers.

Also, it would be nice if these values were exposed in a header (rather than internal c file) such that other code can inspect/use. For example, the feedback code in USB Audio.

@xross
Copy link
Contributor Author

xross commented May 23, 2024

@ed-xmos
Copy link
Contributor

ed-xmos commented Sep 7, 2024

Agree this should be improved. These values are obtained from pll_calc.py and so it would make sense for this script to generate the broken down bitfields since it has awareness of these values anyway.

app_pll_ctl_reg = (1 << 27) | (((op_div)-1) << 23) | ((int(fb_div[0])-1) << 8) | (ref_div-1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants