2.23 SENT RX Driver

Overview

Single-Edge Nibble Transmission(SENT) is a unidirectional, single-wire communications protocol that is based on SAE J2716. The protocol is designed for point-to-point transmission of signal values, using a signal system based on successive falling edges.

Features

  • Automatic detection of CRC errors.
  • Pause Pulse period.
  • Requested Nominal Tick Time range varies based on the clock source frequency of the selected PLIB.

2.23.1 Module Documentation

2.23.1.1 SENT RX Driver

SENT Receiver driver. The Single-Edge Nibble Transmission for Automotive Applications is based on the SAE J2716. It is intended for use in applications where high-resolution sensor data need to be communicated using dsPIC MCUs.

2.23.1.1.1 Module description

SENT Receiver driver. The Single-Edge Nibble Transmission for Automotive Applications is based on the SAE J2716. It is intended for use in applications where high-resolution sensor data need to be communicated using dsPIC MCUs.

Data structures
Definitions
Enumerations
Functions
  • void SENT1_Initialize (void)

    Initializes the SENT module.

  • void SENT1_Deinitialize (void)

    Deinitializes the SENT1 to POR values.

  • void SENT1_Enable (void)

    Enables the SENT1 module.

  • void SENT1_Disable (void)

    Disables the SENT1 module.

  • struct SENT_DATA_RECEIVE SENT1_Receive (void)

    Reads the received data from transmitter.

  • bool SENT1_IsDataReceived (void)

    Returns the receive complete status.

  • enum SENT_RECEIVE_STATUS SENT1_ReceiveStatusGet (void)

    Gets the reception status of the SENT module.

  • void SENT1_ReceiveCompleteCallbackRegister (void *handler)

    This function can be used to override default callback and to define custom callback for SENT1 ReceiveComplete event.

  • void SENT1_ReceiveCompleteCallback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using SENT1_ReceiveCompleteCallbackRegister.

  • void SENT1_ErrorCallbackRegister (void *handler)

    This function can be used to override default callback and to define custom callback for SENT1 Error event.

  • void SENT1_ErrorCallback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using SENT1_ErrorCallbackRegister.

  • void SENT1_Tasks (void)

    This function is used to implement the tasks for polled implementations.

Variables
  • const struct SENT_RECEIVE_INTERFACE SENT1_RX

    Structure object of type SENT_RECEIVE_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. SENT1_RX can be changed by the user in the SENT user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

2.23.1.1.2 Definition Documentation

SENT1_RX_Deinitialize

#define SENT1_RX_Deinitialize SENT1_Deinitialize

This macro defines the Custom Name for SENT1_Deinitialize API.

SENT1_RX_Disable

#define SENT1_RX_Disable SENT1_Disable

This macro defines the Custom Name for SENT1_Disable API.

SENT1_RX_Enable

#define SENT1_RX_Enable SENT1_Enable

This macro defines the Custom Name for SENT1_Enable API.

SENT1_RX_ErrorCallbackRegister

#define SENT1_RX_ErrorCallbackRegister SENT1_ErrorCallbackRegister

This macro defines the Custom Name for SENT1_ErrorCallbackRegister API.

SENT1_RX_Initialize

#define SENT1_RX_Initialize SENT1_Initialize

This macro defines the Custom Name for SENT1_Initialize API.

SENT1_RX_IsDataReceived

#define SENT1_RX_IsDataReceived SENT1_IsDataReceived

This macro defines the Custom Name for SENT1_IsDataReceived API.

SENT1_RX_Receive

#define SENT1_RX_Receive SENT1_Receive

This macro defines the Custom Name for SENT1_Receive API.

SENT1_RX_ReceiveCompleteCallbackRegister

#define SENT1_RX_ReceiveCompleteCallbackRegister SENT1_ReceiveCompleteCallbackRegister

This macro defines the Custom Name for SENT1_ReceiveCompleteCallbackRegister API.

SENT1_RX_ReceiveStatusGet

#define SENT1_RX_ReceiveStatusGet SENT1_ReceiveStatusGet

This macro defines the Custom Name for SENT1_ReceiveStatusGet API.

SENT1_RX_Tasks

#define SENT1_RX_Tasks SENT1_Tasks

This macro defines the Custom Name for SENT1_Tasks API.

2.23.1.1.3 Function Documentation

SENT1_Deinitialize()

void SENT1_Deinitialize (void )

Deinitializes the SENT1 to POR values.

