Newbie to NXP cortex, uart question

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

Newbie to NXP cortex, uart question

1,110 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by matt6ft9 on Wed Jun 27 07:38:49 MST 2012
I have the LPCXpresso board with an LPC1114F/302.   I’m using v4.2.3 (build 292) of the LPCXpresso development platform on a windows xp machine.  The samples compile and run on the LPCXpresso board.  I would like to modify the “blinky” example to spit a few characters out of the UART when the LED blinks.  An
#include  “uart.h”
  Was added to the top of the blink_main.c file.  But, when I put in:
 
UARTInit(UART_BAUD);
  I get an “undefined reference to UARTInit” error.  The UART_BAUD is set to 115200.  The uart.c and uart.h files are included under “drivers” in the blinky project.  Here is my complete code:
  
#include "uart.h"

#include "driver_config.h"
#include "target_config.h"

#include "timer32.h"
#include "gpio.h"


//extern volatile uint32_t UARTCount;
//extern volatile uint8_t UARTBuffer[0x40];

/* Main Program */

int main (void)
{
//    int i = 0, on=0;
  /* 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);

  //UARTCount=3;
  //UARTBuffer[0]=80;
  //UARTBuffer[1]=81;
  //UARTBuffer[2]=82;

  UARTInit(UART_BAUD);

  /* Initialize GPIO (sets up clock) */
  GPIOInit();
  /* Set LED port pin to output */
  GPIOSetDir( LED_PORT, LED_BIT, 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/COUNT_MAX)) < ((LED_TOGGLE_TICKS/COUNT_MAX)/2) )
    {
        GPIOSetValue( LED_PORT, LED_BIT, LED_OFF );
//        LPC_UART->IER = IER_THRE | IER_RLS;            /* Disable RBR */
//          UARTSend( (uint8_t *)UARTBuffer, UARTCount );
//        UARTCount = 0;
//        LPC_UART->IER = IER_THRE | IER_RLS | IER_RBR;    /* Re-enable RBR */
      //delay32Ms(1,1000);
    }
    else
    {
      GPIOSetValue( LED_PORT, LED_BIT, LED_ON );
    /* Go to sleep to save power between timer interrupts */
    //__WFI();
  }
}
0 Kudos
Reply
3 Replies

1,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by madhuvariar on Fri Jun 29 04:54:02 MST 2012
Copy the uart.h & uart.c file to driver folder of your current work space
and try.
0 Kudos
Reply

1,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by matt6ft9 on Thu Jun 28 06:51:29 MST 2012
My workspace must have been corrupt somehow.  I created a new workspace, tried the "UARTInit(9600);" along with a "UARTSend" and it worked.  Trying a new workspace is something I should have did many hours ago.
0 Kudos
Reply

1,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Jun 27 13:17:10 MST 2012
undefined reference is a link error, not a compile error. It means that you have not linked with a library that contains the  function.
0 Kudos
Reply