LPCXpresso/LPC114FN28/102 questions

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

LPCXpresso/LPC114FN28/102 questions

906 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jschimpf255 on Wed Jun 18 10:01:20 MST 2014
Hi,
  I have gotten LCPXpresso + Link-2 pod + DIP28 package LPC1114.  I have it hooked up the pod up to a breadboarded LPC1114 DIP chip.  The pod + processor work that is I can load/debug and run code. 

  The problem,  I have some of my code and some of the LPCXExpresso's samples built and run this way but they never make it to main()  the code hangs in board_sysinit.c in the line:

/* Wait for PLL to lock */
while (!Chip_Clock_IsSystemPLLLocked()) {}

where Chip_Clock_IsSystemPLLLocked() is:

STATIC INLINE bool Chip_Clock_IsSystemPLLLocked(void)
{
return (bool) ((LPC_SYSCTL->SYSPLLSTAT & 1) != 0);
}

The structure is all 0's

  I have configured the project for the MCU of LPC11xx -> LPC1114/201 since there wasn't 101 in the list.  Is there some other configuration needed ?  I checked in board_sysinit.c and it is set for the internal oscillator as the clock source.

  Also the Link-2 pod would not connect to the processor till I put a Jumper on J2.  It said it wasn't getting an ACK and after the Jumper it all works fine.  I have GND, SWDIO,SWCLK and nRESET hooked from the Link-2 to the processor on a breadboard.  (For the record I never see nRESET toggled is this correct ?)

  This is all running on Mac Book Pro OSX 10.9.3 and I am delighted that you support the Mac so well.

  --jim schimpf
Labels (1)
0 Kudos
18 Replies

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jschimpf255 on Fri Jun 20 09:30:24 MST 2014
Hi,
I downloaded the lpcopen_v2_00a_lpcxpresso_nxp_lpcxpresso_11c24 and edited the board_sysinit.c (getting really good at that...)  the changes below and blinky works !!!!!!

/* Powerup main oscillator */
// Don't start MAIN
//Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSOSC_PD);

/* Wait 200us for OSC to be stablized, no status
   indication, dummy wait. */
for (i = 0; i < 0x100; i++) {}

/* Set system PLL input to main oscillator */
// USE RC OSC
Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_IRC);

Again thank you for hitting me on the head with correct solution.

After the fact I figured out the the 11U library I downloaded was a version with USB and I don't have USB (slaps face)

--jim schimpf
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Fri Jun 20 08:00:42 MST 2014
You are successfully confusing yourself with using the wrong LPCopen version (as mentioned twice already)  :)

U-version chips are newer and a little bit different. So just use LPC111x or LPC11Cxx version, they are both old...

Using crystal or IRC doesn't change GPIO behaviour...
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jschimpf255 on Fri Jun 20 07:48:07 MST 2014
I disabled both power ups of both clocks and it still makes it past the while loop for PLL power up but it will not make it past the while loop for USB PLL at the end of the routine. I have to comment that out.  Oh yea initially it would make it past the USB while loop but now it doesn't (?????).

Also writing to GPIO direction registers does work.  That is I can read them but cannot change the value.  It seems I have something fundamentally wrong here but it does the same thing with the NXP sample code as it does with my test stuff.

Also I have two chips and they behave exactly the same so I don't think I've blown something.

Debugging and single stepping works fine but no I/O works even the simplest thing.  Should I try to put a crystal on it, would that make any difference ?

Thanks again for your help.

--jim schimpf
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Fri Jun 20 07:19:48 MST 2014

Quote: jschimpf255
I will check all of those things thank you for listing them.  First I have news on the clock front.  If I change board_sysinit.c to this:

/* Powerup main oscillator */
//Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSOSC_PD);
// Really power up the RC OSC
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_IRC_PD);


Where I power up the RC OSC then those while loops waiting for the PLL work fine.  Should I power up both or just the one as I have ?



Actually none  :O  Of course it makes no sense to power up SYSOSC without crystal.

And IRC is default clock source and should be enabled by default. If enabling IRC (=disabling IRC power down) is changing startup behaviour it's a good idea to check this bit...
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jschimpf255 on Fri Jun 20 06:27:45 MST 2014
I will check all of those things thank you for listing them.  First I have news on the clock front.  If I change board_sysinit.c to this:

/* Powerup main oscillator */
//Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSOSC_PD);
// Really power up the RC OSC
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_IRC_PD);


Where I power up the RC OSC then those while loops waiting for the PLL work fine.  Should I power up both or just the one as I have ?

