# Using the CMSIS Drivers

CMSIS drivers provide generic peripheral interfaces for middleware and application code. To use the CMSIS driver library, the drivers must be included in the application. Instructions for using the CMSIS drivers are shown in the following sections.

## Adding a CMSIS Driver

To add a CMSIS driver to an application, perform the following steps:

1. Open the <sample_name>.rtconfig file from the project folder and select the CMSIS driver(s) that is/are required for the application. CMSIS drivers, including UART, SPI and I2C, are found under CMSIS Drivers in the application’s .rteconfig file.
2. After enabling required drivers, save the <sample_name>.rtconfig file.

See the "Adding the UART CMSIS Driver to the uart_cmsis Sample Application" figure as an example of how to add the USART CMSIS driver to the uart_cmsis sample application. As seen in the figure, the USART driver for RSL15 is checked, and is therefore included in the sample application.

Figure: Adding the UART CMSIS Driver to the uart_cmsis Sample Application

## Configuring CMSIS Drivers with RTE_Device.h

CMSIS drivers require I/O pin assignments and optional setup for DMA when being configured for use in a sample application. Both I/O pin assignments and DMA setup are configured in RTE_Device.h. In any sample application, the path to find the RTE_Device.h file is as follows: RTE > Device > RSL15 > RTE_Device.h. To view and configure RTE_Device.h in an easily readable GUI, right click on RTE_Device.h in the Project Explorer view and select Open With > CMSIS Configuration Wizard. The Wizard window opens, as shown in the "Viewing and Configuring RTE_Device.h with the CMSIS Configuration Wizard" figure.

Figure: Viewing and Configuring RTE_Device.h with the CMSIS Configuration Wizard

NOTE: This file (RTE_Device.h) is best viewed using the CMSIS Configuration Wizard.

As seen in the "Viewing and Configuring RTE_Device.h with the CMSIS Configuration Wizard" figure, optional setup for DMA control is available in the sample application’s RTE_Device.h file via the CMSIS Configuration Wizard. In this file, under DMA Configuration, the DMA channels can be configured.

DMA channel configuration can be enabled by checking the box for a channel, and disabled by unchecking it.. In the "Viewing and Configuring RTE_Device.h with the CMSIS Configuration Wizard" figure, the DMA 0 enabled and DMA 1 enabled boxes are checked, meaning that DMA channels 0 and 1 have their configurations enabled and are ready to be used for data transfers.

The CMSIS Configuration Wizard view of the RTE_Device.h file also shows options under USART0 DMA Control that allow channel selection for the USART0 RX DMA channel and USAR0 TX DMA channel. In the "Viewing and Configuring RTE_Device.h with the CMSIS Configuration Wizard" figure the RX DMA channel for the USART0 interface is configured to use DMA channel 0, while the TX DMA channel uses DMA channel 1.