How sivaarunmanigk/car_cabin_interior_light_simulation_using_can_with_s32k144 works
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: main.c Runtime loop · flexcan_driver.c FlexCAN driver · pwm_pal.c PWM PAL · clock_config.c Clock setup
Components 17
ECU application
- Runtime loop
src/main.c - Door decode
src/main.c - PWM fade ramp
src/main.c
Light logic
- Light request model
src/interior_light_model.c
Board setup
- Clock setup
board/clock_config.c - Pin mux setup
board/pin_mux.c - FlexCAN setup
board/peripherals_flexcan_config_1.c - PWM setup
board/peripherals_pwm_pal_1.c - OSIF setup
board/peripherals_osif_1.c
S32K SDK
- Clock driver
SDK/platform/drivers/src/clock/S32K1xx/clock_S32K1xx.c - Pins driver
SDK/platform/drivers/src/pins/pins_driver.c - FlexCAN driver
SDK/platform/drivers/src/flexcan/flexcan_driver.c - PWM PAL
SDK/platform/pal/src/pwm/pwm_pal.c - FTM PWM driver
SDK/platform/drivers/src/ftm/ftm_pwm_driver.c - Bare-metal OSIF
SDK/rtos/osif/osif_baremetal.c
Other components
- TS Master
- Interior light
Connections 18
- TS Master → FlexCAN driver: sends CAN
- Runtime loop → Clock setup: initializes
src/main.c - Runtime loop → Pin mux setup: initializes
src/main.c - Runtime loop → PWM setup: initializes
src/main.c - Runtime loop → FlexCAN setup: initializes
src/main.c - Runtime loop → FlexCAN driver: receives frames
src/main.c - FlexCAN driver → Door decode: provides frame
- Runtime loop → Door decode: processes frame
src/main.c - Door decode → Light request model: sets door inputs
src/main.c - Runtime loop → Light request model: steps model
src/main.c - Runtime loop → PWM fade ramp: sets target
src/main.c - PWM fade ramp → PWM PAL: updates duty
src/main.c - PWM fade ramp → Bare-metal OSIF: delays steps
src/main.c - PWM setup → PWM PAL: configures
board/peripherals_pwm_pal_1.c - Clock setup → Clock driver: configures
- Pin mux setup → Pins driver: configures
board/pin_mux.c - PWM PAL → FTM PWM driver: uses FTM
- PWM fade ramp → Interior light: drives brightness