Parameters:
none
Returns:

none

SENT1_Disable()

void SENT1_Disable (void )

Disables the SENT1 module.

Parameters:
none
Returns:

none

SENT1_Enable()

void SENT1_Enable (void )

Enables the SENT1 module.

Parameters:
none
Returns:

none

SENT1_ErrorCallback()

void SENT1_ErrorCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using SENT1_ErrorCallbackRegister.

Parameters:
none
Returns:

none

SENT1_ErrorCallbackRegister()

void SENT1_ErrorCallbackRegister (void * handler)

This function can be used to override default callback and to define custom callback for SENT1 Error event.

Parameters:
in handler

- Address of the callback function

Returns:

none

SENT1_Initialize()

void SENT1_Initialize (void )

Initializes the SENT module.

Parameters:
none
Returns:

none

SENT1_IsDataReceived()

bool SENT1_IsDataReceived (void )

Returns the receive complete status.

Parameters:
none
Returns:

true - SENT receive completed

false - SENT receive not completed

SENT1_Receive()

struct SENT_DATA_RECEIVE SENT1_Receive (void )

Reads the received data from transmitter.

Parameters:
none
Returns:

SENT_DATA_RECEIVE - Received data structure

SENT1_ReceiveCompleteCallback()

void SENT1_ReceiveCompleteCallback (void )

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using SENT1_ReceiveCompleteCallbackRegister.

Parameters:
none
Returns:

none

SENT1_ReceiveCompleteCallbackRegister()

void SENT1_ReceiveCompleteCallbackRegister (void * handler)

This function can be used to override default callback and to define custom callback for SENT1 ReceiveComplete event.

Parameters:
in handler

- Address of the callback function

Returns:

none

SENT1_ReceiveStatusGet()

enum SENT_RECEIVE_STATUS SENT1_ReceiveStatusGet (void )

Gets the reception status of the SENT module.

Parameters:
none
Returns:

Returns the SENT module reception status SENT_RECEIVE_STATUS

SENT1_Tasks()

void SENT1_Tasks (void )

This function is used to implement the tasks for polled implementations.

Parameters:
none
Returns:

none

2.23.1.1.4 Enumeration Type Documentation

SENT_RECEIVE_STATUS

enum SENT_RECEIVE_STATUS

Defines the SENT receive status. More than one of these values may be OR'd together to create a complete status value. To test a value of this type, the bit of interest must be AND'ed with value and checked to see if the result is non-zero.

SENT_RECEIVE_SYNCTXEN

Synchronization Period Receive Enable bit

SENT_RECEIVE_RXIDLE

Indicates whether The SENTx data bus has been Idle (high) for a period of SYNCMAX or greater

SENT_RECEIVE_FRAMEERR

Indicates whether data nibble was received with less than 12 Tick periods or greater than 27 Tick periods

SENT_RECEIVE_CRCERR

Indicates whether a CRC error occurred for the data nibbles in SENTxDATH/L

SENT_RECEIVE_NIBBLE1

Module is receiving Data Nibble 1

SENT_RECEIVE_NIBBLE2

Module is receiving Data Nibble 2

SENT_RECEIVE_NIBBLE3

Module is receiving Data Nibble 3

SENT_RECEIVE_NIBBLE4

Module is receiving Data Nibble 4

SENT_RECEIVE_NIBBLE5

Module is receiving Data Nibble 5

SENT_RECEIVE_NIBBLE6

Module is receiving Data Nibble 6

SENT_RECEIVE_CRC

Module is receiving Data CRC

SENT_RECEIVE_PAUSEPERIOD

Indicates whether the module is receiving a Pause period

2.23.1.1.5 Variable Documentation

SENT1_RX

const struct SENT_RECEIVE_INTERFACE SENT1_RX

Structure object of type SENT_RECEIVE_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. SENT1_RX can be changed by the user in the SENT user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

2.23.2 Class Documentation

2.23.2.1 SENT_DATA_RECEIVE Struct Reference

This data structure used to configure the SENT data packet.

2.23.2.1.1 Detailed Description

This data structure used to configure the SENT data packet.

#include <sent_rx_types.h>

2.23.2.1.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

sent_rx_types.h

crc

unsigned crc

Defines the CRC field

data1

unsigned data1

Defines the first data nibble field

data2

unsigned data2

Defines the second data nibble field

data3

unsigned data3

Defines the third data nibble field