I have been playing with the Blinky code and have moved a lot of the MACRO and INLINE code into my space so I can step through it and see what happens.

So I have this very pedantic form:


void MY_GPIO_SetPinDIROutput(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
{
int val;
int pin_val;

pin_val = 1UL << pin;

val = pGPIO->DIR[port];

pGPIO->DIR[port] = pin_val | val;

val = pGPIO->DIR[port];
}

When I go in there my pin_value is 128 (0x80) (PIO0_7) and the current value of the port is 2048 (0x800).  When I do the equate:

pGPIO->DIR[port] = pin_val | val;

then look at the value in the register it's still 2048 so the write didn't work.  Will look at all the points you suggest and see what I can find.

Thank you again.
--jim schimpf
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Fri Jun 20 06:00:35 MST 2014
Is the SYSAHBCLKCTRL bit 6 enabled?
SYSAHBCLKCTRL bit 16 (IOCON)?
What about the IOCON_PIO0_7 register?
Have you set the pin to output? Default is input.

Can you check all of the above?

0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jschimpf255 on Fri Jun 20 04:53:40 MST 2014
Ok I have gone to the nxp_expresso_11u14_periph_blinky project.  I have cleaned rebuilt the libraries and project using the MCU setting LPC11xx->LPC1114/201 (is that right for my 28PIN DIP Part ? ) .

From the listing this should run an LED attached to PIO0_7 when I step through the code I can watch each thing happen but nothing appears on the Pin. I watch the GPIO PIO0_7 set false and the pin still sits at 1.72 volts, when set to true still 1.72 volts.  Like it was never set to an output.

I can watch the code run breakpointing the interrupts and stepping through them just nothing happens on the I/O pins.

I cannot find any LPC1114/102 parts in any of the MCU choices do I need a different library ? (I have lpcopen_v2_00a_lpcxpresso_nxp_lpcxpresso_11u14 is that right ?) I used the LPC11xx->LPC1114/201 setting.

Also I removed the pullup/pulldown resistors on the SWDIO & SWCLK lines with no ill effects, debugging still works fine.

It looks like the core works fine/runs fine but I am not getting any connection to the pins on the chip.

Thanks again for the help.
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Thu Jun 19 16:57:06 MST 2014
Just to ensure that we are not forgetting the simple things  :)

Did you Clean/Build board library and then your project?
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jschimpf255 on Thu Jun 19 16:04:28 MST 2014
Hi,
I got the LPC11C24 LPCOpen package and compared the board package listings for the LPC11u14 and the chip package listings and could not find any significant differences.  There were pin differences but the code seemed identical.  In particular the listing I have above with the PLL loops where it sticks are identical.  We have ordered an LPC1114 evm board and will see what happens with the code on it. 

Thanks again

--jim schimpf
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Thu Jun 19 14:49:48 MST 2014
10k pull-ups for Reset (PIO0_0) and ISP (PIO0_1) are usually a good choice...
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jschimpf255 on Thu Jun 19 14:22:29 MST 2014
Thank you again.

I am running the 28Pin DIP on a breadboard, so I will pull off the surplus resistors and see what happens.  I do have 10K pullup resistors on RESET and PIO1 (?) (not at the board right but the pin next to RESET that when low causes the boot code to run on RESET).

I have not gotten the LPC11c2 open code but I will look for it and compare with what I have.  I do have more than one chip and have tried both and they behave identically.

Thank you again for your patience.

--jim schimpf
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Thu Jun 19 10:39:42 MST 2014
Usually there are no SWD pull-ups or pull-downs required on your target board. We never add them since years...

Usually Debugger hardware is pulling up required signals (Link is doing that, Link2 is doing that with closed J2)...

I'm not sure why your PLL isn't running. We are using LPC11C14 boards with IRC and PLL since years without problems...

Did you pull-up the important signals (Reset / ISP)?

Is your board working without debugger?

As mentioned already, i would strongly recommend to change LPCOpen version.
LPC1114 has no USB and no USB PLL  :) 
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jschimpf255 on Thu Jun 19 08:21:43 MST 2014
Hi,
   Thanks for the quick reply.  One USB note on OS X, when I run the debugger some times (first use ?) it seems to disconnect a hard drive I have connected to the same USB hub.  I will try moving around USB and see what happens.

First thanks for the J2 reason.  I do have a 15K pull up on the SWDIO line and a 15K pulldown on the SWCLK line.  This was copied from your LCPXpresso Experiment Board schematic rev PA4.

