Ok, so where can I find information about configuring the AUTOSAR drivers? Is it provided by the tool provider, the semiconductor company, or the AUTOSAR portal? Well, let me tell you—it’s pretty much all three. In the following lines, I’ll explain where to find the best information, with the goal of giving you the expertise needed to not only know where to find the information but also how to find the right resources to successfully configure any AUTOSAR software unit.

Let’s go through the following example with the Port driver, the NXP S32K144 microcontroller, and the EB tresos AUTOSAR authoring tool.

AUTOSAR SWS

AUTOSAR is the official website of the AUTOSAR consortium and the place to find all the official documentation ( that by the way is a lot!! ), but be aware this documentation is mainly focus on develop the software units. Lets take the Port as an example If you look for Port documentation in the portal you will immediately discover there are two different documents.

The SRS version is a list of the actual requirements for this driver, while the SWS contains the software specifications extracted from the SRS. Therefore, we are only interested in the latter. Besides the Introduction, there are three other chapters we should focus on, starting with:

Functional Specification

All the information here is very useful when developing your own driver, but it is worth reading even if you're not building one. It explains the functionality of the entire driver. You don’t need to understand 100% of what’s written, but special attention should be paid to Section 7.3, which covers error detection. It outlines the error values for the DET module, or at least some of them.

API Specification

This section contains tables and additional requirements detailing the new types and functions provided by the Port driver. Be aware that these are not the only ones; for some modules, the manufacturer may add extra functions and types. The complete list should be included in the corresponding user manual. For instance, in the case of the S32K144, the driver user manuals are accompanied by a couple of PDFs called RTD_PORT_IM and RTD_PORT_UM, which contain the same library code. Don’t expect exceptional information or great examples, as this documentation is written by engineers.Here’s the list of AUTOSAR functions for the Port driver found in this section:

void Port_Init( const Port_ConfigType ∗ConfigPtr );
void Port_SetPinDirection( Port_PinType Pin, Port_PinDirectionType Direction );
void Port_SetPinMode( Port_PinType Pin, Port_PinModeType Mode );
void Port_GetVersionInfo( Std_VersionInfoType ∗versioninfo );
void Port_RefreshPortDirection( void  );

Configuration specification

The third and most important section for an AUTOSAR user is the one that tells you the configuration parameters to include in the code, as well as the different options you need to configure in the AUTOSAR tool you’re using. The information is grouped into a series of tables, organized within what are called "Containers." It can be easy to get lost trying to navigate through these containers, but here’s a tip: simply write the most important information from these tables in YAML notation.

Port: # Configuration of the Port module.
  PortConfigSet: # This container contains the configuration parameters and sub containers of the AUTOSAR Port module.
    PortContainer: # Container collecting the PortPins.
      PortNumberOfPortPins: # The number of specified PortPins in this PortContainer.
    PortPin: # Configuration of the individual port pins.
  
  PortPin: # Configuration of the individual port pins.
    PortPinDirection: # The initial direction of the pin (IN or OUT). If the direction is not changeable, the value configured here is 
                      # fixed. The direction must match the pin mode. E.g. a pin used for an ADC must be configured to be an in port. Implementation 
                      # Type: Port_PinDirectionType
    PortPinDirectionChangeable: # Parameter to indicate if the direction is changeable on a port pin during runtime. true: Port Pin 
                                # direction changeable enabled. false: Port Pin direction changeable disabled.
    PortPinId: # Pin Id of the port pin. This value will be assigned to the symbolic name derived from the port pin container short name.
    PortPinInitialMode: # Port pin mode from mode list for use with Port_Init() function.
    PortPinLevelValue: # Port Pin Level value from Port pin list.
    PortPinMode:  # Port pin mode from mode list. Note that more than one mode is allowed by default. That way it is e.g. possible to combine DIO with 
                  # another mode such as ICU.
    PortPinModeChangeable:  # Parameter to indicate if the mode is changeable on a port pin during runtime. True: Port Pin mode changeable allowed. 
                            # False: Port Pin mode changeable not permitted.
    PortPinEcucPartitionRef:  # Maps the Port pin to zero a multiple ECUC partitions. The ECUC partitions referenced are a subset of the ECUC partitions 
                              # where the Port driver is mapped to.
  
  PortGeneral: # Module wide configuration parameters of the PORT driver.
    PortDevErrorDetect: # Switches the development error detection and notification on or off. True: detection and notification is enabled. False: detection
                        # and notification is disabled.
    PortSetPinDirectionApi: # Pre-processor switch to enable / disable the use of the function Port_SetPinDirection(). TRUE: Enabled - 
                            # Function Port_SetPinDirection() is available. FALSE: Disabled - Function Port_SetPinDirection() is not available.
    PortSetPinModeApi: # Pre-processor switch to enable / disable the use of the function Port_SetPinMode(). True: Enabled - Function Port_SetPinMode() 
                        # is available. false: Disabled - Function Port_SetPinMode() is not available.
    PortVersionInfoApi: # Pre-processor switch to enable / disable the API to read out the modules version information. true: Version info API enabled. 
                        # false: Version info API disabled.
    PortEcucPartitionRef: # Maps the Port driver to zero a multiple ECUC partitions to make the modules API available in this partition.

