![]() |
MCUSW
|
This document details AUTOSAR CDD UART module implementation
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
Note: This module is not applicable for MPU devices AM62X and AM62PX
Please refer the Cdd Uart design document, please refer to CSP.
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 | |
Receiver line error status like overrun, framing | |
Configuring interrupts and getting event statuses |
Cdd_Uart_Init() is the function responsible for initializing driver peripheral and opening its configured instances for transmission
UART driver maintains these below states as per the driver source condition:
UART API expects Channel ID which is the index of the UART instance config from the configuration.
Example:
For the above sample configuration, Index number 0 need to be provided in place of channel ID for the UART APIs to use UART3 instance. Similarly, index number 1 and 2 need to be provided in place of channel ID for the UART APIs to use UART2 and UART0 instances.
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. Cdd_Uart_Irq.h and Cdd_Uart_Irq.c : contain interrupt service routines
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 |
The UART driver provides read, write and error call back functions supported for all channels targeted from UART Configurator Plugin
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.
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
Service | Service ID |
Cdd_Uart_Init | 0x01 |
Cdd_Uart_GetVersionInfo | 0x02 |
Cdd_Uart_DeInit | 0x03 |
Cdd_Uart_Write | 0x04 |
Cdd_Uart_Read | 0x05 |
Cdd_Uart_Cancel | 0x06 |
Cdd_Uart_GetRemainingWords | 0x07 |
Following Interrupt Service Routines are present in UART:
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_SetEventStatus().
UART driver supports Pre-Compile and Post-Build variant and doesn’t support Link-Time configuration.
Cdd_Uart_TI_AM62AX/Cdd_Uart_TI_AM62DX/Cdd_Uart_TI_AM275X configurator plugin for the driver supports below configurable parameters:
There are two apps for cdd uart. The MCAL example application could be built with the command
$ cd (SDK Install Directory)/mcusw.xx.yy.zz.bb/build $ gmake -s cdd_uart_interrupt_app BOARD=am62ax_evm SOC=am62ax BUILD_PROFILE=release CORE=mcu0_0 BUILD_OS_TYPE=baremetal $ OR $ gmake -s cdd_uart_interrupt_app BOARD=am62ax_evm SOC=am62ax BUILD_PROFILE=debug CORE=mcu0_0 BUILD_OS_TYPE=baremetal
$ cd (SDK Install Directory)/mcusw.xx.yy.zz.bb/build $ gmake -s cdd_uart_polling_app BOARD=am62ax_evm SOC=am62ax BUILD_PROFILE=release CORE=mcu0_0 BUILD_OS_TYPE=baremetal $ OR $ gmake -s cdd_uart_polling_app BOARD=am62ax_evm SOC=am62ax BUILD_PROFILE=debug CORE=mcu0_0 BUILD_OS_TYPE=baremetal
$ cd (SDK Install Directory)/mcusw.xx.yy.zz.bb/build $ gmake -s cdd_uart_interrupt_app BOARD=am62dx_evm SOC=am62dx BUILD_PROFILE=release CORE=mcu0_0 BUILD_OS_TYPE=baremetal $ OR $ gmake -s cdd_uart_interrupt_app BOARD=am62dx_evm SOC=am62dx BUILD_PROFILE=debug CORE=mcu0_0 BUILD_OS_TYPE=baremetal
$ cd (SDK Install Directory)/mcusw.xx.yy.zz.bb/build $ gmake -s cdd_uart_polling_app BOARD=am62dx_evm SOC=am62dx BUILD_PROFILE=release CORE=mcu0_0 BUILD_OS_TYPE=baremetal $ OR $ gmake -s cdd_uart_polling_app BOARD=am62dx_evm SOC=am62dx BUILD_PROFILE=debug CORE=mcu0_0 BUILD_OS_TYPE=baremetal
$ cd (SDK Install Directory)/mcusw.xx.yy.zz.bb/build $ gmake -s cdd_uart_interrupt_app BOARD=am275x_evm SOC=am275x BUILD_PROFILE=release CORE=mcu0_0 BUILD_OS_TYPE=baremetal $ OR $ gmake -s cdd_uart_interrupt_app BOARD=am275x_evm SOC=am275x BUILD_PROFILE=debug CORE=mcu0_0 BUILD_OS_TYPE=baremetal
$ cd (SDK Install Directory)/mcusw.xx.yy.zz.bb/build $ gmake -s cdd_uart_polling_app BOARD=am275x_evm SOC=am275x BUILD_PROFILE=release CORE=mcu0_0 BUILD_OS_TYPE=baremetal $ OR $ gmake -s cdd_uart_polling_app BOARD=am275x_evm SOC=am275x BUILD_PROFILE=debug CORE=mcu0_0 BUILD_OS_TYPE=baremetal
This is Uart Echo Test in Interrupt Mode Please input 8 characters: cdd_uart Echo has been completed. All tests have passed!
This is Uart Echo Test in Polling Mode Please input 8 characters: cdd_uart Echo has been completed. All tests have passed!
This is Uart Echo Test in Interrupt Mode Please input 8 characters: 123asert Echo has been completed. All tests have passed!
This is Uart Echo Test in Polling Mode Please input 8 characters: 123sdfui Echo has been completed. All tests have passed!