4.4. CDD_I2C¶
4.4.1. Introduction¶
This document describes the functionality, API and configuration of the AUTOSAR BSW module I2C.
- Supported AUTOSAR Release:
4.3.1
- Supported Configuration Variants:
Pre-Compile
- Vendor ID:
I2C_VENDOR_ID (44) (TEXAS INSTRUMENTS)
- Module ID:
CDD_IPC_MODULE_ID (255)
- Supported Platform:
AM263x
The I2C component is a proprietary extension of AUTOSAR BSW. The I2C driver was designed similar to the SPI driver specifications and is compatible to AUTOSAR 4.3.1.
4.4.2. I2C Driver Architecture¶
The following figure shows where the I2C is located in the AUTOSAR architecture.
![../_images/i2c_architecture.png](../_images/i2c_architecture.png)
The expected flow for utilization of the driver as per the example application is interrupt registration (only required in case of interrupt mode), I2c driver initialization using Cdd_I2c_Init. Post initialization buffer set up linking is done to point channels to their respective buffers using Cdd_I2c_SetupEB and for writing data to slaves Cdd_I2c_AsyncTransmit() is used in both polling as well as interrupt mode.
For reception of data from I2c slaves Cdd_I2c_AsyncTransmit() can be used in interrupt mode. If polling mode is being used, use Cdd_I2c_PollingModeProcessing() and after these functional calls call Cdd_I2c_MainFunction to process any sequence in the queue and update the status of the queue to real time value.
4.4.3. Functional Description¶
4.4.3.1. Features and Additions/Extensions¶
On AM263x platform, there are 4 I2C instances I2C0, I2C1, I2C2 and I2C3 each consisting of 25 registers for control, data transmission and reception.
Supported |
Not Supported |
---|---|
Configurable Development error (Software supported) |
Multi master mode (Software limitation) |
Configurable No acknowledgement error check (Software supported) |
DMA mode (Software limitation) |
Configurable Arbitration loss error check (Software supported) |
|
Polling mode (Software supported) |
|
Interrupt mode (Software supported) |
|
Configurable multiple sequence in queue check (Software supported) |
|
Configurable arbitration loss parameter (Software supported) |
|
Configurable timeouts for reception, arbitration loss and queue (Software supported) |
|
Configurable queue size (Software supported) |
|
Configurable sequence size (Software supported) |
|
Configurable channel size (Software supported) |
|
Configurable data length (Software supported) |
|
Configurable Hardware units (Hardware supported) |
|
Configurable Channels (Software supported) |
|
Configurable Sequences (Software supported) |
|
Shareable channels (Software supported) |
|
Channel in use checks (Software supported) |
|
Sequence in use checks (Software supported) |
|
Hardware unit in use checks (Software supported) |
|
7 and 10 bit address schemes (Hardware supported) |
4.4.3.1.1. Configurable Development Error¶
User configurable error check to report development errors.
Blocking error
4.4.3.1.2. Configurable No Acknowledgement Error Check¶
User configurable check to treat a no acknowledgement condition as a development error
Applicable only when AM263x is in master receiving mode
4.4.3.1.3. Configurable Arbitration Loss Error Check¶
User configurable check to treat an arbitration loss condition as a development error.
Applicable in both master receive and master transmit mode for AM263x
4.4.3.1.4. Configurable Multiple Sequences in Queue Check¶
User configurable check to process the same sequence multiple times or only once inside the queue
4.4.3.1.5. Configurable Arbitration Loss Parameter¶
User configurable parameter to deal with arbitration loss condition
Possible parameters
CDD_I2C_BURST_MODE
I2c driver detaches from the bus without any recovery attempts.
CDD_I2C_RECURRENT_MODE
I2c driver sends multiple stop signals on the bus in an attempt to free the bus and recover control.
![../_images/i2c_config.png](../_images/i2c_config.png)
4.4.3.1.6. Configurable Timeouts¶
User configurable timeout for queue, reception in polling mode and arbitration loss
All the timeout periods are in ticks
It is user responsibility to initialize and start the timer in the application for timeouts to take effect
4.4.3.1.7. Configurable Queue, Sequence and Channel Size¶
User configurable maximum size for Sequence, Queue and Channel
4.4.3.1.8. Configurable Hardware Units¶
User configurable parameter to define how many Hardware Units (Instances) to use out of a maximum of 4
User configurable parameter to specify which Hardware Unit to use
User configurable parameter to specify Serial clock frequency (Channel bit rate)
User configurable parameter to specify the frequency at which the Hardware Unit will operate internally
User configurable input frequency to I2c module which will be used to set channel bit rate and I2c internal operational frequency. Please note that this frequency should be the same as the clock source selected in MCU module, this has to be maintained by the user.
![../_images/i2c_confighw.png](../_images/i2c_confighw.png)
4.4.3.1.9. Configurable Channels¶
User configurable parameter to define channel direction (read or write), I2c Slave address, address scheme (7 bit slave address or 10 bit slave address) and chained channel implementation.
A channel is the actual unit which contains the data to be transmitted along with direction(read/write) and slave address.
The number of channels configured can not exceed the maximum number of channels defined in the general container.
Data buffer is linked to channels in the application by provided API’s
Same channels can be used by multiple sequences
![../_images/i2c_configchannel.png](../_images/i2c_configchannel.png)
4.4.3.1.10. Configurable Sequences¶
User configurable parameter to define which Hardware unit to use, number of channels present in the sequence, sequence complete callback function and sequence error notify callback function
Sequences are accessible to the user and are passed as function parameters for transmission and reception
![../_images/i2c_configseq.png](../_images/i2c_configseq.png)
4.4.3.1.11. Channel in Use Checks¶
Channels in free state, i.e. not currently being transmitted by another sequence or the same sequence are available for transmission/reception
4.4.3.1.12. Sequence in Use Checks¶
Sequence not in transmission currently are available for use.
4.4.3.1.13. Hardware Unit in Use Checks¶
Hardware not in use, i.e. currently not transmitting/receiving any sequence is available for use.
4.4.3.2. Features Provided Beyond the AUTOSAR Standard¶
Hardware configuration unit container to handle different hardware units
Hardware configuration unit container to handle transfer speeds and hardware unit mapping. Parallel sequence and channel processing on different hardware units. Configure acknowledge and no acknowledge handling (ACK, NACK). Configurable addressing for standard (7bit) and extended (10bit) addresses.
I2C chain channel feature.
I2C sequence queuing feature.
I2C support for parallel handling of hardware units if more than one is available.
I2C improved error handling like:
Handling for SDA stuck scenario
Handling for SCL low held scenario
Handling for general communication timeout
4.4.3.3. Interrupt Service Routines¶
Interrupt routines are provided by the CDD I2C driver is Cdd_I2c_Isr_Handler(). Basically, the ISR’s are in the file Cdd_I2c_priv.c User might edit it for adapting for the suitable OS.
Interrupt handler shall be provided for each instance of the CDD I2C driver. e.g. If the SoC has 4 instances of CDD I2C Driver, four ISR
The corresponding CDD I2C Interrupt numbers are:
Hardware Units |
ISR Handler Mapped |
Interrupt Number |
---|---|---|
0 |
Cdd_I2c_HwUnit0_ISR |
44 |
1 |
Cdd_I2c_HwUnit1_ISR |
45 |
2 |
Cdd_I2c_HwUnit2_ISR |
46 |
3 |
Cdd_I2c_HwUnit3_ISR |
47 |
4.4.3.4. Initialization¶
The driver I2C is initialized by calling Cdd_I2c_Init () with a null pointer passed as argument. To re-initialize the driver call I2c_DeInit () and then I2c_Init () again. Only pre-compile variant is supported for the driver, hence all configuration related parameters are provided through the GUI. The service for de-initialization is provided with the function Cdd_I2c_DeInit ().
4.4.3.5. I2C maintains states for:¶
Driver
CDD_I2C_UNINIT
Driver is uninitialized
Cdd_I2c_Init () has not been called or Cdd_I2c_DeInit () has been called after initialization
CDD_I2C_IDLE
Driver is currently free, not in the middle of any transmission/reception process
CDD_I2C_BUSY
Driver is currently in use, transmission/reception in process
The state for I2c driver is returned with Cdd_I2c_GetStaus() function call.
Channels:-
CDD_I2C_CH_RESULT_OK
Channel transmission/reception not yet started
Channel transmission/reception successful
CDD_I2C_CH_RESULT_NOT_OK
Channel transmission/reception is not OK
CDD_I2C_CH_RESULT_IN_PROGRESS
Channel transmission/reception currently in progress
CDD_I2C_CH_RESULT_BUS_FAIL
Channel transmission/reception failed due to bus fault
CDD_I2C_CH_RESULT_ARBFAIL
Channel transmission/reception failed due to arbitration loss
CDD_I2C_CH_RESULT_NACKFAIL
Channel transmission/reception failed due to no acknowledge
The channel status is returned with Cdd_I2c_GetResult() function call. In case incorrect channel ID is passed a DET error occur
Sequences:-
CDD_I2C_SEQ_OK
Sequence transmission/reception not yet started
Sequence transmission/reception successful
CDD_I2C_SEQ_NOT_OK
Sequence transmission/reception in not OK
CDD_I2C_SEQ_PENDING
Sequence transmission/reception in progress
CDD_I2C_SEQ_QUEUED
Sequence queued
CDD_I2C_SEQ_NACK
Sequence failed due to no acknowledge
CDD_I2C_SEQ_FAILED
Sequence transmission/reception failed
CDD_I2C_SEQ_CANCELLED
Sequence cancelled
The sequence status is returned with Cdd_I2c_GetSequenceResult
Hardware Units:-
CDD_I2C_HW_UNIT_FREE
Hardware Unit not in use
CDD_I2C_HW_UNIT_BUSY
Hardware Unit busy
4.4.4. File Structure¶
The delivery of the I2C contains the files which are described in the chapters 4.10.4.1 and 4.10.4.2:
4.4.4.1. Static files¶
Cdd_I2c.c |
Source file that contains the API relevant implementation |
Cdd_I2c.h |
Header file that contains all API relevant declarations |
Cdd_I2c_Irq.c |
Contains the ISR implementation |
Cdd_I2c_Irq.h |
Contains the declarations of the ISR handlers |
Cdd_I2c_Priv.h |
Contains internal function declarations used to realize the driver |
Cdd_I2c_Priv.c |
Contains internal function definitions used to realize the driver |
Cdd_I2c_hw_reg.h |
Contains register offsets, mask values, shift values and specific bit set/reset macros |
4.4.4.2. Dynamic files¶
Cdd_I2c_Cfg.h |
This file contains general container configuration parameters like DET error ON, Polling mode OFF, Sequence size, Queue size, Channel size etc. |
Cdd_I2c_Cfg.c |
This file contains the configured sequence, channel and hardware configurations, along with I2c instance base address. |
![../_images/i2c_filestructure.png](../_images/i2c_filestructure.png)
4.4.5. Memory mapping¶
The objects (e.g. variables, functions, constants) are declared by compiler independent definitions – the compiler abstraction definitions. Each compiler abstraction definition is assigned to a memory section. The following table contains the memory section names and the compiler abstraction definitions of the I2C and illustrates their assignment among each other.
Memory Mapping Sections |
I2C_CODE |
I2C_VAR1 |
I2C_VAR_NO_INIT |
I2C_VAR_INIT |
CDD_VAR_ZERO_INIT |
I2C_CONST |
I2C_PBCFG |
I2C_APPL_CODE |
I2C_APPL_DATA |
---|---|---|---|---|---|---|---|---|---|
I2C_START_SEC_CODE I2C_STOP_SEC_CODE |
● |
||||||||
I2C_START_SEC_CODE_ISR I2C_STOP_SEC_CODE_ISR |
● |
||||||||
I2C_START_SEC_PBCFG_ROOT I2C_STOP_SEC_PBCFG_ROOT |
● |
||||||||
I2C_START_SEC_PBCFG I2C_STOP_SEC_PBCFG |
● |
||||||||
I2C_START_SEC_CONST_32BIT I2C_STOP_SEC_CONST_32BIT |
● |
||||||||
I2C_START_SEC_CONST_UNSPECIFIED I2C_STOP_SEC_CONST_UNSPECIFIED |
● |
||||||||
I2C_START_SEC_VAR_NOINIT_UNSPECIFIED I2C_STOP_SEC_VAR_NOINIT_UNSPECIFIED |
● |
||||||||
I2C_START_SEC_VAR_INIT_UNSPECIFIED I2C_STOP_SEC_VAR_INIT_UNSPECIFIED |
● |
||||||||
I2C_START_SEC_VAR_ZERO_INIT_UNSPECIFIED I2C_STOP_SEC_VAR_ZERO_INIT_UNSPECIFIED |
● |
||||||||
Application buffers passed to I2C |
● |
||||||||
Notification called from I2C |
● |
4.4.6. Services used by I2C driver¶
Service ID |
Service |
---|---|
0x00 |
CDD_I2C_Init |
0x01 |
CDD_I2c_DeInit |
0x02 |
CDD_I2c_GetVersionInfo |
0x03 |
CDD_I2c_SetupEB |
0x04 |
CDD_I2c_SetupEBDynamic |
0x05 |
CDD_I2c_AsyncTransmit |
0x06 |
CDD_I2c_Cancel |
0x07 |
CDD_I2c_GetResult |
0x08 |
CDD_I2c_GetSequenceResult |
0x09 |
CDD_I2c_MainFunction |
0x0A |
CDD_2c_PollingModeProcessing |
0x0B |
Cdd_I2c_SetHandling |
0x0C |
Cdd_I2c_RegisterReadback |
4.4.7. Dependencies on SW modules¶
4.4.7.1. DET¶
The module I2C depends on the DET (by default) in order to report development errors. Detection and reporting of development errors can be enabled or disabled by the switch “Enable Development Error Detection” on the “General” container within the module I2C. The DET can be replaced optionally by an equivalent component which is responsible to recognize development errors, if no DET component is available.
4.4.7.2. MCU¶
The module MCU powers up the microcontroller’s peripherals at startup time and initializes clock source. Since the peripherals are also containing the registers for I/O functionality they have to be activated if it is intended to use them.
4.4.7.3. PORT¶
The module PORT enables the I2C lines at startup time. To operate the I2C properly, the PORT driver has to be configured. The PORT driver sets the Pins to the required values for the I2C to operate. The Pins used are SDA (serial data line) and SCL (serial clock). An open drain configuration is recommended. Some I2C drivers require the PORT for switching from I2C functionality to DIO functionality – to use the “clock free” procedure - and back.
4.4.7.4. OS¶
The CDD I2C modules depends on OS (operating system) to invoke the services such as
GetElapsedValue to gets the number of ticks between the current tick value and a previously read tick value.
GetCounterValue for current count value of a counter.
4.4.7.5. SchM (Optional)¶
Beside the OSEK / AUTOSAR OS the Schedule Manager provides functions that module I2C calls at begin and end of critical sections.
4.4.8. API Description¶
All below mentioned API’s are user accessible and can be found in Cdd_I2c.c file
4.4.8.1. Supported API’s¶
4.4.8.1.1. void Cdd_I2c_Init( Cdd_I2c_ConfigPtrType* configPtr)¶
Argument passed to the function in NULL_PTR
Function returns void
Function is used to initialize all configured hardware units at specified frequencies
Function initializes queue to default values
4.4.8.1.2. Std_ReturnType Cdd_I2c_DeInit(void)¶
Function used to de-initialize all initialized I2c Hardware Units
Returns success upon successful initialization
Function can not be called in case driver is uninitialized
4.4.8.1.3. void Cdd_I2c_GetVersionInfo(Cdd_I2c_VersionInfoPtrType * versionInfoPtr)¶
Argument passed to the function is a valid pointer of type Cdd_I2c_VersionInfoPtrType
Function stores Version information in pointer
Function returns void
4.4.8.1.4. Std_ReturnType Cdd_I2c_SetupEB(I2c_ChannelType channelId, Cdd_I2c_DataPtrType txDataBufferPtr, Cdd_I2c_DataPtrType rxDataBufferPtr, Cdd_I2c_DataLengthType length)¶
Function sets up buffer for reception or transmission based on preconfigured channel ID’s passed as argument
Buffer pointer to store data for transmission/reception passed as argument
Length of message to read or write to slave device passed as argument
Both buffers can not be passed as NULL_PTR
Both buffers can not be passed as valid pointers
Pre-configured direction of the channel set up in the GUI should be maintained here as well to avoid development errors
Function returns success or failure
4.4.8.1.5. Std_ReturnType Cdd_I2c_SetupEBDynamic(I2c_ChannelType channelId, Cdd_I2c_AddressType address, Cdd_I2c_DataPtrType txDataBufferPtr, Cdd_I2c_DataPtrType rxDataBufferPtr, Cdd_I2c_DataLengthType length)¶
Function to set up buffer for reception or transmission of channel based on pre- configured channel ID’s passed as argument with a re-configurable slave address at run time
Buffer pointer to store data for transmission/reception passed as argument
Both Buffers can not be passed as NULL_PTR
Both buffers can not be passed as valid pointers
Valid slave address to be passed as an argument
Pre-configured direction of the channel set up in the GUI should be maintained here as well to avoid development errors
Function returns success or failure
4.4.8.1.6. Std_ReturnType Cdd_I2c_AsyncTransmit(I2c_SequenceType sequenceId)¶
Function use to transmit a sequence to receive/transmit data on the I2c bus
Sequence ID passed as parameter to the function
Transmission through this function can take place in both polling mode as well as interrupt mode
Reception through this function can only take place in interrupt mode
In case a sequence is not completed due to some reason, it is queued
Function returns success or failure
4.4.8.1.7. Std_ReturnType Cdd_I2c_Cancel(I2c_SequenceType sequenceId)¶
Function used to deque a sequence in queue
Sequence ID passed as argument
An ongoing sequence in transmission from queue can not be cancelled
Function returns success or failure
4.4.8.1.8. Cdd_I2c_ChannelResultType Cdd_I2c_GetResult(I2c_ChannelType channelId)¶
Function returns the channel result upon call, results depends on completion, failure or processing of a channel
Channel ID passed as a parameter
For return values check section 3.4->2
4.4.8.1.9. Cdd_I2c_SeqResultType Cdd_I2c_GetSequenceResult(I2c_SequenceType sequenceId)¶
Function returns the sequence result, result depends upon completion, failure or processing of a sequence
Sequence ID passed as a parameter
For return values check section 3.4->3
4.4.8.1.10. void Cdd_I2c_MainFunction(void)¶
Function used to process all the sequences in Queue and update sequence status accordingly
Function returns void
Function should be called periodically at the end
4.4.8.1.11. void Cdd_I2c_PollingModeProcessing(void)¶
Function used to receive data from the I2c bus in polling mode
Function returns void
Function process all sequences and receives data for all channels configured for read in one call
Only to be used in polling mode
4.4.8.1.12. void Cdd_I2c_SetHandling(Cdd_I2c_HandlingType handling)¶
Function used to handle arbitration loss condition
Handling parameter configured through GUI passed as argument
Function can either attempt to recover the bus control or detach from the bus after de-initializing the driver depending on the argument passed
See section 3.1->5 for possible values of input parameter for function
4.4.8.1.13. Cdd_I2c_ComponentStatusType Cdd_I2c_GetStatus(void)¶
Function used to return driver status
Requires no argument to be passed
See section 3.4->1 for possible return values
4.4.8.1.14. FUNC(Std_ReturnType, CDD_I2C_CODE)Cdd_I2c_RegisterReadback(uint8 HwInstance, P2VAR(Cdd_I2c_RegisterReadbackType, AUTOMATIC, CDDI2C_APPL_DATA) RegRbPtr)¶
Function used to check the status of critical registers which do not change during program execution.
Function returns Std_ReturnType.
4.4.8.2. Type definitions¶
The external visible and usable types defined by the I2C are described in this chapter.
TypeName |
C-Type |
Description |
Value Range |
---|---|---|---|
Cdd_I2c_ComponentStatusType |
enum |
States of the I2C driver |
I2C_UNINIT, driver is not initialized. I2C_IDLE, driver is initialized and ready. I2C_BUSY, driver is processing at least one sequence’s transmission process. |
Cdd_I2c_ChannelResultType |
enum |
The result of a channel |
I2C_CH_RESULT_OK, channel has finished successfully. I2C_CH_RESULT_BUSFAIL, bus failure detected. I2C_CH_RESULT_ARBFAIL, arbitration failure detected. I2C_CH_RESULT_NACKFAIL, nack failure detected |
Cdd_I2c_HW_cfg |
Enum |
Structure for CDD_I2C which contains Hw unit initialization parameters |
System clock frequency being used by the I2C instance |
Cdd_I2c_SeqResultType |
Enum |
States of the sequence. |
I2C_SEQ_OK, sequence finished normal. I2C_SEQ_PENDING, a sequence is in progress or queued. I2C_SEQ_QUEUED, sequence is queued. I2C_SEQ_NACK, sequence encountered a NACK signal. I2C_SEQ_FAILED, sequence failed due to error. I2C_SEQ_CANCELLED, sequence was cancelled by request. |
Cdd_I2c_HandlingType |
enum |
Variants of timeout handling |
I2C_BURST, no timeout observation. I2C_RECURRENT, perform countermeasure in case of timeout. |
Cdd_I2c_AddressType |
uint16 |
Address for bus clients. |
16 bits |
Cdd_I2c_DataType |
uint8 |
Data format of the I2c used for transmission and reception |
8 bits |
Cdd_I2c_DataLengthType |
uint16 |
Type for any length Parameter |
16 bits. |
Cdd_I2c_DataPtrType |
uint8 * |
Pointer type for general buffer handling. |
32 bits. |
Cdd_I2c_DataConstPtrType |
const uint8 * |
Pointer type for TX buffer handling |
32 bits |
Cdd_I2c_SequenceType |
uint8 |
Type for sequence identifier |
8 bits |
Cdd_I2c_ChannelType |
uint8 |
Type for channel identifier |
8 bits |
Cdd_I2c_RegisterReadbackType |
uint32 structure |
CDD I2C register readback structure |
32 bits |
4.4.8.3. Configuration Parameters¶
Texas Instruments Parameters |
Description |
Default Value |
---|---|---|
CddI2cDevErrorDetect |
The parameter defines the development error is ON or OFF |
STD_ON |
CddI2cUseInterrupts |
Switches to activate or deactivate interrupt controlled job processing (ON/OFF). |
STD_OFF |
CddI2cVersionInfoApi |
Pre-processor switch to enable/disable the API to read out the modules version information. |
STD_ON |
CddI2cArbitrationLossCheck |
Switches to activate or deactivate Arbitration loss interrupt(ON/OFF) |
STD_OFF |
CddI2cNackAsErrorCheck |
Switches to activate or deactivate NACK error check(ON/OFF). |
STD_OFF |
CddI2cCancelCheck |
Switches to activate or deactivate the Cancel channel transmission API(ON/OFF). |
STD_OFF |
CddI2cStatusCheck |
Switches to activate or deactivate Cdd_I2c_GetStatus API(ON/OFF). |
STD_OFF |
CddI2cMultipleSequenceInQueueProcessCheck |
Switches to activate or deactivate functionality to process same sequence in queue multiple times (ON/OFF). |
STD_OFF |
CddI2cArbitrationLossParam |
CDD_I2C Arbitration loss condition parameter, possible values are CDD_I2C_BURST_MODE (for detaching from bus) or CDD_I2C_RECURRENT_MODE (For sending 9 clock pulses to the slave in order to synchronize the bus) |
CDD_I2C_BURST_MODE |
CddIrqType |
Type of Isr function:void functionname(void) CAT1 : interrupt void func(void) CAT2 : ISR(func) |
CDD_I2C_ISR_VOID |
CddI2cOsCounterRef |
This parameter contains a reference to the OsCounter, which is used by the CddI2c driver. |
/AUTOSAR/EcucDefs/Os/OsCounter |
CddI2cDefaultOSCounterId |
Default Os Counter Id if node reference to OsCounter ref CddI2cOsCounterRef is not set |
0 |
CddI2cArbitrationLossTimeout |
I2C timeout - used for timing I2C arbitration loss wait |
1000 |
CddI2cPollTimeout |
I2C timeout - used for I2C polling timeout |
1000 |
CddI2cQueueTimeout |
I2C timeout - used for queue timeouts |
1000 |
CddI2cMaxlengthByte |
Maximum Length of byte to be write or read |
1 |
CddI2cHwUnitsUsed |
Maximum number of I2c hardware units used |
1 |
CddI2cEnableRegisterReadbackApi |
Switch to indicate that the Cdd_I2c_RegisterReadBack is supported |
STD_ON |
CddI2cHwUnitType |
I2c HW unit to use. |
CDD_I2C_HW_UNIT_0 |
CddI2cChannelBitRate |
Selection of Channel Bit Rate. |
CDD_I2C_100KHZ |
CddI2cHwUnitFrequency |
Frequency which the HW unit will utilise(Range = 6.7 MHz - 13.3 MHz), please note that this differs from the bus frequency used for communication |
12500000 |
CddI2cClkInputSrc |
Please ensure that the frequency used here should be the same as mcu clk settings for I2c, as this is required internally to calculate pre-scalar which is needed to set the bus frequency |
200000000 |
CddI2cChannelDirection |
Selection of Channel direction. |
CDD_I2C_WRITE |
CddI2cChannelSlaveAddress |
Set slave address for channel |
50 |
I2cSlaveAddressScheme |
Specifies whether channel is 7 bit or 10 bit. |
CDD_I2C_7_BIT_ADDRESS |
CddI2cSequenceHwUnitType |
I2c HW unit to use. |
CDD_I2C_HW_UNIT_0 |
CddI2cNumberOfChannelsInSequence |
Set the number of channels in the sequence |
1 |
CddI2cSequenceCompleteNotify |
Function pointer to callback function sequence complete notify |
NULL_PTR |
CddI2cSequenceErrorNotify |
Function pointer to callback function sequence complete notify |
NULL_PTR |
I2cChannelIndex |
This parameter specifies the order of Channels within the Sequence. |
CDD_I2C_MAXIMUM_CHANNEL_NUMBER |
I2cChannelAssignment |
A Sequence reference to a I2c channel. |
/AUTOSAR/EcucDefs/Cdd_I2c/ CddI2cChannelConfig |
4.4.9. Configurable callback functions¶
4.4.9.1. Notifications¶
At its configurable interfaces the I2C defines notifications that can be mapped to callback functions in case completion of a sequence or failure of a sequence. The mapping is not statically defined by the I2C but can be performed at configuration time.
4.4.9.2. I2c_SequenceCompleteNotification¶
Sequence transfer successful notification function. Can be configured in the configuration tool. Particularities and Limitations: It is advised to keep the code execution in the notification function as short as possible. Call context: Interrupt as well as polling
4.4.9.3. I2c_SequenceErrorNotification¶
Sequence transfer error notification function. If the I2c detects an error, this function notifies the application about a communication failure. Can be configured in the configuration tool. Particularities and Limitations: It is advised to keep the code execution in the notification function as short as possible. Call context: Interrupt as well as polling
For the Following API’s it is possible to be called from the sequence notifications:
Cdd_I2c_DeInit
Cdd_I2c_GetVersionInfo
Cdd_I2c_SetupEB
Cdd_I2c_SetupEBDynamic
Cdd_I2c_AsyncTransmit
CDD_I2c_Cancel
Cdd_I2c_GetResult
Cdd_I2c_GetSequenceResult
Cdd_I2c_MainFunction
Cdd_I2c_PollingModeProcessing
Cdd_I2c_SetHandling
Cdd_I2c_GetStatus
4.4.10. Error Handling¶
Development error reporting.
By default, development errors are reported to the DET using the service Det_ReportError (), If development error reporting is enabled (i.e. precompile parameter CDD_I2C_DEV_ERROR_DETECT==STD_ON). If another module is used for development error reporting, the function prototype for reporting the error can be configured by the integrator, but must have the same signature as the service Det_ReportError (). The reported I2C ID is 255
4.4.11. Example Application¶
I2C example application demonstrating the MCAL I2C driver features is in folder <MCAL_ROOT>/examples /I2C. This application can be built from the root folder by giving “gmake -s I2c_app PLATFORM=am263”. The details of running the application and the setup required is part of the MCAL User Guide present in <MCAL_ROOT>/mcal_docs/User guide/MCAL_UserGuide.pdf.
4.4.12. TI Disclaimer¶
Texas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to discontinue any product or service without notice, and advise customers to obtain the latest version of relevant information to verify, before placing orders, that information being relied on is current and complete. All products are sold subject to the terms and conditions of sale supplied at the time of order acknowledgment, including those pertaining to warranty, patent infringement, and limitation of liability.
TI warrants performance of its products to the specifications applicable at the time of sale in accordance with TI’s standard warranty. Testing and other quality control techniques are utilized to the extent TI deems necessary to support this warranty. Specific testing of all parameters of each device is not necessarily performed, except those mandated by government requirements.
Customers are responsible for their applications using TI components. In order to minimize risks associated with the customer’s applications, adequate design and operating safeguards must be provided by the customer to minimize inherent or procedural hazards.
TI assumes no liability for applications assistance or customer product design. TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right of TI covering or relating to any combination, machine, or process in which such products or services might be or are used. TI’s publication of information regarding any third party’s products or services does not constitute TI’s approval, license, warranty or endorsement thereof.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations and notices. Representation or reproduction o f this information with alteration voids all warranties provided for an associated TI product or service, is an unfair and deceptive business practice, and TI is not responsible nor liable for any such use.
Resale of TI’s products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service, is an unfair and deceptive business practice, and TI is not responsible nor liable for any such use.
Also see: Standard Terms and Conditions of Sale for Semiconductor Products https://www.ti.com/sc/docs/stdterms.htm
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265