Skip to content

Commit

Permalink
fixed utmi
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirCuE committed Jun 17, 2024
1 parent 6c2523c commit 45fb9f6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
25 changes: 25 additions & 0 deletions ARM/gcc_clang/def/ATSAMV71Q21B.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
{
"config_registers": [
{
"address": "400E0430",
"default": "00010000",
"fields": [
{
"hidden": false,
"init": "00000000",
"key": "FREQ",
"label": "UTMI Reference Clock Frequency",
"mask": "00000003",
"settings": [
{
"label": "12 MHz reference clock",
"value": "00000000"
},
{
"label": "16 MHz reference clock",
"value": "00000001"
}
]
}
],
"key": "UTMI_CKTRIM",
"unused": "FFFFFFFC"
},
{
"address": "400E0600",
"default": "00000000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,18 @@ static void _pmc_init_sources(void)

// If UPLL is enabled.
if (CKGR_UCKR_UPLLEN == (VALUE_CKGR_UCKR & CKGR_UCKR_UPLLEN_Msk)) {
UTMI->UTMI_CKTRIM = VALUE_UTMI_CKTRIM;
// Configure UPLL.
PMC->CKGR_UCKR = VALUE_CKGR_UCKR;
while (PMC_SR_LOCKU != (PMC->PMC_SR & PMC_SR_LOCKU_Msk)) {
/* Wait until USB UTMI stabilize */
}
data = PMC->PMC_MCKR & ~PMC_MCKR_UPLLDIV_Msk;
data |= VALUE_PMC_MCKR & PMC_MCKR_UPLLDIV_Msk;
PMC->PMC_MCKR = data;
while (PMC_SR_MCKRDY != (PMC->PMC_SR & PMC_SR_MCKRDY)) {
/* Wait until master clock is ready */
}
} else {
// Disasble UPLL.
PMC->CKGR_UCKR &= ~CKGR_UCKR_UPLLEN;
Expand Down

0 comments on commit 45fb9f6

Please sign in to comment.