AUTOSAR

Demystifying AUTOSAR: A Practitioner's Guide to MCAL Development on NXP S32K

May 2026 14 min read Ravi Kumar
A ground-up walkthrough of writing custom MCAL drivers for NXP S32K — BSW layering, ECUC configuration, Vector DaVinci integration, and the pitfalls no tutorial mentions. Includes working CAN driver code conforming to AUTOSAR 4.4.

Introduction

AUTOSAR is the de-facto standard for automotive ECU software. This post walks through writing a production MCAL CAN driver for the NXP S32K144 from scratch.

BSW Layer Architecture

The AUTOSAR BSW stack on S32K144 consists of MCAL (Microcontroller Abstraction Layer), ECU Abstraction Layer, Services Layer (COM, DCM, DEM, NVM, OS), and Complex Drivers.

ECUC Configuration with Vector DaVinci

The ECUC is the backbone of AUTOSAR configuration. In DaVinci Configurator Pro, define your CanGeneral, CanController, CanHardwareObject containers:

CanController_0:
  CanCpuClockRef: McuSystemClock  /* 80 MHz */
  CanControllerBaudRate: 500      /* kbps */
  CanControllerSeg1: 13
  CanControllerSeg2: 4

Writing the CAN_Init() Driver

The NXP S32K FlexCAN requires careful initialization sequence — enter freeze mode, configure clock source, set baud rate divisors, configure message buffers, exit freeze mode.

Common Pitfalls

Integration with CanIf

After MCAL, the CanIf layer abstracts multiple CAN drivers. The Can_MainFunction_Read() can use polling or interrupt-based reception. For AUTOSAR OS integration, the CAN interrupt calls Can_IsrRxFifo() or Can_IsrBusOff().

← Back to all posts