DEV Community

Sushma B R
Sushma B R

Posted on

MCAL (Microcontroller Abstraction Layer) in AUTOSAR

My name is Sushma B R, and I am working as Software Engineer at Luxoft India. In this article I will be providing the detailed information towards MCAL in AUTOSAR. Luxoft has provided me with multiple opportunity to work on various projects MCAL is one among them.

Introduction:

  • AUTOSAR (AUTomotive Open System ARchitecture) is a worldwide
    development partnership of vehicle manufacturers, suppliers,
    service providers and companies from the automotive electronics,
    semiconductor and software industry.

  • MCAL stands for Microcontroller Abstraction Layer.​

  • MCAL is a software module that has direct access to all the
    on-chip MCU peripheral modules and external devices,which are
    mapped to memory. And it makes the upper software layers (Basic
    software layer, or BSW, Application Layer) independent of the
    MCU.​

  • MCAL enables a very significant advantage of the layered
    architecture of the AUTOSAR compliant design.​

  • It makes the application and also the middleware (Basic Software
    layer) independent of the underlying hardware platform.

Overview of AUTOSAR and MCAL:

Runtime Environment(RTE): Middleware layer which provides communication services for the application software and makes the components independent of a specific MCU.
Basic Software(BSW) Layer: Software layer with basic services and drivers to leverage features of the underlying hardware, and enabling interface to application and RTE layer.
Services Layer: Offers basic services, Memory Services, Diagnostic Services, state management for components in the basic layer.
ECU Abstraction Layer: Interfaces the drivers of MCAL and makes higher software layers independent of hardware layout and offers access to I/O signals.
Microcontroller Abstraction Layer (MCAL): Microcontroller Abstraction Layer which is the lowest software layer designed to make higher level software independent of a microcontroller.
Complex driver: Collection of complex sensor and actuator control or non-standardized drivers that may need migration.

Image description

Software Architecture of AUTOSAR MCAL​:

  • MCAL has a range of software modules designed to serve a
    particular purpose.​

  • Each Software Module (Driver) accesses the corresponding On-chip
    peripheral function.

  • Each Software Module (Driver) accesses the corresponding On-chip
    peripheral function.

  • MCAL is a software module that enables direct access to on-chip
    MCU peripheral modules.

Image description

Modules in MCAL:

Microcontroller Drivers:

  • GPT Driver: GPT (General Purpose Timer) device driver uses on-chip MCU timer. Initializes GPT and performs timer count.

  • WDG Driver: WDG (Watchdog) Driver, this on-chip device driver Initializes WDG and performs WDG mode settings.

  • MCU Driver: MCU (Micro Controller Unit) Driver, this device driver helps configure MCU settings, initializes clock and helps configure power mode settings.

2. Memory Drivers:

  • FLS Driver: FLS (Flash) Driver initializes FLS and reads/writes to FLS memory.

3. Communication Drivers:​

  • SPI Handler/Driver: SPI (Serial Peripheral Interface) is a Handler/Driver Device with on-chip clock serial function that Initializes SPI, performs SPI input/output and SPI I/O buffer settings.

  • LIN Driver: LIN (Local Interconnected network) is a device driver that initializes LIN and performs LIN input/output.

  • CAN Driver: CAN (Controller Area Network) is a device driver that initializes CAN and performs CAN input/output.

  • FlexRay Driver: FlexRaydevice driver initializes FlexRay and performs FlexRay input/output.

  • Ethernet Driver: Ethernet device driver initializes Ethernet Driver and performs Ethernet Driver input/output.

4. IO Drivers:​

  • ICU Driver: ICU (Input Capture Unit) is a device driver using on-chip MCU timer and initializes ICU. It also measures PWM waveforms.

  • PWM Driver: PWM (Pulse Width Modulation) is a device driver using on-chip MCU timer. It initializes PWM and sends PWM waveforms as output.

  • ADC Driver: ADC (Analog Digital Converter) is a device driver for on-chip ADC. It Initializes ADC, starts/stops AD conversion, sets AD conversion result buffer and reads AD conversion results.

  • ADC Driver: ADC (Analog Digital Converter) is a device driver for on-chip ADC. It Initializes ADC, starts/stops AD conversion, sets AD conversion result buffer and reads AD conversion results.

  • DIO Driver: DIO (Digital Input/Output) is an MCU port device driver that performs port signal (input/output).

  • PORT Driver: PORT Driver is a MCU port device driver that performs MCU pin settings (I/O, shared functions).

Conclusion:
In conclusion. the different layers of AUTOSAR architecture are developed independent of each other and MCAL Drivers are no exceptions. This is how the required abstraction and thus the standardization is achieved. MCAL Drivers also command a lot of importance, as they are the bridge between the upper layers of AUTOSAR architecture and the microcontroller unit and it is a fundamental part of the automotive software architecture,it is providing crucial abstraction that enables the development of scalable, portable, and maintainable software for the diverse range of ECU's in modern vehicles. It facilitates efficient HW utilization while allowing software engineers to focus on application level functionalities.

Top comments (0)