You can match the YAML file above with the options you'll find in the EB tresos tool. Similar to the functions and types, each manufacturer adds its own options. However, they generally comply with what is outlined in the AUTOSAR documentation. Any additional options should be described in the official MCAL documentation.

NXP MCAL UM and IM

These are the official documents written by NXP, where they document all the interfaces in their corresponding MCAL drivers, including the options you need to use to successfully compile them. However, don't expect exceptional documentation—it's essentially a list of functions, types, and defines. You’ll already have a good understanding of what the main functions do by reading the AUTOSAR SWS documents. As for the examples... well, good luck with that. Sorry, there’s not much more to say.

Here’s the list of extra functions added by NXP for the S32K1xx family that are not part of the AUTOSAR specification (RTD_PORT_UM, page 51):

void Port_Set2PinsDirection( Port_PinType Pin1, Port_PinType Pin2, Port_PinDirectionType Direction );
void Port_SetAsUnusedPin( Port_PinType Pin );
void Port_SetAsUsedPin( Port_PinType Pin );
void Port_ResetPinMode( Port_PinType Pin );

MCU Reference Manual

This is, by far, the most important document you need to read, as it describes the characteristics of every peripheral in our microcontroller. It tells you what each peripheral is capable of, the registers you need to configure, and from there, you can deduce some of the parameters to configure in the AUTOSAR tool. For example, in Chapter 12, page 205, you'll find the section dedicated to the Port peripheral. It explains that each port has up to 32 pins, but not all of them are available on every port.

Keep reading and you will discover each port has available Filters, Interrupts, DMA support and each can be configure to work in differences modes ( section 12.2.2 Features, page 208 ). Also starting in page number 213 there is a figure and a series of tables showing the control registers assigned to each pin or ports where you can find the main configuration options, for instance this is the Pin control Register

Configuration

Lets see how all this information can be use to configure the Port MCAL driver in EB Tresos, getting back to AUTOSAR PORT SWS document section 10 Configuration specific we can see the contents of container PortGeneral in YAML notation

PortDevErrorDetect: # Switches the development error detection and notification on or off. True: detection and notification is enabled. False: detection
                    # and notification is disabled.
PortSetPinDirectionApi: # Pre-processor switch to enable / disable the use of the function Port_SetPinDirection(). TRUE: Enabled - 
                        # Function Port_SetPinDirection() is available. FALSE: Disabled - Function Port_SetPinDirection() is not available.
PortSetPinModeApi: # Pre-processor switch to enable / disable the use of the function Port_SetPinMode(). True: Enabled - Function Port_SetPinMode() 
                   # is available. false: Disabled - Function Port_SetPinMode() is not available.
PortVersionInfoApi: # Pre-processor switch to enable / disable the API to read out the modules version information. true: Version info API enabled. 
                    # false: Version info API disabled.
PortEcucPartitionRef: # Maps the Port driver to zero a multiple ECUC partitions to make the modules API available in this partition.

In EB tresos highlighted in yellow we can see these options, while the rest of them can be found in the RTD_PORT_UM section 4.37 Container PortGeneral, page 37.

and for the PortPin container the options in AUTOSAR docs says:

PortPinDirection: # The initial direction of the pin (IN or OUT). If the direction is not changeable, the value configured here is 
                  # fixed. The direction must match the pin mode. E.g. a pin used for an ADC must be configured to be an in port. Implementation 
                  # Type: Port_PinDirectionType
PortPinDirectionChangeable: # Parameter to indicate if the direction is changeable on a port pin during runtime. true: Port Pin 
                            # direction changeable enabled. false: Port Pin direction changeable disabled.
PortPinId: # Pin Id of the port pin. This value will be assigned to the symbolic name derived from the port pin container short name.
PortPinInitialMode: # Port pin mode from mode list for use with Port_Init() function.
PortPinLevelValue: # Port Pin Level value from Port pin list.
PortPinMode:  # Port pin mode from mode list. Note that more than one mode is allowed by default. That way it is e.g. possible to combine DIO with 
              # another mode such as ICU.
PortPinModeChangeable:  # Parameter to indicate if the mode is changeable on a port pin during runtime. True: Port Pin mode changeable allowed. 
                        # False: Port Pin mode changeable not permitted.
PortPinEcucPartitionRef:  # Maps the Port pin to zero a multiple ECUC partitions. The ECUC partitions referenced are a subset of the ECUC partitions 
                          # where the Port driver is mapped to.

In EB tresos these options are

And the rest of them can be found of course in the RTD_PORT_UM pdf, but details are in the Reference Manual for instance for containers PortPin PE and PortPin PS the information is in PORT_PCR register, bits 0 and 1 ( page 215 )

In general words you need to mainly understand two main things how the microcontroller peripheral works and the AUTOSAR requirements to handle it