iLLD_TC27xC  1.0
How to use the PSI5S PSI5S Interface driver?
Collaboration diagram for How to use the PSI5S PSI5S Interface driver?:

PSI5S defines a current loop based serial communication link typically used to connect airbag sensors or other peripheral devices.Data transmission and configuration of the sensor can be done by modulation of the Sync Pulses.

In the following sections it will be described, how to integrate the driver into the application framework.

Preparation

Include Files

Include following header file into your C code:

Variables

// PSI5S handle

Module Initialisation

// create module config
IfxPsi5s_Psi5s_Config psi5sModuleConfig;
IfxPsi5s_Psi5s_initModuleConfig(&psi5sModuleConfig, &MODULE_PSI5S);
IfxPsi5s_Psi5s_initModule(&psi5s, &psi5sModuleConfig);

Channel Initialisation

// create channel config
IfxPsi5s_Psi5s_ChannelConfig psi5sChannelConfig;
IfxPsi5s_Psi5s_initChannelConfig(&psi5sChannelConfig, &psi5s);
// change channel (default is channel 0, change to channel 4)
psi5sChannelConfig.channelId = IfxPsi5s_ChannelId_4;
// change payloadlength (default is 0, i.e., no frame expecte; change to 8)
for(int slot=0; slot<6; ++slot)
{
psi5sChannelConfig.receiveControl.payloadLength[slot] = 8;
}
// change channel (default is channel 0, change to channel 4)
psi5sChannelConfig.channelId = IfxPsi5s_ChannelId_4;
// initialize the channel
IfxPsi5s_Psi5s_initChannel(&psi5sChannel, &psi5sChannelConfig);

Now, PSI5S is ready. Then, call the below APIs to do operation.

Send Channel Data

uint32 channels = (1 << IfxPsi5s_ChannelId_4); // enable channel 4
uint32 mask = (1 << IfxPsi5s_ChannelId_4); // modify the selection for channel 4
// enable the channel trigger counter
// enable the channel
IfxPsi5s_Psi5s_enableDisableChannels(&psi5s, channels, mask);
// start ASC interface
uint32 data = 0x5;
// send data
if(IfxPsi5s_Psi5s_sendChannelData(&psi5sChannel, data))
{
// wait till data transfer is completed
while(psi5s.psi5s->INTSTAT[IfxPsi5s_ChannelId_4].B.TPI == 0);
}

Read Channel Frame

// enable ASC receiver
// start ASC interface
// add the code below to initiate the sensor to transmit frames
// end of code to initiate the sensor to transmit frames
IfxPsi5s_Psi5s_readFrame(&psi5sChannel, &frame))