4.3. CDD CMPSS Module

4.3.1. Acronyms and Definitions

Abbreviation/Term

Explanation

AUTOSAR

Automotive Open System Architecture

RTE

Runtime Environment

BSW

Basic Software

MCAL

Micro Controller Abstraction Layer

API

Application Programming Interface

DET

Default Error Tracer

HW

Hardware

SW

Software

I/O

Input/Output

CMPSS

Comparator Subsystem

OS

Operating System

4.3.2. Introduction

This document describes the functionality and configuration of the Cdd_Cmpss module.

Supported AUTOSAR Release

4.3.1

Supported Configuration Variants

None

Vendor ID

CDD_CMPSS_VENDOR_ID (44)

Module ID

CDD_CMPSS_MODULE_ID (255)

Supported Platform

AM263x, AM263Px, AM261x

The CMPSS CDD provides services to configure the Comparator Subsystem (CMPSS) of the SOC.

4.3.3. Functional Overview

CMPSS consists of analog comparators and supporting circuits that are useful for power applications such as peak current mode control, switched-mode power, power factor correction, voltage trip monitoring, and so forth.

4.3.3.1. Initialization

This module doesn’t support any initialization and de-init routines. Hence there is no requirement to support pre-compile and post build configuration options.

The driver provides only compile time configuration options via Cdd_Cmpss_Cfg.h. The user need to edit this file to have different configuration from the current default configurations. Generation of this configuration is not provided via configurator as this module doesn’t have or require init time configurations.

4.3.3.2. States

This driver is stateless.

4.3.3.3. Assumptions

None

4.3.3.4. Limitations

None

4.3.3.5. Design Overview

Please refer SITARA MCU MCAL Architecture Document and MCAL: CDD CMPSS Detailed Design Document provided as part of CSP.

4.3.4. Hardware Features

4.3.4.1. Hardware Features supported

  • Two analog comparators

  • Two independently programmable reference 12-bit DACs

  • One decrementing ramp generator

  • Two digital filters, max filter clock prescale of 216

  • Ability to synchronize submodules with EPWMSYNCPER

  • Ability to extend clear signal with EPWMBLANK

  • Ability to synchronize output with SYSCLK

  • Ability to latch output

  • Ability to invert output

  • Option to use hysteresis on the input

  • Option for negative input of comparator to be driven by an external signal or by the reference DAC for COMPH

  • VDACREF is the DAC reference voltage

  • Diode emulation support

    • The system works with EPWM to support the Diode emulation feature

  • Ramp generator prescaler

4.3.5. Source Files

Static source C Files are defined below

📦AM263Px
┣ 📂build
┣ 📂mcal
┃ ┣ 📂Cdd_Cmpss
┃ ┃ ┣ 📂include
┃ ┃ ┃ ┣ 📜Cdd_Cmpss.h : Contains the API’s of the driver to be used by upper layers.
┃ ┃ ┣ 📂src
┃ ┃ ┃ ┣ 📜Cdd_Cmpss.c : Contains the implementation of the API’s for the driver.
┃ ┃ ┃ ┣ 📂am263px
┃ ┃ ┃ ┃ ┗ 📜Cdd_Cmpss_Soc.h : Contains SOC specific internal data
┃ ┃ ┗ 📜Makefile
┃ 📂mcal_config
┃ 📂mcal_docs
┃ 📜README.txt

Plugin files are defined below in the table.

Plugin Files

Description

Cdd_Cmpss_Cfg.h

Contains the Precompile switches, Macros.

4.3.6. Module Requirements

Please refer Software Product Specification document provided as part of CSP.

4.3.6.1. Memory Mapping

Memory Mapping Sections

CDD_CMPSS_CODE

CDD_CMPSS_CONST

CDD_CMPSS_START_SEC_CONST_UNSPECIFIED

X

CDD_CMPSS_STOP_SEC_CONST_UNSPECIFIED

X

CDD_CMPSS_START_SEC_CODE

X

CDD_CMPSS_STOP_SEC_CODE

X

4.3.6.2. Scheduling

Not applicable

4.3.6.3. Error Handling

4.3.6.3.1. Development Error Reporting

Development errors are reported to the DET using the service Det_ReportError() when enabled. The driver interface contains the MACRO declaration of the error codes to be returned.

4.3.6.3.1.1. Error Codes

Type of Error

Related Error code

Value (Hex)

API service called will null param pointer

CDD_CMPSS_E_PARAM_POINTER

0x01

API service called with illegal HW ID

CDD_CMPSS_E_ILLEGAL_HW_ID

0x02

API service called invalid configuration

CDD_CMPSS_E_INVALID_CONFIG

0x03

4.3.6.3.1.2. Runtime Error

None

4.3.6.3.2. DEM Error

None

4.3.7. Used Resources

4.3.7.1. Interrupt Handling

None

4.3.8. Integration Description

4.3.8.1. Dependent Modules

4.3.8.1.1. DET

