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

cmsis usart problem

hi to all,
i am new in mdk5 and i working on a project that in it i need to communicate through usart of my micro, i want to use from cmsis::usart lib to access usart.
when i read the documentation of cmsis i found below example

#include "Driver_USART.h"
#include "cmsis_os.h"                   /* ARM::CMSIS:RTOS:Keil RTX */
#include <stdio.h>
#include <string.h>

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

/* USART Driver */
extern ARM_DRIVER_USART Driver_USART3;


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_USART3;
    ARM_DRIVER_VERSION     version;
    ARM_USART_CAPABILITIES drv_capabilities;
    char                   cmd;

  #ifdef DEBUG
    version = USARTdrv->GetVersion();
    if (version.api < 0x200)   /* requires at minimum API version 2.00 or higher */
    {                          /* error handling */
        return;
    }
    drv_capabilities = USARTdrv->GetCapabilities();
    if (drv_capabilities.event_tx_complete == 0)
    {                          /* error handling */
        return;
    }
  #endif

    /*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);
        }

    }
}


i am ok with that but i can not undrestand one thing, my micro has 4 usart port, how i can indicate that i want to use for example usart3 of my micor.