PLL0 PDEC calculation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PLL0 PDEC calculation

945 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jgorsk on Tue Oct 23 04:31:59 MST 2012
Is the PLL0 PDEC calculation  pseudo-code correct? It's producing different
values of PDEC than this tool (PLL Dialog)

http://www.lpcware.com/content/nxpfile/audio-pll-settings-calculation-tool

P_max=0x00000200, x=0x00000010;
switch (P) {
case 0: x = 0xFFFFFFFF;
case 1: x = 0x00000062;
case 2: x = 0x00000042;
default: for (i = P; i <= P_max; i++)
x = (((x ^ (x>>2)) & 1) << 4) | ((x>>1) & 0xF); }

PDEC[6:0] = x;


The values generated by PLL Dialog are correct.

Labels (1)
0 Kudos
6 Replies

720 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jgorsk on Wed Oct 31 11:06:35 MST 2012
Thanks for the update NXP_Paul.

Would you be able to give a brief idea of how to use SGPIO with DMA?
0 Kudos

720 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Paul on Wed Oct 31 08:33:31 MST 2012
jgorsk
I don't have a date when the next version of the LPC43xx User's Manual will be released.
We are aware that the SGPIO section of the manual needs improvement, and it is being addressed.
SGPIO example code is something that the NXP applications engineers are working on.
0 Kudos

720 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jgorsk on Tue Oct 30 09:50:26 MST 2012
When is the next revision of LPC43 User Manual going to be released?

Could you also add some more details regarding using SGPIO with DMA?
0 Kudos

720 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Paul on Tue Oct 30 06:50:16 MST 2012
We will be replacing the pseudo code found in the LPC18xx and LPC43xx User's Manuals with actual code:

#define PLL0_PSEL_MAX (1<<5)
#define PLL0_NSEL_MAX (1<<8)
#define PLL0_MSEL_MAX (1<<15)

/* post-divider: compute pdec from psel */
unsigned pdec_new (unsigned psel) {
   unsigned x=0x10, ip;
   switch (psel) {
      case 0: return 0xFFFFFFFF;
      case 1: return 0x62;
      case 2: return 0x42;
      default:for (ip = psel; ip <= PLL0_PSEL_MAX; ip++)
         x = ((x^x>>2) & 1)<<4 | x>>1 & x3F;
   return x;
}  }

/* pre-divider: compute ndec from nsel */
unsigned ndec_new (unsigned nsel) {
   unsigned x=0x80, in;
   switch (nsel) {
      case 0: return 0xFFFFFFFF;
      case 1: return 0x302;
      case 2: return 0x202;
      default:for (in = nsel; in <= PLL0_NSEL_MAX; in++)
         x = ((x^x>>2^x>>3^x>>4) & 1) << 7 | x>>1 & 0xFF;
   return x;
}  }

/* multiplier: compute mdec from msel */
unsigned mdec_new (unsigned msel) {
   unsigned x=0x4000, im;
   switch (msel) {
      case 0: return 0xFFFFFFFF;
      case 1: return 0x18003;
      case 2: return 0x10003;
      default: for (im = msel; im <= PLL0_MSEL_MAX; im++)
         x = ((x^x>>1) & 1)<< 14 | x>>1 & 0xFFFF;
   return x;
}  }

/* bandwidth: compute seli from msel */
unsigned anadeci_new (unsigned msel) {
   unsigned tmp;
   if (msel > 16384) return 1;
   if (msel >  8192) return 2;
   if (msel >  2048) return 4;
   if (msel >=  501) return 8;
   if (msel >=   60) {
      tmp=1024/(msel+9);
      return (1024==(tmp*(msel+9)))==0 ? tmp*4:(tmp+1)*4 ;
   }
   return (msel & 0x3c) + 4;
}

/* bandwidth: compute selp from msel */
unsigned anadecp_new (unsigned msel) {
   if (msel < 60) return (msel>>1) + 1;
   return 31;
}

Thank you for bringing this to our attention.
Regards
NXP Technical Support
0 Kudos

720 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jgorsk on Mon Oct 29 04:53:55 MST 2012
I think there is an error in the LPC43xx user manual regarding
the PDEC calculation. P_Max in the algorithm should be 0x20 not 0x200.
At least that's the case for PLL0AUDIO, I haven't checked PLL0USB
0 Kudos

720 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jgorsk on Wed Oct 24 23:40:41 MST 2012
Is anybody using PLL0AUDIO on the LPC43? Are the PDEC calculations working well for you?
0 Kudos