2.23 SENT RX Driver

2.23.1 Introduction

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.2 Module Documentation

2.23.2.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.2.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.

2.23.2.1.1.1 Data structures
2.23.2.1.1.2 Definitions
2.23.2.1.1.3 Enumerations
2.23.2.1.1.4 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.2.1.1.5 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.2.1.2 Definition Documentation

2.23.2.1.2.1 SENT1_RX_Deinitialize

#define SENT1_RX_Deinitialize SENT1_Deinitialize

This macro defines the Custom Name for SENT1_Deinitialize API.

2.23.2.1.2.2 SENT1_RX_Disable

#define SENT1_RX_Disable SENT1_Disable

This macro defines the Custom Name for SENT1_Disable API.

2.23.2.1.2.3 SENT1_RX_Enable

#define SENT1_RX_Enable SENT1_Enable

This macro defines the Custom Name for SENT1_Enable API.

2.23.2.1.2.4 SENT1_RX_ErrorCallbackRegister

#define SENT1_RX_ErrorCallbackRegister SENT1_ErrorCallbackRegister

This macro defines the Custom Name for SENT1_ErrorCallbackRegister API.

2.23.2.1.2.5 SENT1_RX_Initialize

#define SENT1_RX_Initialize SENT1_Initialize

This macro defines the Custom Name for SENT1_Initialize API.

2.23.2.1.2.6 SENT1_RX_IsDataReceived

#define SENT1_RX_IsDataReceived SENT1_IsDataReceived

This macro defines the Custom Name for SENT1_IsDataReceived API.

2.23.2.1.2.7 SENT1_RX_Receive

#define SENT1_RX_Receive SENT1_Receive

This macro defines the Custom Name for SENT1_Receive API.

2.23.2.1.2.8 SENT1_RX_ReceiveCompleteCallbackRegister

#define SENT1_RX_ReceiveCompleteCallbackRegister SENT1_ReceiveCompleteCallbackRegister

This macro defines the Custom Name for SENT1_ReceiveCompleteCallbackRegister API.

2.23.2.1.2.9 SENT1_RX_ReceiveStatusGet

#define SENT1_RX_ReceiveStatusGet SENT1_ReceiveStatusGet

This macro defines the Custom Name for SENT1_ReceiveStatusGet API.

2.23.2.1.2.10 SENT1_RX_Tasks

#define SENT1_RX_Tasks SENT1_Tasks

This macro defines the Custom Name for SENT1_Tasks API.

2.23.2.1.3 Function Documentation

2.23.2.1.3.1 SENT1_Deinitialize()

void SENT1_Deinitialize (void )

Deinitializes the SENT1 to POR values.

Parameters:
none
Returns:

none

2.23.2.1.3.2 SENT1_Disable()

void SENT1_Disable (void )

Disables the SENT1 module.

Parameters:
none
Returns:

none

2.23.2.1.3.3 SENT1_Enable()

void SENT1_Enable (void )

Enables the SENT1 module.

Parameters:
none
Returns:

none

2.23.2.1.3.4 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

2.23.2.1.3.5 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

2.23.2.1.3.6 SENT1_Initialize()

void SENT1_Initialize (void )

Initializes the SENT module.

Parameters:
none
Returns:

none

2.23.2.1.3.7 SENT1_IsDataReceived()

bool SENT1_IsDataReceived (void )

Returns the receive complete status.

Parameters:
none
Returns:

true - SENT receive completed

false - SENT receive not completed

2.23.2.1.3.8 SENT1_Receive()

struct SENT_DATA_RECEIVE SENT1_Receive (void )

Reads the received data from transmitter.

Parameters:
none
Returns:

SENT_DATA_RECEIVE - Received data structure

2.23.2.1.3.9 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

2.23.2.1.3.10 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

2.23.2.1.3.11 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

2.23.2.1.3.12 SENT1_Tasks()

void SENT1_Tasks (void )

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

