Microchip-MPLAB-Harmony / audio

Harmony 3 Audio library
https://onlinedocs.microchip.com/v2/keyword-lookup?keyword=MH3_audio&redirect=true
Other
15 stars 5 forks source link

Find a bug for PIC32MZ series set reference clock #4

Closed flyerink closed 4 years ago

flyerink commented 4 years ago

In plib_i2s1.c function I2S1_RefClockSet.

Correct code start line 190 should be: // Don't update REFO1CON = REFO1CON & 0x0000000F; // Clear OE and ON, but keep rosel field while (REFO1CON & (1<<8)); // wait for Active bit to be 0

REFO1CON = (rodivInt<<16) | 0x200;      // replace with new value   
REFO1TRIM = rotrimInt << 23;

REFO1CONSET = 0x00001000 | 0x00008000;  // On bit, OE and Divswen = 1
// End
flyerink commented 4 years ago
// Don't update
uint32_t refclkConOld = REFO1CON;
REFO1CON = refclkConOld & 0x0000000F;   // Clear OE and ON, but keep rosel field
while (REFO1CON & (1<<8));              // wait for Active bit to be 0

REFO1CON = (rodivInt<<16) | 0x200;      // replace with new value   
REFO1TRIM = rotrimInt << 23;

REFO1CONSET = 0x00001000 | 0x00008000;  // On bit, OE and Divswen = 1
while (!(REFO1CON & (1<<8)));           // wait for Active bit to be 1
// End
flyerink commented 4 years ago

Recommend fix the temperature file