This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Not able

pls help...

i'm working on LPC1114-FBD/301 series

On my board 4 LED's are connected to P0_8, P0_9, P0_10, P0_11.

I'v written a sample code toggle them. Only on 8 and 9 port pin LED's are blinking
but on 10 and 11 there state is always on. here is the sample code

/* by default P0_8 and P0_9 pins are GPIO's */ LED_DIR |= BIT(8); LED_DIR |= BIT(9);

/* 9th and 10th pins are not GPIO's on reset */ // i think here some changes required to make them as GPIO's IOCON_SWCLK_PIO0_10 |= 0x1; IOCON_R_PIO0_11 |= 0x1;

LED_DIR |= BIT(10); LED_DIR |= BIT(11);

  • What does your LED_DIR macro do?
    What does your BIT macro do?

  • they are jus macros...

    this is how they are defined

    LED_DIR GPIO0DIR /* PORT0 direction control register */
    BIT(n) (1<<n)

  • "not able to explain why T0's maximum clock rate has anything to do with using T1 to count pulses."

    Can't you post your age? The physical, that is. We do have an idea about the mental age, based on your constant, irrelevant, chatter all over the place.

    Why do you have to pollute every thread with an irrelevant debate?

  •                             ___________________________
                       /|  /|  |                          |
                       ||__||  |       Please don't       |
                      /   O O\__           feed           |
                     /          \       the trolls        |
                    /      \     \                        |
                   /   _    \     \ ----------------------
                  /    |\____\     \     ||
                 /     | | | |\____/     ||
                /       \|_|_|/   |    __||
               /  /  \            |____| ||
              /   |   | /|        |      --|
              |   |   |//         |____  --|
       * _    |  |_|_|_|          |     \-/
    *-- _--\ _ \     //           |
      /  _     \\ _ //   |        /
    *  /   \_ /- | -     |       |
      *      ___ c_c_c_C/ \C_c_c_c____________
    

  • 9th and 10th pins of PORT0 on LPC1114 are not GPIO's On reset. I used the following code to set them set them as GPIO's. But still its not working.

    #define LED_DIR GPIO0DIR
    #define BIT(n) (1<<n)

    IOCON_SWCLK_PIO0_10 |= 0x01;

    IOCON_R_PIO0_11 |= 0x01;

    delay( );

    LED_DIR |= BIT(10); LED_DIR |= BIT(11);

  • You write about 9th and 10th pin.

    But:
    bit 0 is 1st pin.
    bit 1 is 2nd.
    ...
    bit 8 is 9th
    bit 9 is 10th
    bit 10 is 11th.

    LED_DIR |= BIT(10);
    LED_DIR |= BIT(11);
    


    How is this 9th and 10th pin? BIT(10) controls the 11th (not 9th) pin for the port. BIT(11) controls the 12th (not 11th) pin for the port.

    But we assume that you do mean PIO0_10 and PIO0_11.

    IOCON_SWCLK_PIO0_10 |= 0x01;
    


    You are setting the least significant bit, without thinking about previous content. Should be ok since the reset value is 0 (unless there is another assign somewhere).

    Mode 2 (pull-up enabled) should be ok.

    IOCON_R_PIO0_11 |= 0x01;
    


    Assign should be ok since reset value is zero (unless you have another assign somewhere).
    Mode 2 should also be ok.

    Without having worked with your specific chip, it looks like PIO0_10 and PIO0_11 are set as GPIO output.

    Maybe IOCON_SCK_LOC is involved, but to me it looks like this register is only relevant when having selected the SWCLK option.

    What debugging have you done?

  • I'm using flash magic to burn the code.. i don't have any debugging options... Please guide me to configure P0_10 and P0_11 pins as GPIO's.

    Thanks in advance
    Sanjeev

  • They all want "guidance". Go get yourself a guru for god's sake!
    Per gave you the answer. Did you even read it?!

  • If you have _zero_ options for debugging (no JTAG, and not being able to use a serial port, oscilloscope, LEDs, ...) then maybe you should consider doing something else. Everything about embedded development is a continuous sequence of feedback loops. Read specifications/datasheets/... then do something then verify what happens then analyze the outcome and figure out if there is needs for corrections and new verifications. Because of this need for feedback during the work, you should never attempt a task without having figured out if you have reasonable ways to collect the evidence you need.

    An extra interesting thing here is that the boot-default for PIO0:10 is as SWCLK - serial wire clock for debug logic when in the Serial Wire Debug mode. On one hand, it might have been good if you had had the required equipment to use this Serial Wire Debug mode when writing your programs. On the other hand - maybe the two pins defaulting to debugging shouldn't be used for other tasks until you either know the chip well enough that you know that you can get away with developing without a hardware debugger.

    By the way - how do you know that your pins aren't actually correctly configured but your LEDs not correctly connected?

  • i'v tested the continuity between LED and the pins.. On reset there state is on..

  • "On" as in high?

    High as in strongly driven high or driven high by weak internal pull-up?

    High as in managing to light the LED?

    High as in managing to light the LED to full intensity?

    The next thing is of course that your very short post only mentions what you saw "on reset" - but what happens later?

    We haven't even seen your code that is expected to flash the LEDs.

    Or what your delay() function actually does.

  • On reset all the LED's are ON. I'v writtern a test code to toggle there states. After flashing the code all LED states should be toggled. But only LED's on P0_8 and p0_9 pins are getting toggled. Other two LED's connected on P0_10 and P0_11 are always ON.

    I'm sending the code. Pls review.

    #define LED_DIR GPIO0DIR
    #define BIT(n) (1<<n)

    void delay( )
    { unsigned int i = 0x40000; while ( i-- );
    } main ( ) {

    /* by default P0_8 and P0_9 pins are GPIO's */ LED_DIR |= BIT(8); LED_DIR |= BIT(9);

    /* 10th and 11th pins are not GPIO's on reset */

    IOCON_SWCLK_PIO0_10 |= 0x01; /* Set P0_10 pin as GPIO */

    IOCON_R_PIO0_11 |= 0x01; /* Set P0_11 pin as GPIO */

    LED_DIR |= BIT(10); LED_DIR |= BIT(11);

    while ( 1 ) { GPIO0DATA &= ~(BIT(8)); GPIO0DATA &= ~(BIT(9)); GPIO0DATA &= ~(BIT(10)); GPIO0DATA &= ~(BIT(11)); delay( ); delay( ); GPIO0DATA |= BIT(8); GPIO0DATA |= BIT(9); GPIO0DATA |= BIT(10); GPIO0DATA |= BIT(11); delay( ); delay( ); }
    }

  • if you don't have hardware debugging capabilities, you may want to simulate your code.

    i have no idea if your is right or not but the following may be more readable:

    #define LED_PORT GPIO0DATA //output data register where the leds are on
    #define LED_DIR GPIO0DIR
    #define BIT(n) (1<<n)
    #define LEDs (BIT(8) | BIT(9) | BIT(10) | BIT(11)) //leds on pin8/9/10/11
    #define LED_ON(leds) {LED_PORT |= (leds);}  //leds active on
    #define LED_OFF(leds) {LED_PORT &=~(leds);}  //leds active off
    #define LED_TOGGLE(leds) {LED_PORT ^= (leds);} //toggle leds
    
    void delay(unsigned long dly )
    { while ( dly-- );
    }
    
    void main (void ) {
    
    /* by default P0_8 and P0_9 pins are GPIO's */ LED_DIR |= BIT(8); LED_DIR |= BIT(9);
    
    /* 10th and 11th pins are not GPIO's on reset */
    
    IOCON_SWCLK_PIO0_10 |= 0x01; /* Set P0_10 pin as GPIO */
    
    IOCON_R_PIO0_11 |= 0x01; /* Set P0_11 pin as GPIO */
    
    LED_DIR |= BIT(10); LED_DIR |= BIT(11);
    
    while ( 1 ) {
      LED_TOGGLE(LEDs);  //toggle leds
      delay(0x40000 );  //waste some time
    }
    }
    

    this will be easier to read.

  • I'm sending the code. Pls review.
    please review the instructions Place source code source code .... in the yellow field of the reply (Enter Message Details Below) window

    why do you think anyone can do anything with what you saw in the preview?

    Erik