AnsweredAssumed Answered

Problem using CMSIS DRIVER API

Question asked by Rahul Gusai on Aug 31, 2016

I am trying to use CMSIS USART DRIVER API to use UART0 on my LPC1768. But whenever I try to build the project, I get the following error:
.\Objects\1.axf: Error: L6218E: Undefined symbol DRIVER_USART0 (referred from 1.o)

Can anyone please help me with it ?

 

Here is the source code..

 

#include "Driver_USART.h"
#include "cmsis_os.h" 
#include <stdio.h>
#include <string.h>

void myUART_Thread(void const *argument);
osThreadId tid_myUART_Thread;

/* USART Driver */
extern ARM_DRIVER_USART Driver_USART1;


void myUSART_callback(uint32_t event)
{
switch (event)
{
case ARM_USART_EVENT_RECEIVE_COMPLETE:
case ARM_USART_EVENT_TRANSFER_COMPLETE:
case ARM_USART_EVENT_SEND_COMPLETE:
case ARM_USART_EVENT_TX_COMPLETE:
/* Success: Wakeup Thread */
osSignalSet(tid_myUART_Thread, 0x01);
break;

case ARM_USART_EVENT_RX_TIMEOUT:
__breakpoint(0); /* Error: Call debugger or replace with custom error handling */
break;

case ARM_USART_EVENT_RX_OVERFLOW:
case ARM_USART_EVENT_TX_UNDERFLOW:
__breakpoint(0); /* Error: Call debugger or replace with custom error handling */
break;
}
}

/* CMSIS-RTOS Thread - UART command thread */
void myUART_Thread(const void* args)
{
static ARM_DRIVER_USART * USARTdrv = &Driver_USART1;
//ARM_DRIVER_VERSION version;
// ARM_USART_CAPABILITIES drv_capabilities;
char cmd;

/*Initialize the USART driver */
USARTdrv->Initialize(myUSART_callback);
/*Power up the USART peripheral */
USARTdrv->PowerControl(ARM_POWER_FULL);
/*Configure the USART to 4800 Bits/sec */
USARTdrv->Control(ARM_USART_MODE_ASYNCHRONOUS |
ARM_USART_DATA_BITS_8 |
ARM_USART_PARITY_NONE |
ARM_USART_STOP_BITS_1 |
ARM_USART_FLOW_CONTROL_NONE, 4800);

/* Enable Receiver and Transmitter lines */
USARTdrv->Control (ARM_USART_CONTROL_TX, 1);
USARTdrv->Control (ARM_USART_CONTROL_RX, 1);

USARTdrv->Send("\nPress Enter to receive a message", 34);
osSignalWait(0x01, osWaitForever);

while (1)
{
USARTdrv->Receive(&cmd, 1); /* Get byte from UART */
osSignalWait(0x01, osWaitForever);
if (cmd == 13) /* CR, send greeting */
{
USARTdrv->Send("\nHello World!", 12);
osSignalWait(0x01, osWaitForever);
}

}
}


osThreadDef(myUART_Thread,osPriorityNormal,1,0);
int main (void)
{


osKernelInitialize();
tid_myUART_Thread=osThreadCreate(osThread(myUART_Thread),NULL);
osKernelStart();

}

Outcomes