data4

unsigned data4

Defines the fourth data nibble field

data5

unsigned data5

Defines the fifth data nibble field

data6

unsigned data6

Defines the sixth data nibble field

status

unsigned status

Defines the status field

2.23.2.2 SENT_RECEIVE_INTERFACE Struct Reference

Structure containing the function pointers of SENT driver in receive mode.

2.23.2.2.1 Detailed Description

Structure containing the function pointers of SENT driver in receive mode.

#include <sent_rx_interface.h>

Public Attributes

2.23.2.2.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

sent_rx_interface.h

Deinitialize

void(* Deinitialize) (void)

Pointer to SENTx_Deinitialize e.g. SENT1_Deinitialize.

Disable

void(* Disable) (void)

Pointer to SENTx_Disable e.g. SENT1_Disable.

Enable

void(* Enable) (void)

Pointer to SENTx_Enable e.g. SENT1_Enable.

ErrorCallbackRegister

void(* ErrorCallbackRegister) (void *handler)

Pointer to SENTx_ErrorCallbackRegister e.g. SENT1_ErrorCallbackRegister.

Initialize

void(* Initialize) (void)

Pointer to SENTx_Initialize e.g. SENT1_Initialize.

IsDataReceived

bool(* IsDataReceived) (void)

Pointer to SENTx_IsDataReceived e.g. SENT1_IsDataReceived.

Receive

struct SENT_DATA_RECEIVE(* Receive) (void)

Pointer to SENTx_Receive e.g. SENT1_Receive.

ReceiveStatusGet

enum SENT_RECEIVE_STATUS(* ReceiveStatusGet) (void)

Pointer to SENTx_ReceiveStatusGet e.g. SENT1_ReceiveStatusGet.

Tasks

void(* Tasks) (void)

Pointer to SENTx_Tasks e.g. SENT1_Tasks (Supported only in polling mode)

2.23.3 File Documentation

2.23.3.1 source/sent1.h File Reference

This is the generated driver header file for the SENT1 driver.

#include <xc.h>
#include <stdbool.h>
#include <stdint.h>
#include "sent_rx_types.h"
#include "sent_rx_interface.h"

2.23.3.1.1 Functions

  • void SENT1_Initialize (void)

    Initializes the SENT module.

  • void SENT1_Deinitialize (void)

    Deinitializes the SENT1 to POR values.

  • void SENT1_Enable (void)

    Enables the SENT1 module.

  • void SENT1_Disable (void)

    Disables the SENT1 module.

  • struct SENT_DATA_RECEIVE SENT1_Receive (void)

    Reads the received data from transmitter.

  • bool SENT1_IsDataReceived (void)

    Returns the receive complete status.

  • enum SENT_RECEIVE_STATUS SENT1_ReceiveStatusGet (void)

    Gets the reception status of the SENT module.

  • void SENT1_ReceiveCompleteCallbackRegister (void *handler)

    This function can be used to override default callback and to define custom callback for SENT1 ReceiveComplete event.

  • void SENT1_ReceiveCompleteCallback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using SENT1_ReceiveCompleteCallbackRegister.

  • void SENT1_ErrorCallbackRegister (void *handler)

    This function can be used to override default callback and to define custom callback for SENT1 Error event.

  • void SENT1_ErrorCallback (void)

    This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using SENT1_ErrorCallbackRegister.

  • void SENT1_Tasks (void)

    This function is used to implement the tasks for polled implementations.

2.23.3.1.2 Macros

2.23.3.1.3 Variables

  • const struct SENT_RECEIVE_INTERFACE SENT1_RX

    Structure object of type SENT_RECEIVE_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. SENT1_RX can be changed by the user in the SENT user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

2.23.3.1.4 Detailed Description

This is the generated driver header file for the SENT1 driver.

SENT1 Generated Driver Header File

2.23.3.2 source/sent_rx_interface.h File Reference

#include <stdbool.h>
#include <stdint.h>
#include "sent_rx_types.h"

2.23.3.2.1 Data structures

2.23.3.3 source/sent_rx_types.h File Reference

This is the generated driver types header file for the SENT driver.

2.23.3.3.1 Data structures

  • struct SENT_DATA_RECEIVE

    This data structure used to configure the SENT data packet.

2.23.3.3.2 Enumerations

2.23.3.3.3 Detailed Description

This is the generated driver types header file for the SENT driver.

SENT Generated Driver Types Header File