4.6. CDD_UART¶
4.6.1. Introduction¶
This document describes the functionality, API and configuration of the AUTOSAR BSW module UART.
- Supported AUTOSAR Release:
4.3.1
- Supported Configuration Variants:
Pre-compile, Post-Build
- Vendor ID:
UART_VENDOR_ID (44)
- Module ID:
UART_MODULE_ID (255)
- Supported Platform:
AM263Px
The UART complex device driver provides data read and write transfer using the module unit channels in the device board. The driver is configurable for parameters such as baud rate, word length, parity, stop bits, IO mode, clock frequency, transfer and receival buffer threshold, and operating mode. Depending upon the IO Mode selected, the driver allows for both synchronous as well as asynchronous mode of data transfer.
The UART Driver provides services for reading and writing to/from
UART Channels
UART Ports / Serial Device
4.6.2. UART Driver Architecture¶
The UART driver has architecture as shown in below figure from the AM263 Technical Reference Manual

Fig. 4.4 UART interface¶
UART comes under the Complex Driver Design section under the AUTOSAR Classic Platform Architecture

Fig. 4.5 AUTOSAR CDDs¶
4.6.3. Functional Description¶
4.6.3.1. Features Supported and Not Supported¶
On the AM263Px platform there are 9 GPIO registers.
Supported |
Not Supported |
---|---|
Echoing character received in both blocking and non-blocking mode |
External UART Handle usage |
Determine UART interrupt status |
MODEM control functions |
Enable and disable specific interrupts in mode of operation (even for IER) |
IrDA and CIR features |
UART handle for opened UART instance |
Hardware Flow Control |
Closing corresponding peripheral of a UART handle |
|
Transfer Modes: Interrupt, Polling, DMA |
|
Receiver line error status like overrun, framing |
|
Configuring interrupts and getting event statuses |
4.6.3.2. Initialization¶
Cdd_Uart_Init() is the function responsible for initializing driver peripheral and opening its configured instances for transmission
4.6.3.3. States¶
UART driver maintains these below states as per the driver source condition:
CDD_UART_UNINIT
CDD_UART_INIT
CDD_UART_BUSY
4.6.3.4. Main Functions¶
Cdd_Uart_Read() - This API is used for reading data using a given channel ID upto a specified length
Cdd_Uart_Write() - This API is used for writing data using a given channel ID upto a specified data count
Cdd_Uart_Cancel() - This API is used for cancelling an ongoing data transfer using a given channel ID in the given direction
4.6.4. File Structure¶
The files structure for the UART driver is silimar to other drivers. The source is divided into headers under include/ and driver source within src/ directory under Uart driver path in MCAL. Cdd_Uart.c and Cdd_Uart.h are the 2 files that contain the provided driver API’s.
Cdd_Uart.h : Shall specify the interface provided by the driver.
Cdd_Uart.c, Cdd_Uart_Priv.h : Shall implement the driver functionality.
uart_dma_edma.c : Contains functions that support the Enhanced DMA mode for use with UART channels in DMA mode as IO mode.
Cdd_Uart_Irq.h and Cdd_Uart_Irq.c : contain interrupt service routines
4.6.5. Memory mapping¶
Memory Mapping Sections |
CDD_UART_CODE |
CDD_UART_CODE_ISR |
CDD_UART_VAR_NO_INIT |
CDD_UART_VAR_ZERO_INIT |
CDD_UART_PBCFG |
CDD_UART_PBCFG_ROOT |
---|---|---|---|---|---|---|
CDD_UART_START_SEC_VAR_INIT_UNSPECIFIED(.bss) CDD_UART_STOP_SEC_VAR_INIT_UNSPECIFIED |
x |
|||||
CDD_UART_START_SEC_CODE_APPL(.text) CDD_UART_STOP_SEC_CODE_APPL |
x |
|||||
CDD_UART_START_SEC_VAR_UNSPECIFIED(.data) CDD_UART_STOP_SEC_VAR_UNSPECIFIED |
x |
|||||
CDD_UART_START_SEC_CODE(.text) CDD_UART_START_SEC_CODE |
x |
|||||
CDD_UART_START_SEC_PBCFG(.data) CDD_UART_STOP_SEC_PBCFG |
x |
|||||
CDD_UART_START_SEC_PBCFG_ROOT(.const) CDD_UART_STOP_SEC_PBCFG_ROOT |
x |
4.6.6. Services used by UART Driver¶
4.6.6.1. Cdd_Uart Callback Functions¶
The UART driver provides read, write and error call back functions supported for all channels targeted from UART Configurator Plugin
4.6.6.2. Dependencies on SW modules¶
4.6.6.2.1. DET¶
The module UART depends on the DET (by default) in order to report
development errors. Detection and reporting of development errors, DET
shall be enabled or disabled by the switch CDD_UART_DEV_ERROR_DETECT
= STD_ON
in Cdd_Uart_Cfg.h, generated by using appropriate option
check within the configurator plugin. The DET can be replaced optionally
by an equivalent component which is responsible to recognize development
errors, if no DET component is available.
4.6.6.2.2. MCU¶
The Cdd_Uart Modules expects the MCU modules to enable the GPIO registers used used by configuring the PRCM correctly. MCU module is responsible for setting up clock configuration for the driver, the hardware clock available on the board.
4.6.6.2.3. PORT¶
The Cdd_Uart Modules expects that PinMux is set correctly to configure the GPIO pins for appropriate UART channel ports. The pin direction shall also be set by the PORT driver
4.6.6.2.4. SchM (Optional)¶
Beside the OS the BSW Scheduler provides functions that module UART calls at begin and end of critical sections.
There is only one kind of critical sections in this driver. Within
these sections all read / modify / write accesses to internal UART
status variables must be performed. This is defined in the application
and used to handle in the UART driver by invoking
SchM_Enter_Cdd_Uart_UART_EXCLUSIVE_AREA_0()
and
SchM_Exit_Cdd_Uart_UART_EXCLUSIVE_AREA_0()
functions
4.6.7. API Definition¶
Refer the MCAL_ApiGuide for API documentation and Type definition
Service ID |
Service |
---|---|
0x01 |
Cdd_Uart_Init |
0x02 |
Cdd_Uart_GetVersionInfo |
0x03 |
Cdd_Uart_DeInit |
0x04 |
Cdd_Uart_Write |
0x05 |
Cdd_Uart_Read |
0x06 |
Cdd_Uart_Cancel |
0x07 |
Cdd_Uart_GetRemainingWords |
4.6.7.1. Supported APIs¶
Cdd_Uart_Init
Cdd_Uart_DeInit
Cdd_Uart_Write
Cdd_Uart_Read
Cdd_Uart_Cancel
Cdd_Uart_GetRemainingWords
Cdd_Uart_GetVersionInfo
4.6.7.2. Interrupt Service Routines¶
Following Interrupt Service Routines are present in UART:
Cdd_Uart_ChannelIsr - The Channel-based Interrupt Subroutine calls handler function based on the selected channel.
CDD_EDMA_lld_transferCompletionMasterIsrFxn - The common-channel DMA-based Interrupt Subroutine calls handler function available for transfer completion.
4.6.8. Error Handling¶
Development error reporting. The Cdd_UartDriver will report development errors on enabling UART_DEV_ERROR_DETECT == STD_ON in Cdd_Uart_Cfg.h
Refer API documentation for list of development errors reported by UART Driver
Parameter checking AUTOSAR requires that API functions check the validity of their parameters. The checks are described in spec and are done as internal parameter checks of the API functions. These checks are for development error reporting and can be en-/disabled separately. Refer to the configuration chapter where the en-/disabling of the checks is described. En-/disabling of single checks is an addition to the AUTOSAR standard which requires to en-/disable the complete parameter checking via the parameter UART_DEV_ERROR_DETECT
Production Code Error Reporting By default, production code related errors are reported to the DEM using the service DEM_ReportErrorStatus().
4.6.9. Configuration¶
UART driver supports Pre-Compile and Post-Build variant and doesn’t support Link-Time configuration.
4.6.9.1. Configurable Parameters¶
Cdd_Uart_TI_AM263X configurator plugin for the driver supports below configurable parameters:
uartHwUnitID - UART Hardware Unit Instance number
uartClockFrequency - Clock Frequency
uartBaudRate - Baud Rate for signal transfer
uartIOMode - IO Mode for signal transfer
uartTXTriggerLevel - Trigger level for Transmission of signal
uartRXTriggerLevel - Trigger level for Receival of signal
uartHwFlowControlThreshold - Trigger threshold for signal flow control
uartWordLength - Word Length for packets
uartParity - Parity for data
uartReadReturnMode - Read return mode
uartOperatingMode - Mode of Operation
uartStopBits - Amount of stop bits per packet
edmaXbarRxHandleID - UART Receival EDMA Handle ID
edmaXbarTxHandleID - UART Transmittal EDMA Handle ID
uartNotificationHandlers - Notification Callback Handles for read, write completion or in case of data transfer error detection
For using UART with DMA mode, take additional care with these configuration value with CDD DMA configuration:
separate DMA configuration shall be done for Tx and/or Rx of each UART instance configured for DMA IO mode using the CDD DMA configurator plugin. Make sure to set CddDmaInterruptEnable option provided there as UART peripheral shall make use of enhanced DMA with interrupt enabled.
UART Tx makes use of two parameters for Tx and Dummy param sets to service a dummy transfer request at the end as expected from HW IP. So make sure to have corresponding two parameter sets registered in a channel group on configurator plugin.
4.6.10. Example Application¶
CDD UART DMA example application demonstrating the CDD UART driver features is present in Uart/uart_echo_dma_app under /examples folder.
The UART example app used to verify the data transmission and receival through a selected channel ID 0 of the available UART Hardware Units.
This application can be built from the build folder by running
gmake –s uart_echo_dma_app PLATFORM=am263px
.
The details of running the application and the setup required is part of the MCAL User Guide. Document Revision History =========================
Version # |
Date |
Revision History |
Status |
---|---|---|---|
Version 1.0 |
13 Oct 2023 |
Initial draft |
Approved |
Version 1.1 |
15 Dec 2023 |
Updates to reflect DMA changes |
Approved |