lpc1311 trouble

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

lpc1311 trouble

727 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ursus_inL on Wed Jan 22 03:07:27 MST 2014
Hi!
I decided try out lpc1311 as i find it prefect for undemanding projects because of size/cost. This is my first time dealing with cortex processors (previously i used arm7 procs like LPC2148 and atmegas).
i've designed a simple board (sch attached: lpc1311_sch_ursus.pdf).
I can successfully flash the device using flashmagic (write hex, read flash data...),[u] but gpio pins are always at 2.2V[/u] (as if they where inputs).

Here is the example of the code i tryed:
#include "LPC13xx.h"

int main(void) {

     LPC_SYSCON->SYSAHBCLKCTRL  |= (1<<6);    //GPIO clk en
     LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);              //IOCON clk en
     LPC_SYSCON->SYSAHBCLKCTRL   |= 0x7ffff;        //en all clk


     LPC_IOCON->PIO0_7            = 0xD;            //pin function : 0011010000=> 0x0D0
     LPC_GPIO0->DIR              |= (1<<7);                     //pin direction

     LPC_GPIO0->DATA           &= ~(1<<7);                   //set pin low

  /*   while(1){                      // loop - commented out for now...

          LPC_GPIO0->DATA           |= (1<<7);    //set pin high
          for(i=0; i<0x10000; ++i);             
          LPC_GPIO0->DATA           &= ~(1<<7);   //set pin low
          for(i=0; i<0x10000; ++i);              

     } //end while
*/
} //end main



Did i miss something when designing HW or is it a software problem? It looks to me as if the processor does not reach the main function code.

Thank you for your help
Labels (1)
0 Kudos
5 Replies

659 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Jan 22 14:13:08 MST 2014

Quote: ursus_inL
I would guess it's number 3. Anyways tried same code in Keil and CoIDE.
Both projects are attached...



Surprisingly enough I'm not using Keil or CooCox...

Anyway, I would strongly recommend to use a debugger to check registers and their contents.

IIRC there is a cheap simple IDE with debugger support called LPCXpresso, which can save a lot of time...

BTW: This line is obviously nonsense:

 LPC_IOCON->PIO0_7            =[color=#f30] 0xD[/color];    //pin function : 0011010000=> [color=#f00]0x0D0[/color] 


0 Kudos

659 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ursus_inL on Wed Jan 22 05:14:48 MST 2014

I would guess it's number 3. Anyways tried same code in Keil and CoIDE.
Both projects are attached...
0 Kudos

659 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Jan 22 04:47:02 MST 2014

Quote: ursus_inL
any other ideas?



1. Your code is not working...

2. Your hex isn't valid...

3. Your clock setup is wrong...

Without seeing your project it's just guessing. You didn't give us a hint which IDE you are using and how you are generating your hex file...
0 Kudos

659 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ursus_inL on Wed Jan 22 04:10:40 MST 2014

Quote:
R2D2 wrote:
You are pulling ISP pin low. Usually it's pulled high and just grounded if you want to use ISP...



Thanks for your answer and yes, that is an error. i don't know why i did it ;) sadly this is [u]not the source of trouble[/u]. I already placed a resistor to pol ISP pin high, not low. forgot to mention it before..

any other ideas?
0 Kudos

659 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Jan 22 03:38:40 MST 2014

Quote: ursus_inL


Did i miss something when designing HW...



You are pulling ISP pin low. Usually it's pulled high and just grounded if you want to use ISP...
0 Kudos