Parameters:
none
Returns:

none

2.23.2.1.4 Enumeration Type Documentation

2.23.2.1.4.1 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.2.1.5 Variable Documentation

2.23.2.1.5.1 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.3 Class Documentation

2.23.3.1 SENT_DATA_RECEIVE Struct Reference

This data structure used to configure the SENT data packet.

2.23.3.1.1 Detailed Description

This data structure used to configure the SENT data packet.

#include <sent_rx_types.h>

2.23.3.1.2 Member Data Documentation

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

source/

sent_rx_types.h

2.23.3.1.2.1 crc

unsigned crc

Defines the CRC field

2.23.3.1.2.2 data1

unsigned data1

Defines the first data nibble field

2.23.3.1.2.3 data2

unsigned data2

Defines the second data nibble field

2.23.3.1.2.4 data3

unsigned data3

Defines the third data nibble field

2.23.3.1.2.5 data4

unsigned data4

Defines the fourth data nibble field

2.23.3.1.2.6 data5

unsigned data5

Defines the fifth data nibble field

2.23.3.1.2.7 data6

unsigned data6

Defines the sixth data nibble field

2.23.3.1.2.8 status

unsigned status

Defines the status field

2.23.3.2 SENT_RECEIVE_INTERFACE Struct Reference

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

2.23.3.2.1 Detailed Description

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

#include <sent_rx_interface.h>

2.23.3.2.1.1 Public Attributes

2.23.3.2.2 Member Data Documentation

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

source/

sent_rx_interface.h

2.23.3.2.2.1 Deinitialize

void(* Deinitialize) (void)

Pointer to SENTx_Deinitialize e.g. SENT1_Deinitialize.

2.23.3.2.2.2 Disable

void(* Disable) (void)

Pointer to SENTx_Disable e.g. SENT1_Disable.

2.23.3.2.2.3 Enable

void(* Enable) (void)

Pointer to SENTx_Enable e.g. SENT1_Enable.

2.23.3.2.2.4 ErrorCallbackRegister

void(* ErrorCallbackRegister) (void *handler)

Pointer to SENTx_ErrorCallbackRegister e.g. SENT1_ErrorCallbackRegister.

2.23.3.2.2.5 Initialize

void(* Initialize) (void)

Pointer to SENTx_Initialize e.g. SENT1_Initialize.

2.23.3.2.2.6 IsDataReceived

bool(* IsDataReceived) (void)

Pointer to SENTx_IsDataReceived e.g. SENT1_IsDataReceived.

2.23.3.2.2.7 Receive

struct SENT_DATA_RECEIVE(* Receive) (void)

Pointer to SENTx_Receive e.g. SENT1_Receive.

2.23.3.2.2.8 ReceiveCompleteCallbackRegister

void(* ReceiveCompleteCallbackRegister) (void *handler)

Pointer to SENTx_ReceiveCompleteCallbackRegister e.g. SENT1_ReceiveCompleteCallbackRegister.

2.23.3.2.2.9 ReceiveStatusGet

enum SENT_RECEIVE_STATUS(* ReceiveStatusGet) (void)

Pointer to SENTx_ReceiveStatusGet e.g. SENT1_ReceiveStatusGet.

2.23.3.2.2.10 Tasks

void(* Tasks) (void)

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

2.23.4 File Documentation

2.23.4.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.4.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.4.1.2 Macros

2.23.4.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.4.1.4 Detailed Description

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

SENT1 Generated Driver Header File

2.23.4.2 source/sent_rx_interface.h File Reference

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

2.23.4.2.1 Data structures

2.23.4.3 source/sent_rx_types.h File Reference

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

2.23.4.3.1 Data structures

  • struct SENT_DATA_RECEIVE

    This data structure used to configure the SENT data packet.

2.23.4.3.2 Enumerations

2.23.4.3.3 Detailed Description

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

SENT Generated Driver Types Header File