Second I have tried the sysinit fix you suggest:

/* Setup system clocking */
STATIC void SystemSetupClocking(void)
{
// Changes from LabRat comments
//volatile int i;
//
///* Powerup main oscillator */
//Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSOSC_PD);
//
///* Wait 200us for OSC to be stablized, no status
//   indication, dummy wait. */
//for (i = 0; i < 0x100; i++) {}

/* Set system PLL input to main oscillator */
//Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);// Use internal
Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_IRC);// Use internal

/* Power down PLL to change the PLL divider ratio */
Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_SYSPLL_PD);

/* Setup PLL for main oscillator rate (FCLKIN = 12MHz) * 4 = 48MHz
   MSEL = 3 (this is pre-decremented), PSEL = 1 (for P = 2)
   FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 4 = 48MHz
   FCCO = FCLKOUT * 2 * P = 48MHz * 2 * 2 = 192MHz (within FCCO range) */
Chip_Clock_SetupSystemPLL(3, 1);

/* Powerup system PLL */
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSPLL_PD);

/* Wait for PLL to lock */
//while (!Chip_Clock_IsSystemPLLLocked()) {}

/* Set system clock divider to 1 */
Chip_Clock_SetSysClockDiv(1);

/* Setup FLASH access to 3 clocks */
Chip_FMC_SetFLASHAccess(FLASHTIM_50MHZ_CPU);

/* Set main clock source to the system PLL. This will drive 48MHz
   for the main clock and 48MHz for the system clock */
Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_PLLOUT);

/* Set USB PLL input to main oscillator */
Chip_Clock_SetUSBPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);
/* Setup USB PLL  (FCLKIN = 12MHz) * 4 = 48MHz
   MSEL = 3 (this is pre-decremented), PSEL = 1 (for P = 2)
   FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 4 = 48MHz
   FCCO = FCLKOUT * 2 * P = 48MHz * 2 * 2 = 192MHz (within FCCO range) */
Chip_Clock_SetupUSBPLL(3, 1);

/* Powerup USB PLL */
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_USBPLL_PD);

/* Wait for PLL to lock */
while (!Chip_Clock_IsUSBPLLLocked()) {}
}

and it did not change.  One change I did try was to comment out the two WHILE loops waiting for the PLL, this did make a difference.  The code then made it though the init and hit the standard breakpoint in main().  This is not correct but did encourage me that the IDE/DEBUGGER/CHIP system is working

Thanks again for all the help.

--jim schimpf
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Thu Jun 19 06:19:17 MST 2014
I would suggest to start with a simple sample (nxp_lpcxpresso_11c24_periph_blinky)

and use LPCOpen LPC11c24 version. There's no LPCOpen LPC1114 version, but 11C24 is very similar...

Your clock setup is not too wrong, with IRC you don't need to power SYSOSC (= crystal):
/* Setup system clocking */
STATIC void SystemSetupClocking(void)
{
 [color=#f00]//volatile int i;

//This board has no external crystal !!----------------------------------------

///* Powerup main oscillator */
//Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSOSC_PD);
//
///* Wait 200us for OSC to be stablized, no status
//   indication, dummy wait. */
//for (i = 0; i < 0x100; i++) {}[/color]

/* Set system PLL input to main oscillator */
//Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);
Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_IRC);

/* Power down PLL to change the PLL divider ratio */
Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_SYSPLL_PD);

/* Setup PLL for main oscillator rate (FCLKIN = 12MHz) * 4 = 48MHz
   MSEL = 3 (this is pre-decremented), PSEL = 1 (for P = 2)
   FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 4 = 48MHz
   FCCO = FCLKOUT * 2 * P = 48MHz * 2 * 2 = 192MHz (within FCCO range) */
Chip_Clock_SetupSystemPLL(3, 1);

/* Powerup system PLL */
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSPLL_PD);

/* Wait for PLL to lock */
while (!Chip_Clock_IsSystemPLLLocked()) {}

/* Set system clock divider to 1 */
Chip_Clock_SetSysClockDiv(1);

/* Setup FLASH access to 3 clocks */
Chip_FMC_SetFLASHAccess(FLASHTIM_50MHZ_CPU);

/* Set main clock source to the system PLL. This will drive 48MHz
   for the main clock and 48MHz for the system clock */
Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_PLLOUT);
}
 

