MCUSW
|
This document details AUTOSAR BSW MCU module implementation
The MCU module initializes, configures and controls the internal hardware to realize MCU driver as detailed in AUTOSAR BSW MCU Driver Specification. The MCU functionality is realized through the CLOCK IP available on the device. Following section highlights key aspects of this implementation, which would be of interest to an integrator.
Please refer the MCU design, which is included as part of release (Mcu Design Document)
The MCU driver provides MCU services for Clock and RAM initialization. In the MCU configuration set, the MCU specific settings for the Clock (i.e. PLL setting) and RAM (i.e. section base address and size) shall be configured.
The Mcu driver provides the following features:
Sciclient(System Controller Interface Client) APIs are used by application to request DMSC for clock request.
The Clocks and PLLs are expected to be controlled and programmed by DMSC by using the sciclient APIs.
The example application demonstrates configuring clock sources for CLOCK module.
The Mcu Driver implementation supports multiple configuration variants (refer section Introduction), the driver expects generated Mcu_Cfg.h to be present as (File Structure). Please refer (Build) to specify path to generated configuration. The associated Mcu configuration generated files Mcu_Cfg.c and Mcu_PBcfg.c to be present as shown (File Structure)
The following section details on the un-supported/restricted features and additional features added.
APIs (listed below) are dummy.
APIs (listed below) are implemented with restrictions.
Note- McuRamSectionWriteSize is not supported as Mcu_InitRamSection() is a dummy API.
This driver implementation introduces below listed configurable options
Name | Mcu_CBK_Function |
Description | This Callback function will be defined in the application to perform the functionality. The User has to define this function. |
Container Name | McuModuleConfiguration |
Type | Enumeration |
Value Configuration Class | VARIANT-PRE-COMPILE & VARIANT-POST-BUILD |
Name | McuDeviceVariant |
Description | Used to specific family of devices, the variant of the device being used will belong one or more family of devices. Please refer (Supported Device Families) to determine the family of device. |
Container Name | McuGeneral |
Type | Enumeration |
Range | TDA4x, etc… (new family of devices could be added in future) |
Value Configuration Class | VARIANT-PRE-COMPILE |
Name | McuResetMode |
Description | This shall allow the user to select between or WARM/ COLD reset. |
Container Name | McuModuleConfiguration |
Type | Enumeration |
Range | WARM & COLD |
Value Configuration Class | VARIANT-PRE-COMPILE & VARIANT-POST-BUILD |
Name | Domain |
Description | User can select the Domain of a peripheral. |
Container Name | McuClockSettingConfig |
Type | Enumeration |
Range | MCU , MAIN & WKUP |
Value Configuration Class | VARIANT-PRE-COMPILE & VARIANT-POST-BUILD |
Name | McuClockModuleId |
Description | User can select the module id for peripheral. |
Container Name | McuClockSettingConfig |
Type | Enumeration |
Value Configuration Class | VARIANT-PRE-COMPILE & VARIANT-POST-BUILD |
Name | McuClockSourceId |
Description | User can select the clock source id for a peripheral. |
Container Name | McuClockSettingConfig |
Type | Enumeration |
Value Configuration Class | VARIANT-PRE-COMPILE & VARIANT-POST-BUILD |
Name | McuClockInitializationConfigFlag |
Description | User can switch the configuration flag ON/OFF. |
Container Name | McuClockSettingConfig |
Type | Enumeration |
Value Configuration Class | VARIANT-PRE-COMPILE & VARIANT-POST-BUILD |
Please follow steps detailed in section (Build) to build library or example
Please follow steps detailed in section (Build) to build example
Various objects of this implementation (e.g. variables, functions, constants) are defined under different sections. The linker command file at (Examples Linker File (Select memory location to hold example binary)) defines separate section for these objects. When the driver is integrated, its expected that these sections are created and placed in appropriate memory locations. (Locations of these objects depend on the system design and performance needs)
Section | MCU_CODE | MCU_VAR_INIT | MCU_VAR_NOINIT | MCU_CONST | MCU_CONFIG |
MCU_START_SEC_VAR_INIT_UNSPECIFIED (.data) | USED | ||||
MCU_DATA_INIT_32_SECTION | USED | ||||
MCU_TEXT_SECTION | USED | ||||
MCU_DATA_NO_INIT_UNSPECIFIED_SECTION | USED | ||||
MCU_CONST_32_SECTION | USED | ||||
MCU_ISR_TEXT_SECTION | USED | ||||
MCU_CONFIG_SECTION | USED |
This driver implementation has been validated with cache enabled. For optimal performance it’s recommended to place (Memory Mapping) sections in cache enabled memory area.
This implementation depends on the DET in order to report development errors and can be turned OFF. Refer section (Development Error Reporting) for detailed error codes.
This implementation requires 1 level of exclusive access to guard critical sections. Invokes SchM_Enter_Mcu_MCU_EXCLUSIVE_AREA_0 (), SchM_Exit_Mcu_MCU_EXCLUSIVE_AREA_0 () to enter critical section and exit.
Development errors are reported to the DET using the service Det_ReportError(), when enabled. The driver interface (Mcu.h File Structure) lists the SID.
Type of Error | Related Error code | Value (Hex) |
API service called with wrong configuration parameter | MCU_E_PARAM_CONFIG | 0x0A |
API service used with wrong clock value | MCU_E_PARAM_CLOCK | 0x0B |
API service used with wrong mode | MCU_E_PARAM_MODE | 0x0C |
API service called with invalid/wrong RAM section | MCU_E_PARAM_RAMSECTION | 0x0D |
API service is called while PLL is not locked | MCU_E_PLL_NOT_LOCKED | 0x0E |
Mcu Driver API service is called before initialization of MCU Driver | MCU_E_UNINIT | 0x0F |
API service is called with NULL/Wrong pointer | MCU_E_PARAM_POINTER | 0x10 |
Initialization of the MCU Driver Failed | MCU_E_INIT_FAILED | 0x11 |
The AUTOSAR BSW MCU Driver specification details the APIs required for Mcu Driver. Please refer to ( Please refer to CSP for Design Document ) for detailed API description. APIs which are not supported or are implemented with restriction , please refer to (Variance / Deviation from the specification).
Refer API Documentation for details
The example application demonstrate use of CLOCK based Mcu module, the list below identifies key steps performed the example. The configuration file is present at (File Structure)
To run the mcu_app:
Please refer to section (Build and Running the Example Application)
McuApp: Sample Application - STARTS !!! MCU MCAL Version Info --------------------- Vendor ID : 44 Module ID : 101 SW Major Version : 9 SW Minor Version : 0 SW Patch Version : 0 Module clock request successful !!! Module clock frequency set. Module = 172 , Freq = 80000000 !!! Module clock request successful !!! Module clock frequency set. Module = 173 , Freq = 80000000 !!! Module clock request successful !!! Module clock frequency set. Module = 252 , Freq = 125000000 !!! MCU Reset Reason:4 MCU Reset Reason Raw Value:0x100000 MCU Stack Usage: 2860 bytes MCU_APP: MCU Test Passed!!!
Revision | Date | Author | Description | Status |
---|---|---|---|---|
0.1 | 23 August 2022 | Rohit Tiwari | First version | Pending Review |
0.2 | 24 August 2022 | Rohit Tiwari | Review comments fixed | Approved |
0.3 | 26 Jun 2023 | Lavanya C | Updated module name, clock ids and example log | Approved |