MuuTTa

Technology empowering people !

Testing with lpcxpresso

My first test is using a nxp ARM processor and LPC Xpresso IDE, because Jonathan have this platform in sensorica and i can use it.

lpcxpresso

The shematics of the board (from LPCXpresso Getting Started Guide)
lpc1343-target-side

dimensions of lpcxpresso lpc1343 and others

NXP ARM Cortex M3 blocks diagramfrom lpcware:
lpc1343-block-diagram

Memory map /!\ Very Important

In this post my notes as comments and the most important is:

Advertisements

40 comments on “Testing with lpcxpresso

  1. Fredy Rouge
    13 March 2013

    Realmente Odio esta palataforma, un eclipse modificado, para bajarlo me pidieron hasta el apellido de mi abuelita y no hay documentacion para usarlo desde la linea de comandos, me aburre eso de tener que generar codigos, activaciones de licencia y mas cuando solo necesito usar su toolchain, y lo peor hasta ahora eso no funciona, ni en windows ni en linux 😦

  2. Fredy Rouge
    13 March 2013

    After some test in my computer (linux) and other computers in sensorica lab is time to test this in my home computer, a new installation, only for test this.

  3. Fredy Rouge
    13 March 2013

    This fck sw need to restart the machine!!!!! in Linux, bad bad bad

  4. Fredy Rouge
    13 March 2013

    Now works!!!!! blinking, puting the firmware, erasing the memory and puting again the firmware, cleaning and compiling and again, this works.

  5. Fredy Rouge
    14 March 2013

    BT Stack:
    http://code.google.com/p/btstack/

    I not know but in the videos i found one for cortex m3:

  6. Fredy Rouge
    14 March 2013

    I think that my board (1114) is not an ARM M3 😦

    But I think Jonathan have a arm m3 board 🙂

  7. Fredy Rouge
    19 March 2013

    Now using board LPC1343, I do the example of blinking, the example comes with warnings but work, i do the importation of all the examples in examples.lpc13xx.new.zip, i do the compilation of all and after I put the binary using the chip button.

  8. Fredy Rouge
    19 March 2013

    For the LPC1343, import only the blinky example from examples.lpc13xx.new.zip not works.

  9. Fredy Rouge
    19 March 2013

    The Definitive Guide to the ARM Cortex-M3:
    http://www.arm.com/support/resources/arm-books/the-definitive-guide-to-the-arm-cortex-m3.php

    Interesante pero veo que los dos primeros capitulos no vienen con ejemplos, necesito encontrar algo con ejemplos de codigo en C

  10. Fredy Rouge
    19 March 2013

    This manual is important as reference:
    http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/index.html

    But I need code examples.

  11. Fredy Rouge
    21 March 2013

    Revisar:
    * Diferencia entre GIPIO y PIO
    * Mirar en detalle que son: uint32_t portNum, uint32_t bitPosi, uint32_t dir, uint32_t sense, uint32_t single, uint32_t event

  12. Fredy Rouge
    21 March 2013

    Last comment is about the GPIO example inside lpcxpresso

  13. Fredy Rouge
    21 March 2013

    For GPIO: http://en.wikipedia.org/wiki/General_Purpose_Input/Output

    For PIO this example:

    PIO02 = Port (imput/output) number 0 bit 2

    5 ports, from 0 to 4 and
    Each port with 32 bits, from 0 to 31

  14. Fredy Rouge
    21 March 2013

    Mirando en el esquematico me doy cuenta que esta board/procesador tiene 4 puertos pero:

    Puertos 0, 1 y 2 tienen 12 bits, de 0 a 11
    Puerto 3 tiene solamente 4 bits, de 0 a 3

  15. Fredy Rouge
    21 March 2013

    Mirando el diagrama me doy cuenta que el LED2 (el que viene en la board) está conectado en el P.07, conecto led externo (con resistencia) y funciona.

  16. Fredy Rouge
    21 March 2013

    Cambio el codigo del ejemplo de blinki para usar el P.06 con led externo y funciona!

    /*****************************************************************************
     *   blinky.c:  LED blinky C file for NXP LPC13xx Family Microprocessors
     *
     *   Copyright(C) 2008, NXP Semiconductor
     *   All rights reserved.
     *
     *   History
     *   2008.08.20  ver 1.00    Preliminary version, first Release
     *
    ******************************************************************************/
    
    #include "LPC13xx.h"                        /* LPC13xx definitions */
    #include "clkconfig.h"
    #include "gpio.h"
    #include "config.h"
    
    #include "timer32.h"
    
    /* Main Program */
    
    int main (void) {
      /* Basic chip initialization is taken care of in SystemInit() called
       * from the startup code. SystemInit() and chip settings are defined
       * in the CMSIS system_<part family>.c file.
       */
    
      /* Initialize 32-bit timer 0. TIME_INTERVAL is defined as 10mS */
      /* You may also want to use the Cortex SysTick timer to do this */
      init_timer32(0, TIME_INTERVAL);
      /* Enable timer 0. Our interrupt handler will begin incrementing
       * the TimeTick global each time timer 0 matches and resets.
       */
      enable_timer32(0);
    
      /* Initialize GPIO (sets up clock) */
      GPIOInit();
      /* Set LED port pin to output */
      GPIOSetDir( 0, 6, 1 );
    
      while (1)                                /* Loop forever */
      {
    	/* Each time we wake up... */
    	/* Check TimeTick to see whether to set or clear the LED I/O pin */
    	if ( (timer32_0_counter%LED_TOGGLE_TICKS) < (LED_TOGGLE_TICKS/2) )
    	{
    	  GPIOSetValue( 0, 6, LED_OFF );
    	} else
    	{
    	  GPIOSetValue( 0, 6, LED_ON );
    	}
        /* Go to sleep to save power between timer interrupts */
        __WFI();
      }
    }
    

    Para la proxima leer en un puerto y escribir en el otro.

  17. Fredy Rouge
    22 March 2013

    Alternate blinking 🙂

    /*****************************************************************************
     *   blinky.c:  LED blinky C file for NXP LPC13xx Family Microprocessors
     *
     *   Copyright(C) 2008, NXP Semiconductor
     *   All rights reserved.
     *
     *   History
     *   2008.08.20  ver 1.00    Preliminary version, first Release
     *
    ******************************************************************************/
    
    #include "LPC13xx.h"                        /* LPC13xx definitions */
    #include "clkconfig.h"
    #include "gpio.h"
    #include "config.h"
    
    #include "timer32.h"
    
    /* Main Program */
    
    int main (void) {
      /* Basic chip initialization is taken care of in SystemInit() called
       * from the startup code. SystemInit() and chip settings are defined
       * in the CMSIS system_<part family>.c file.
       */
    
      /* Initialize 32-bit timer 0. TIME_INTERVAL is defined as 10mS */
      /* You may also want to use the Cortex SysTick timer to do this */
      init_timer32(0, TIME_INTERVAL);
      /* Enable timer 0. Our interrupt handler will begin incrementing
       * the TimeTick global each time timer 0 matches and resets.
       */
      enable_timer32(0);
    
      /* Initialize GPIO (sets up clock) */
      GPIOInit();
    
      GPIOSetDir( 0, 7, 1 ); /* Set LED port pin to output */
      GPIOSetDir( 0, 6, 1 ); /* Set LED port pin to output */
    
      while (1)                                /* Loop forever */
      {
    	/* Each time we wake up... */
    	/* Check TimeTick to see whether to set or clear the LED I/O pin */
    	if ( (timer32_0_counter%LED_TOGGLE_TICKS) < (LED_TOGGLE_TICKS/2) )
    	{
    		GPIOSetValue( 0, 7, LED_ON );
    		GPIOSetValue( 0, 6, LED_OFF );
    
    	} else
    	{
    		GPIOSetValue( 0, 7, LED_OFF );
    		GPIOSetValue( 0, 6, LED_ON );
    	}
        /* Go to sleep to save power between timer interrupts */
        __WFI();
      }
    }
    
  18. Fredy Rouge
    22 March 2013

    Understanding GPIOSetDir function:
    GPIOSetDir( 0, 7, 1 ); /* (Port 0, Bit 7, as OUTPUT) */
    GPIOSetDir( PORT0, 0, 0 ); /* Port0, Bit0, as INPUT */

    El tercer parámetro de la función es dir, que significa dirección y puede ser input (0) ó output (1)

  19. Fredy Rouge
    22 March 2013

    For the next:
    Leer en un bit y escribir en otro, mirar codigo que me pasó Jonathan, parece que la clave es la función GPIOIntStatus, for example:

    if ( GPIOIntStatus( 0, 0 )==1 ) …

    From http://knowledgebase.nxp.trimm.net/showthread.php?t=502

  20. Tony Liu (@tonyliu4)
    22 March 2013

    Looks good, keep it up!

  21. Fredy Rouge
    26 March 2013

    I need understand the C code for the processor, some like =& or =| is .. the avr code but I not remember 😦

    Now reading this guide:
    http://www.ee.ic.ac.uk/pcheung/teaching/ee2_computing/arm/Progtech.pdf

  22. Fredy Rouge
    26 March 2013

    Not, isn’t what I need, i need examples!

  23. Fredy Rouge
    26 March 2013

    Lo que estoy buscando se llama Bitwise Operators in C

  24. Fredy Rouge
    26 March 2013

    Ok now i understand:

    ~ is not
    & is and
    | is or
    ^ is xor

    And this is the example:

    unsigned int orig   = 0xF0F0;          // 1111 0000 1111 0000
    unsigned int insert = 0x000A;          // 0000 0000 0000 1010
     
    unsigned int a = orig | (insert << 8); // 1111 1010 1111 0000
    unsigned int b = orig | (insert << 6); // 1111 0010 1111 0000
    
  25. Fredy Rouge
    26 March 2013

    a &= b is a = a & b
    a |= b is a = a | b
    a ^= b is a = a ^ b
    a <<= b is a = a << b
    a >>= b is a = a >> b

    source: http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Compound_assignment_operators

  26. Fredy Rouge
    26 March 2013

    GPIOIntStatus () //no funciona 😦

  27. Fredy Rouge
    27 March 2013

    Or the IDE and the examples are &*)%& or I’m wroooooong

  28. Fredy Rouge
    29 March 2013

    Not works but i put this code as reference

    #include "LPC13xx.h"			/* LPC13xx Peripheral Registers */
    #include "gpio.h"
    
    
    int main ()
    {
      GPIOInit();
    
    
      GPIOSetDir( 3, 1, 0 );
      GPIOSetInterrupt( 3, 1, 1, 0, 0 );
      GPIOIntEnable( 3, 1 );
    
      GPIOSetDir( 0, 7, 1 ); /* Set port0_7 (LED2 in board) as output */
    
    while(1) {
    		  uint32_t regVal;
    		  regVal = 0x1;
    		  regVal = (LPC_GPIO3->MIS & (0x1<<1)) ? 1 : 0;
    		  if (regVal) {
    			  GPIOSetValue( 0, 7, 1 ); /* Turn ????? the LED */
    		  }
    		  else {
    			  GPIOSetValue( 0, 7, 0 ); /* Turn ????? the LED */
    		  }
    		  GPIOIntClear(3, 1);
         }
    return 0;
    }
    
  29. Fredy Rouge
    29 March 2013

    GPIOSetInterrupt( PORT3, 1, 1, 0, 0 );

    Port 3, pin 1, si hay un nivel fijo, NO SE, si el nivel es bajo

    en la tercera posición lo que entiendo es que usando:
    * 0 es para detectar un cambio de nivel alto a bajo o lo contrario
    * 1 es para detectar si hay un nivel alto o bajo

    La última posición determina si lo que se mira en la tercera posición, es por ejemplo para el caso del nivel fijo, un 0 detecta un nivel alto y un 1 un nivel bajo.

  30. Fredy Rouge
    29 March 2013

    Is time to change, I will use arduino, for now i think that nxp + lpcxpresso is %(&$

  31. davide
    16 May 2013

    Ho semplicemente aggiunto il tuo feed all’RSS Reader… continuo a seguirvi, Grazie!

  32. Fredy Rouge
    17 May 2013

    You add the feed of this post comments or the feed of the blog?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on 13 March 2013 by in MuuTTaWand Concept 1.