[color=#f00][u]
J2 Confusion:[/u]
[/color]

J2 is also used to supply VIO_BUF_B. With simple boards (simple SWD connection) this jumper has to be closed, or R38 (1k) has to be added...
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Jun 19 05:58:43 MST 2014

Quote: jschimpf255


---Chip markings (misread them...)
The chip I have is marked with a 102 not 101, sorry misread the very faint markings.  But still there is no LCP1114/102 in my list of MCU settings.



Most of the time, we try to avoid the package information in the list of parts provided within LPCXpresso. But in this case, you need to select either LPC1114FD/102 or LPC1114FN/102 (you can actually use either - the tools see them as being the identical).

Regards,
LPCXpresso Support
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jschimpf255 on Thu Jun 19 04:53:23 MST 2014
Thank you all for your help, answers to your questions are below.

---Chip markings (misread them...)
The chip I have is marked with a 102 not 101, sorry misread the very faint markings.  But still there is no LCP1114/102 in my list of MCU settings.

---On the Jumper use on the Link-2
My test breadboard is powered from a lab power supply and I don't connect to the Vdd from the probe. (Just mRESET,GND,SWCLK,SWDIO) ,  If I leave off the J2 and try to load code I get:

Error: Error reported by server (relinkserv):
RedlinkAPI: Wire Ack Fault - target connected?
Redlink Server have been terminated and will be restarted.
     :
     :

If I put in J2 on the Link-2 board it works fine.

--Clock PLL problem
And lastly on the hanging waiting for the PLL.  I am using the nxp_epressso_11U14_freertos_blinky sample project.  I don't make any changes in the code so whatever clock setup it uses is what I use.  Can you offer any suggested changes I should make here ?

STATIC void SystemSetupClocking(void)
{
volatile int i;

/* Powerup main oscillator */
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSOSC_PD);

/* Wait 200us for OSC to be stablized, no status
   indication, dummy wait. */
for (i = 0; i < 0x100; i++) {}

/* Set system PLL input to main oscillator */
Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);

/* Power down PLL to change the PLL divider ratio */
Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_SYSPLL_PD);

/* Setup PLL for main oscillator rate (FCLKIN = 12MHz) * 4 = 48MHz
   MSEL = 3 (this is pre-decremented), PSEL = 1 (for P = 2)
   FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 4 = 48MHz
   FCCO = FCLKOUT * 2 * P = 48MHz * 2 * 2 = 192MHz (within FCCO range) */
Chip_Clock_SetupSystemPLL(3, 1);

/* Powerup system PLL */
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSPLL_PD);

/* Wait for PLL to lock */
while (!Chip_Clock_IsSystemPLLLocked()) {}

-------------------

I changed the line where is selects the main OSC to use SYSCTL_PLLCLKSRC_IRC

i.e.changed
/* Set system PLL input to main oscillator */
Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);

to

/* Set system PLL input to main oscillator */
Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_IRC);

and it still hangs in the same place.

Thank you all for your help.  I really really like the tools.

   --jim schimpf

0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Jun 19 00:03:38 MST 2014

Quote: jschimpf255

  I have configured the project for the MCU of LPC11xx -> LPC1114/201 since there wasn't 101 in the list.



Can you confirm the exact markings on your chip? I'm not aware of a 101 variant of the LPC1114 parts. Are you sure you don't have a '102' ?


Quote:

  Also the Link-2 pod would not connect to the processor till I put a Jumper on J2.  It said it wasn't getting an ACK and after the Jumper it all works fine.


This suggests that you were not powering the target board. J2 controls whether the LPC-Link2 provides power to the target (see http://www.lpcware.com/lpclink2). Doing this is only recommend for 'small' boards with 'low' power requirements. So certainly not if your board has an LCD on it for example!


Quote:

  I have GND, SWDIO,SWCLK and nRESET hooked from the Link-2 to the processor on a breadboard.  (For the record I never see nRESET toggled is this correct ?)


Our recommendations for debug/reset circuitry are as detailed at http://www.lpcware.com/content/faq/lpcxpresso/debug-design

Depending upon debug probe, debug options selected, tools used, tools version etc, you may find things work without following these to the letter (as others have highlighted).  But generally we recommend following them as you are much more likely to get a successful and reliable debug connection (particularly if you have not done similar LPC based design before). Thus leading to less stress for you in your development, and less support for us!

Regards,
LPCXpresso Support
0 Kudos

752 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Wed Jun 18 11:46:01 MST 2014
Probably your setup (SysInit) is wrong. You could try to work with IRC without PLL meanwhile and post your clock setup...

And yes, LPC1114 SWD is not using Reset  :)

See: http://www.lpcware.com/content/forum/lpc15xx-minimal-swd
0 Kudos