# sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144 architecture

> Architecture diagram of the GitHub repository sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144
- Repository: https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144

## Overview

This is an S32K144 automotive interior-light ECU. TS Master sends a one-byte CAN door bitfield; firmware filters and decodes it, runs the generated Simulink light-request model, then ramps PWM duty toward on or off with timed steps. Board configuration and SDK peripheral layers support that runtime path. The README also documents the hardware polarity validation and TS Master testing. Some SDK and board configuration files were not sampled, so those supporting relationships are shown only where the README or main.c establishes them.

Main entry points: [`src/main.c`](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/src/main.c) (Runtime loop), [`SDK/platform/drivers/src/flexcan/flexcan_driver.c`](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/drivers/src/flexcan/flexcan_driver.c) (FlexCAN driver), [`SDK/platform/pal/src/pwm/pwm_pal.c`](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/pal/src/pwm/pwm_pal.c) (PWM PAL), [`board/clock_config.c`](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/clock_config.c) (Clock setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["ECU application"]
  node_main["Runtime loop<br/>[main.c]"]
  node_can_decode["Door decode<br/>[main.c]"]
  node_fade["PWM fade ramp<br/>[main.c]"]
end

subgraph group_model["Light logic"]
  node_model["Light request model"]
end

subgraph group_board["Board setup"]
  node_clock_config["Clock setup<br/>[clock_config.c]"]
  node_pin_config["Pin mux setup<br/>[pin_mux.c]"]
  node_can_config["FlexCAN setup"]
  node_pwm_config["PWM setup"]
  node_osif_config["OSIF setup"]
end

subgraph group_sdk["S32K SDK"]
  node_clock_driver["Clock driver<br/>[clock_S32K1xx.c]"]
  node_pins_driver["Pins driver<br/>[pins_driver.c]"]
  node_can_driver["FlexCAN driver<br/>[flexcan_driver.c]"]
  node_pwm_pal["PWM PAL<br/>[pwm_pal.c]"]
  node_ftm_driver["FTM PWM driver<br/>[ftm_pwm_driver.c]"]
  node_osif["Bare-metal OSIF<br/>[osif_baremetal.c]"]
end

node_tsmaster(("TS Master"))
node_light(("Interior light"))

node_tsmaster -->|"sends CAN"| node_can_driver
node_main -->|"initializes"| node_clock_config
node_main -->|"initializes"| node_pin_config
node_main -->|"initializes"| node_pwm_config
node_main -->|"initializes"| node_can_config
node_main -->|"receives frames"| node_can_driver
node_can_driver -->|"provides frame"| node_can_decode
node_main -->|"processes frame"| node_can_decode
node_can_decode -->|"sets door inputs"| node_model
node_main -->|"steps model"| node_model
node_main -->|"sets target"| node_fade
node_fade -->|"updates duty"| node_pwm_pal
node_fade -->|"delays steps"| node_osif
node_pwm_config -->|"configures"| node_pwm_pal
node_clock_config -.->|"configures"| node_clock_driver
node_pin_config -->|"configures"| node_pins_driver
node_pwm_pal -->|"uses FTM"| node_ftm_driver
node_fade -->|"drives brightness"| node_light

click node_main "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/src/main.c"
click node_can_decode "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/src/main.c"
click node_fade "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/src/main.c"
click node_model "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/src/interior_light_model.c"
click node_clock_config "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/clock_config.c"
click node_pin_config "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/pin_mux.c"
click node_can_config "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/peripherals_flexcan_config_1.c"
click node_pwm_config "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/peripherals_pwm_pal_1.c"
click node_osif_config "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/peripherals_osif_1.c"
click node_clock_driver "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c"
click node_pins_driver "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/drivers/src/pins/pins_driver.c"
click node_can_driver "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/drivers/src/flexcan/flexcan_driver.c"
click node_pwm_pal "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/pal/src/pwm/pwm_pal.c"
click node_ftm_driver "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/drivers/src/ftm/ftm_pwm_driver.c"
click node_osif "https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/rtos/osif/osif_baremetal.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_can_decode,node_fade toneBlue
class node_model toneAmber
class node_clock_config,node_pin_config,node_can_config,node_pwm_config,node_osif_config toneMint
class node_clock_driver,node_pins_driver,node_can_driver,node_pwm_pal,node_ftm_driver,node_osif toneRose
class node_tsmaster,node_light toneIndigo
```

## Components

### ECU application

- [Runtime loop](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/src/main.c): `src/main.c`
- [Door decode](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/src/main.c): `src/main.c`
- [PWM fade ramp](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/src/main.c): `src/main.c`

### Light logic

- [Light request model](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/src/interior_light_model.c): `src/interior_light_model.c`

### Board setup

- [Clock setup](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/clock_config.c): `board/clock_config.c`
- [Pin mux setup](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/pin_mux.c): `board/pin_mux.c`
- [FlexCAN setup](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/peripherals_flexcan_config_1.c): `board/peripherals_flexcan_config_1.c`
- [PWM setup](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/peripherals_pwm_pal_1.c): `board/peripherals_pwm_pal_1.c`
- [OSIF setup](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/board/peripherals_osif_1.c): `board/peripherals_osif_1.c`

### S32K SDK

- [Clock driver](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c): `SDK/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c`
- [Pins driver](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/drivers/src/pins/pins_driver.c): `SDK/platform/drivers/src/pins/pins_driver.c`
- [FlexCAN driver](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/drivers/src/flexcan/flexcan_driver.c): `SDK/platform/drivers/src/flexcan/flexcan_driver.c`
- [PWM PAL](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/pal/src/pwm/pwm_pal.c): `SDK/platform/pal/src/pwm/pwm_pal.c`
- [FTM PWM driver](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/platform/drivers/src/ftm/ftm_pwm_driver.c): `SDK/platform/drivers/src/ftm/ftm_pwm_driver.c`
- [Bare-metal OSIF](https://github.com/sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144/blob/main/SDK/rtos/osif/osif_baremetal.c): `SDK/rtos/osif/osif_baremetal.c`

### Other components

- **TS Master**
- **Interior light**

## Connections

- TS Master → FlexCAN driver: sends CAN
- Runtime loop → Clock setup: initializes (evidence: `src/main.c`)
- Runtime loop → Pin mux setup: initializes (evidence: `src/main.c`)
- Runtime loop → PWM setup: initializes (evidence: `src/main.c`)
- Runtime loop → FlexCAN setup: initializes (evidence: `src/main.c`)
- Runtime loop → FlexCAN driver: receives frames (evidence: `src/main.c`)
- FlexCAN driver → Door decode: provides frame
- Runtime loop → Door decode: processes frame (evidence: `src/main.c`)
- Door decode → Light request model: sets door inputs (evidence: `src/main.c`)
- Runtime loop → Light request model: steps model (evidence: `src/main.c`)
- Runtime loop → PWM fade ramp: sets target (evidence: `src/main.c`)
- PWM fade ramp → PWM PAL: updates duty (evidence: `src/main.c`)
- PWM fade ramp → Bare-metal OSIF: delays steps (evidence: `src/main.c`)
- PWM setup → PWM PAL: configures (evidence: `board/peripherals_pwm_pal_1.c`)
- Clock setup → Clock driver: configures
- Pin mux setup → Pins driver: configures (evidence: `board/pin_mux.c`)
- PWM PAL → FTM PWM driver: uses FTM
- PWM fade ramp → Interior light: drives brightness