The CMPSS module depends on the DET (by default) to report development errors. The DET can be replaced optionally by an equivalent component which is responsible to recognize development errors, if no DET component is available.

4.3.8.2. Multi-core Support

Not Supported

4.3.9. Configuration

The CMPSS Driver implementation supports multiple configuration variants The driver expects Cdd_Cmpss_Cfg.h to be present as input file.

4.3.10. Examples

4.3.10.1. Overview

The CMPSS example enables the CMPSS High comparator and feeds the asynchronous output to GPIO and EPWM. This example enables the CMPSSA1 COMPH comparator and feeds the asynchronous CTRIPOUTH signal to the XBAROUT0 pin and CTRIPH to EPWM0B.

CMPSS is configured to generate trip signals to trip the EPWM signals. CMPIN1P is used to give positive input and internal DAC is configured to provide the negative input. Internal DAC is configured to provide a signal at VDD/2. An EPWM signal is generated at EPWM0B and is configured to be tripped by CTRIPH. This is done via PWM XBAR output 3 configuration.

Note: When no input is provided, the analog input is not fixed and hence the result is not deterministic. Most cases it is seen that the CMPSS trips the PWM when no input is provided.

  • When a low input(VSS) is provided to CMPIN1P,

    • Trip signal(XBAROUT0) output is low

    • EPWM0B gives a PWM signal

  • When a high input(higher than VDD/2) is provided to CMPIN1P,

    • Trip signal(XBAROUT0) output turns high

    • EPWM0B gets tripped and outputs as high

4.3.10.1.1. External Connections

  • Give input on CMPIN1P (ControlCard HSEC Pin 15)

    • AM263x and AM263Px

      • For low input (no trip), connect J6 Pin 9 (0v/GND) to HSEC pin 15

      • For high input (trips pwm), connect J6 Pin 10 (3.3v/VCC) to HSEC pin 15

    • AM261x

      • For low input (no trip), connect any (0v/GND) pin to HSEC pin 15

      • For high input (trips pwm), connect any (3.3v/VCC) to HSEC pin 15

  • Outputs can be observed on

    • XBAROUT0 (SOC pin QSPI0_CSN1. USER_LED1 on ControlCard)

    • EPWM0B (ControlCard HSEC pin 51) using an oscilloscope

4.3.10.2. Hardware Software Setup and Tools

See example description above

4.3.10.3. Steps to Build and Run Example

  1. CMPSS example application demonstrating the CMPSS features is in folder <MCAL_ROOT>/examples/Cdd_Cmpss.

  2. This application can be built from the build folder by giving “gmake –s cdd_cmpss_app PLATFORM=am263px”

  3. Once the build is completed we get a binary file, which is loaded in our controller and executed.

4.3.10.4. Example Logs

CDD_CMPSS_APP: Asynchronous trip - STARTS !!!

 CMPSS MCAL Version Info
 ---------------------
 Vendor ID           : 44
 Module ID           : 255
 SW Major Version    : 1
 SW Minor Version    : 0
 SW Patch Version    : 0

CDD_CMPSS_APP: PWM tripped!!!
CDD_CMPSS_APP: PWM one-shot trip event status set!!!
CDD_CMPSS_APP: PWM latched trip interrupt status set!!!
CDD_CMPSS_APP: CMPSS HI and LO filter out status set!!!
CDD_CMPSS_APP: CMPSS HI and LO latched filter out status set!!!
CDD_CMPSS_APP: Output XBAR status set!!!
CDD_CMPSS_APP: Output XBAR latched status set!!!

CDD_CMPSS_APP: Stack Usage: 808 bytes
CDD_CMPSS_APP: Asynchronous trip - DONE (Passed) !!!
CDD_CMPSS_APP: All tests have passed

4.3.10.5. File Structure

📦AM263Px
┣ 📂build
┣ 📂mcal
┃ ┣ 📂examples
┃ ┃ ┣ 📂Cdd_Cmpss
┃ ┃ ┃ ┣ 📂soc
┃ ┃ ┃ ┣ 📜Cdd_Pwm_PBcfg.c : Contains PWM PB configuration to showcase the PWM trip.
┃ ┃ ┃ ┣ 📜CddCmpssApp.c : Contains test example.
┃ ┃ ┃ ┣ 📜CddCmpssApp.h : Contains test private header containing dependent includes and macro.
┃ ┃ ┃ ┣ 📜Makefile
┃ ┣ 📂examples_config
┃ ┃ ┣ 📂Cdd_Cmpss_Demo_Cfg
┃ ┃ ┃ ┣ 📂soc
┃ ┃ ┃ ┃ ┣ 📂am263px
┃ ┃ ┃ ┃ ┃ ┣ 📂r5f0_0
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂include
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜Cdd_Cmpss_Cfg.h : Contains the Precompile switches, Macros for CMPSS.
┃ 📂mcal_config
┃ 📂mcal_docs
┣ 📜README.txt

4.3.11. FAQ’s

None

4.3.12. References

Technical Reference Manual