- Home
- :
- General Purpose Microcontrollers
- :
- LPC Microcontrollers
- :
- PLL0 PDEC calculation

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

PLL0 PDEC calculation

06-15-2016
12:11 PM

281 Views

lpcware

NXP Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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.

6 Replies

06-15-2016
12:11 PM

56 Views

lpcware

NXP Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Thanks for the update NXP_Paul.

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

06-15-2016
12:11 PM

56 Views

lpcware

NXP Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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.

06-15-2016
12:11 PM

56 Views

lpcware

NXP Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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?

06-15-2016
12:11 PM

56 Views

lpcware

NXP Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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

06-15-2016
12:11 PM

56 Views

lpcware

NXP Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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

06-15-2016
12:11 PM

56 Views

lpcware

NXP Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Is anybody using PLL0AUDIO on the LPC43? Are the PDEC calculations working well for you?