![]() |
MCUSW
|
This document details AUTOSAR BSW DIO module implementation
The DIO module provides interfaces to external peripherals by abstracting the input and output pins on the microcontroller device as detailed in the AUTOSAR BSW DIO Driver Specification. Following sections highlight key aspects of this implementation which would be of interest to an integrator.
DIO design, which is not included as part of release
The DIO driver provides an interface to external peripherals by abstracting the input and output pins on the microcontroller device. The DIO pins are general purpose in nature. AM62Ax have one Wakeup DIO driver instances.
32 Pins are grouped into a port and channelId corresponds to sequential number starting with 0 for wakeup domain 0 and pin 0.
AM62Ax can support up to 1 instances. These instances are generally associated with specific domain, e.g. wakeup domain. The following diagram is from the device specific TRM.
In case of AM62Ax, each Dio instance supports 9 banks of 16 DIO signals/pins or channels (1 in MCU). Please note in each instance there are some pins that are not pinned out and are reserved.
The mapping of pins in the different instances is shown in the following table. For this implementation the absolute numbering of channel ids starts from the Dio instance in the wakeup domain. Please refer TRM for more details.
| Instance | Pin Number | ChannelId | Port ID | Available/Not Available |
|---|---|---|---|---|
| MCU_GPIO 0 | 0 | 22 | 0 | Available |
The Dio Driver implementation supports multiple configuration variants (refer section Introduction), the driver expects generated Dio_Cfg.h to be present as (File Structure). Please refer (Build) to specify path to generated configuration. The associated dio driver configuration generated files Dio_Cfg.c and Dio_Lcfg.c to be present as show (File Structure)
The following section details on the un-supported features and additional features added.
As the microcontroller currently doesn't support direct read back, the AUTOSAR requirement pertaining to direct read back has not been implemented.
This structure contains all post-build configurable parameters of the DIO driver. As post-build configuration is not supported, this structure has not been used in this implementation.
This driver implementation introduces configurable options listed below
| Name | DioDeviceVariant |
| 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. Based on the family, the number of instances of Dio module supported could vary. |
| Container Name | DioGeneral |
| Type | Enumeration |
| Range | AM62Ax, etc… (new family of devices could be added in future) |
| Value Configuration Class | VARIANT-PRE-COMPILE |
| Name | DIO_WRITE_PORT_EVENT_ID |
| Description | This is the event ID for Dem event in the Dio_WritePort() API |
| Container Name | DioDemEventParameterRef |
| Type | IDENTIFIABLE |
| Value Configuration Class | VARIANT-PRE-COMPILE |
| Name | DIO_WRITE_CHANNEL_EVENT_ID |
| Description | This is the event ID for Dem event in the Dio_WriteChannel() API. |
| Container Name | DioDemEventParameterRef |
| Type | IDENTIFIABLE |
| Value Configuration Class | VARIANT-PRE-COMPILE |
| Name | DioRegisterReadbackApi |
| Description | Adds / Removes service API DioRegisterReadbackApi () Safety feature : Check some of the critical registers (corruption of which could potentially break functionality of the Dio) The expected usage: Periodically this service API is invoked and checked for data-consistency. i.e. the values of the registers checked in this API are not expected to change. Also refer (Dio_RegisterReadback) |
| Container Name | DioGeneral |
| Type | Boolean |
| Value Configuration Class | VARIANT-PRE-COMPILE |
To protect HW from un-intended re-configuration (corrupted / fault hardware), some of the critical registers are read periodically and checked. By an entity outside the driver, the values of these registers are not expected to change. This is an optional service API, which can be turned OFF (refer section DioRegisterReadbackApi)
| Description | Comments | |
| Service Name | Dio_RegisterReadback | Can potentially be turned OFF (design_dio_desc_cfg_ti) |
| Syntax | uint32 Dio_RegisterReadback (DIO_ChannelType ChannelId) | Returns PID register of associated DIO module |
| Service ID | NA | |
| Sync / Async | Sync | |
| Reentrancy | Non Reentrant | |
| Parameter in | ChannelId | Channel Identifier |
| Parameters out | None | |
| Return Value | Standard unsigned integer | An integer value |
The Driver doesn’t register any interrupts handler (ISR), it is expected that consumer of this driver registers the required interrupt handler.
The driver doesn't configure the functional clock and power for the Dio modules. Its expected that SBL powers-up the required modules. Please refer SBL documentation.
Please follow steps detailed in section (Build) to build library or example.
Please follow the steps detailed in section (Running Examples) to build and run example. Back To Top
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 | DIO_CODE | DIO_CONST | DIO_CONFIG |
| DIO_VAR_CONST_UNSPECIFIED_SECTION (.data) | USED | ||
| DIO_VAR_CONST_32_SECTION (.data) | USED | ||
| DIO_FUNC_TEXT_SECTION | USED | ||
| DIO_CONFIG_DATA_SECTION_NON_CONST | USED | ||
| DIO_CONFIG_DATA_SECTION_CONST | USED |
This driver implementation has been validated with cache enabled. For optimal performance it is 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_Dio_DIO_EXCLUSIVE_AREA_0 (), SchM_Exit_Dio_DIO_EXCLUSIVE_AREA_0 () to enter critical section and exit.
In the example implementation (File Structure SchM_Dio.c) , all the interrupts on CPU are disabled.
Development errors are reported to the DET using the service Det_ReportError(), when enabled. The driver interface (Dio.h File Structure) lists the SID
| Type of Error | Related Error code | Value (Hex) |
| Invalid channel name requested | DIO_E_PARAM_INVALID_CHANNEL_ID | 0x0A |
| Parameter is NULL Pointer | DIO_E_PARAM_CONFIG | 0x10 |
| Invalid Port Nam3 | DIO_E_PARAM_INVALID_PORT_ID | 0x14 |
| API parameter checking: invalid channel | DIO_E_PARAM_INVALID_GROUP | 0x1F |
| NULL Pointer | DIO_E_PARAM_POINTER | 0x20 |
Production error are reported to DEM via the service DEM_ReportErrorStatus(). In addition to standard errors, this implementation reports "DIO_WRITE_CHANNEL_EVENT_ID" and "DIO_WRITE_PORT_EVENT_ID" for DEM events in channel and port writes.
The AUTOSAR BSW Dio Driver specification details the APIs required for Dio Driver. Please refer to (design_dio_low_level) for detailed API description. Also refer to (Non Standard Service APIs) for non-standard APIs which are included in this implemented.
Refer API Documentation for details Back To Top
The example application demonstrates use of Dio module, the list below identifies key steps performed the example. The configuration file is present at (File Structure)
### AM62Ax {#ug_dio_eg_log_Am62Ax}
[MCU_R5FSS0_0]
Sample Application - STARTS !!!
DIO MCAL Version Info
---------------------
Vendor ID : 44
Module ID : 120
SW Major Version : 9
SW Minor Version : 0
SW Patch Version : 0
Test A. Write and Read Channel
------------------------------
Channels written
Channel read DIO_PinLevel[0] = 0
Channel read DIO_PinLevel[1] = 1
Channel read DIO_PinLevel[2] = 0
DIO Service API Read-back Channel Succeeds !!!
DIO Service API Read-back Channel Succeeds for Main_GPIO_0 !!!
DIO Service API Read-back Channel Succeeds for Main_GPIO_1 !!!
DIO Test A :Service API: Write/Read Channel completed
Test B. Write and Read Channel Group
---------------------
DIO Service Read/Write Channel Group Read-back Succeeds !!!
DIO Test B : Service API : Write/Read Channel Group completed
Test C. Write and Read Port
---------------------
DIO Service API Read-Back Port succeeds !!!
DIO Test C : Service API: Write/Read Port completed
Test D. Flip Channel
----------------------
Pin Value Before Flip: 0
Pin Value After Flip: 1
DIO Test D : Service API: Flip Channel completed
DIO Stack Usage: 2836 bytes
----------------------------------
DioApp: Sample Application - Completes successfully !!! | Revision | Date | Author | Description | Status |
|---|---|---|---|---|
| 0.1 | 22 Nov 2022 | Dinesh Kumar C E | First version | Approved |
| 0.2 | 15 Mar 2023 | Vyankatesh D | Updated Example log | Approved |
| 0.3 | 21 July 2023 | Vyankatesh D | Updated Example log | Approved |
| 0.4 | 11 Sep 2023 | Pranathi Vadakattu | Updated Example log | Approved |