2.24 SENT TX Driver
2.24.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
-
Driver supports two main modes of operation
- Asynchronous transmitter (default)
- Synchronous transmitter
- Hardware calculation of CRC .
- Pause Pulse period.
- Requested Nominal Tick Time range varies based on the clock source frequency of the selected PLIB .
2.24.2 Module Documentation
2.24.2.1 SENT TX Driver
SENT Transmit 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.24.2.1.1 Module description
SENT Transmit 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.24.2.1.1.1 Data structures
struct SENT_TRANSMIT_INTERFACE
Structure containing the function pointers of SENT driver in transmit mode.
struct SENT_DATA_TRANSMIT
This data structure used to configure the SENT data packet.
2.24.2.1.1.2 Enumerations
enum SENT_TRANSMIT_MODE { SENT_TRANSMIT_ASYNCHRONOUS, SENT_TRANSMIT_SYNCHRONOUS }
Defines the SENT transmission mode (Asynchronous and Synchronous)
enum SENT_TRANSMIT_STATUS { SENT_TRANSMIT_SYNCTXEN = (1U << 0U), SENT_TRANSMIT_NIBBLE1 = (1U << 4U), SENT_TRANSMIT_NIBBLE2 = (1U << 5U), SENT_TRANSMIT_NIBBLE3 = (3U << 4U), SENT_TRANSMIT_NIBBLE4 = (1U << 6U), SENT_TRANSMIT_NIBBLE5 = (5U << 4U), SENT_TRANSMIT_NIBBLE6 = (6U << 4U), SENT_TRANSMIT_CRC = (7U << 4U), SENT_TRANSMIT_PAUSEPERIOD = (1U << 7U) }
Defines the SENT transmit 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.
2.24.2.1.1.3 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.
void SENT1_TransmitModeSet (enum SENT_TRANSMIT_MODE mode)
Sets the SENT transmit mode.
void SENT1_Transmit (const struct SENT_DATA_TRANSMIT *sentData)
Writes the SENT data to receiver.
bool SENT1_IsTransmissionComplete (void)
Returns the transmit complete status.
enum SENT_TRANSMIT_STATUS SENT1_TransmitStatusGet (void)
Gets the transmission status of the SENT module.
void SENT1_TransmitCompleteCallbackRegister (void *handler)
This function can be used to override default callback and to define custom callback for SENT1 TransmitComplete event.
void SENT1_TransmitCompleteCallback (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_TransmitCompleteCallbackRegister.
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.
2.24.2.1.1.4 Variables
const struct SENT_TRANSMIT_INTERFACE SENT1_TX
Structure object of type SENT_TRANSMIT_INTERFACE with the custom name given by the user in the Melody Driver User interface.
2.24.2.1.2 Function Documentation
2.24.2.1.2.1 SENT1_Deinitialize()
void SENT1_Deinitialize (void )
Deinitializes the SENT1 to POR values.
none |
none |
2.24.2.1.2.2 SENT1_Disable()
void SENT1_Disable (void )
Disables the SENT1 module.
none |
none |
2.24.2.1.2.3 SENT1_Enable()
void SENT1_Enable (void )
Enables the SENT1 module.
none |
none |
2.24.2.1.2.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.
none |
none |
2.24.2.1.2.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.
in | handler |
- Address of the callback function |
none |
2.24.2.1.2.6 SENT1_Initialize()
void SENT1_Initialize (void )
Initializes the SENT module.
none |
none |
2.24.2.1.2.7 SENT1_IsTransmissionComplete()
bool SENT1_IsTransmissionComplete (void )
Returns the transmit complete status.
none |
true - SENT transmit completed false - SENT transmit not completed |
2.24.2.1.2.8 SENT1_Transmit()
void SENT1_Transmit (const struct SENT_DATA_TRANSMIT * sentData)
Writes the SENT data to receiver.
in | sentData |
- Structure which contains the data to be sent |
none |
2.24.2.1.2.9 SENT1_TransmitCompleteCallback()
void SENT1_TransmitCompleteCallback (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_TransmitCompleteCallbackRegister.
none |
none |
2.24.2.1.2.10 SENT1_TransmitCompleteCallbackRegister()
void SENT1_TransmitCompleteCallbackRegister (void * handler)
This function can be used to override default callback and to define custom callback for SENT1 TransmitComplete event.
in | handler |
- Address of the callback function |
none |
2.24.2.1.2.11 SENT1_TransmitModeSet()
void SENT1_TransmitModeSet (enum SENT_TRANSMIT_MODE mode)
Sets the SENT transmit mode.
in | mode |
- SENT Synchronous or Asynchronous |
none |
2.24.2.1.2.12 SENT1_TransmitStatusGet()
enum SENT_TRANSMIT_STATUS SENT1_TransmitStatusGet (void )
Gets the transmission status of the SENT module.
none |
Returns the SENT module transmission status SENT_TRANSMIT_STATUS |
2.24.2.1.3 Enumeration Type Documentation
2.24.2.1.3.1 SENT_TRANSMIT_MODE
enum SENT_TRANSMIT_MODE
Defines the SENT transmission mode (Asynchronous and Synchronous)
SENT_TRANSMIT_ASYNCHRONOUS | |
SENT_TRANSMIT_SYNCHRONOUS |
2.24.2.1.3.2 SENT_TRANSMIT_STATUS
enum SENT_TRANSMIT_STATUS
Defines the SENT transmit 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_TRANSMIT_SYNCTXEN |
Synchronization Period Status Transmit Enable bit |
SENT_TRANSMIT_NIBBLE1 |
Module is transmitting Data Nibble 1 |
SENT_TRANSMIT_NIBBLE2 |
Module is transmitting Data Nibble 2 |
SENT_TRANSMIT_NIBBLE3 |
Module is transmitting Data Nibble 3 |
SENT_TRANSMIT_NIBBLE4 |
Module is transmitting Data Nibble 4 |
SENT_TRANSMIT_NIBBLE5 |
Module is transmitting Data Nibble 5 |
SENT_TRANSMIT_NIBBLE6 |
Module is transmitting Data Nibble 6 |
SENT_TRANSMIT_CRC |
Module is transmitting Data CRC |
SENT_TRANSMIT_PAUSEPERIOD |
Indicates whether the module is transmitting a Pause period |
2.24.2.1.4 Variable Documentation
2.24.2.1.4.1 SENT1_TX
const struct SENT_TRANSMIT_INTERFACE SENT1_TX
Structure object of type SENT_TRANSMIT_INTERFACE with the custom name given by the user in the Melody Driver User interface.
The default name 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.24.3 Class Documentation
2.24.3.1 SENT_DATA_TRANSMIT Struct Reference
This data structure used to configure the SENT data packet.
2.24.3.1.1 Detailed Description
This data structure used to configure the SENT data packet.
#include <sent_tx_types.h>
2.24.3.1.1.1 Public Attributes
2.24.3.1.2 Member Data Documentation
2.24.3.1.2.1 crc
unsigned crc
Defines the CRC field
2.24.3.1.2.2 data1
unsigned data1
Defines the first data nibble field
2.24.3.1.2.3 data2
unsigned data2
Defines the second data nibble field
2.24.3.1.2.4 data3
unsigned data3
Defines the third data nibble field
2.24.3.1.2.5 data4
unsigned data4
Defines the fourth data nibble field
2.24.3.1.2.6 data5
unsigned data5
Defines the fifth data nibble field
2.24.3.1.2.7 data6
unsigned data6
Defines the sixth data nibble field
2.24.3.1.2.8 status
unsigned status
Defines the status field
2.24.3.2 SENT_TRANSMIT_INTERFACE Struct Reference
Structure containing the function pointers of SENT driver in transmit mode.
2.24.3.2.1 Detailed Description
Structure containing the function pointers of SENT driver in transmit mode.
#include <sent_tx_interface.h>
2.24.3.2.1.1 Public Attributes
void(* Initialize )(void)
Pointer to SENTx_Initialize e.g. SENT1_Initialize.
void(* Deinitialize )(void)
Pointer to SENTx_Deinitialize e.g. SENT1_Deinitialize.
void(* Enable )(void)
Pointer to SENTx_Enable e.g. SENT1_Enable.
void(* Disable )(void)
Pointer to SENTx_Disable e.g. SENT1_Disable.
void(* TransmitModeSet )(enum SENT_TRANSMIT_MODE mode)
Pointer to SENTx_TransmitModeSet e.g. SENT1_TransmitModeSet.
void(* Transmit )(const struct SENT_DATA_TRANSMIT *sentData)
Pointer to SENTx_Transmit e.g. SENT1_Transmit.
bool(* IsTransmissionComplete )(void)
Pointer to SENTx_IsTransmissionComplete e.g. SENT1_IsTransmissionComplete.
enum SENT_TRANSMIT_STATUS(* TransmitStatusGet )(void)
Pointer to SENTx_TransmitStatusGet e.g. SENT1_TransmitStatusGet.
void(* TransmitCompleteCallbackRegister )(void *handler)
Pointer to SENTx_TransmitCompleteCallbackRegister e.g. SENT1_TransmitCompleteCallbackRegister.
void(* ErrorCallbackRegister )(void *handler)
Pointer to SENTx_ErrorCallbackRegister e.g. SENT1_ErrorCallbackRegister.
void(* Tasks )(void)
Pointer to SENTx_Tasks e.g. SENT1_Tasks (Supported only in polling mode)
2.24.3.2.2 Member Data Documentation
2.24.3.2.2.1 Deinitialize
void(* Deinitialize) (void)
Pointer to SENTx_Deinitialize e.g. SENT1_Deinitialize.
2.24.3.2.2.2 Disable
void(* Disable) (void)
Pointer to SENTx_Disable e.g. SENT1_Disable.
2.24.3.2.2.3 Enable
void(* Enable) (void)
Pointer to SENTx_Enable e.g. SENT1_Enable.
2.24.3.2.2.4 ErrorCallbackRegister
void(* ErrorCallbackRegister) (void *handler)
Pointer to SENTx_ErrorCallbackRegister e.g. SENT1_ErrorCallbackRegister.
2.24.3.2.2.5 Initialize
void(* Initialize) (void)
Pointer to SENTx_Initialize e.g. SENT1_Initialize.
2.24.3.2.2.6 IsTransmissionComplete
bool(* IsTransmissionComplete) (void)
Pointer to SENTx_IsTransmissionComplete e.g. SENT1_IsTransmissionComplete.
2.24.3.2.2.7 Tasks
void(* Tasks) (void)
Pointer to SENTx_Tasks e.g. SENT1_Tasks (Supported only in polling mode)
2.24.3.2.2.8 Transmit
void(* Transmit) (const struct SENT_DATA_TRANSMIT *sentData)
Pointer to SENTx_Transmit e.g. SENT1_Transmit.
2.24.3.2.2.9 TransmitCompleteCallbackRegister
void(* TransmitCompleteCallbackRegister) (void *handler)
Pointer to SENTx_TransmitCompleteCallbackRegister e.g. SENT1_TransmitCompleteCallbackRegister.
2.24.3.2.2.10 TransmitModeSet
void(* TransmitModeSet) (enum SENT_TRANSMIT_MODE mode)
Pointer to SENTx_TransmitModeSet e.g. SENT1_TransmitModeSet.
2.24.3.2.2.11 TransmitStatusGet
enum SENT_TRANSMIT_STATUS(* TransmitStatusGet) (void)
Pointer to SENTx_TransmitStatusGet e.g. SENT1_TransmitStatusGet.
2.24.4 File Documentation
2.24.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_tx_types.h" #include "sent_tx_interface.h"
2.24.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.
void SENT1_TransmitModeSet (enum SENT_TRANSMIT_MODE mode)
Sets the SENT transmit mode.
void SENT1_Transmit (const struct SENT_DATA_TRANSMIT *sentData)
Writes the SENT data to receiver.
bool SENT1_IsTransmissionComplete (void)
Returns the transmit complete status.
enum SENT_TRANSMIT_STATUS SENT1_TransmitStatusGet (void)
Gets the transmission status of the SENT module.
void SENT1_TransmitCompleteCallbackRegister (void *handler)
This function can be used to override default callback and to define custom callback for SENT1 TransmitComplete event.
void SENT1_TransmitCompleteCallback (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_TransmitCompleteCallbackRegister.
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.
2.24.4.1.2 Variables
const struct SENT_TRANSMIT_INTERFACE SENT1_TX
Structure object of type SENT_TRANSMIT_INTERFACE with the custom name given by the user in the Melody Driver User interface.
2.24.4.1.3 Detailed Description
This is the generated driver header file for the SENT1 driver.
SENT1 Generated Driver Header File
2.24.4.2 source/sent_tx_interface.h File Reference
#include <stdbool.h> #include <stdint.h> #include "sent_tx_types.h"
2.24.4.2.1 Data structures
struct SENT_TRANSMIT_INTERFACE
Structure containing the function pointers of SENT driver in transmit mode.
2.24.4.3 source/sent_tx_types.h File Reference
This is the generated driver types header file for the SENT driver.
2.24.4.3.1 Data structures
struct SENT_DATA_TRANSMIT
This data structure used to configure the SENT data packet.
2.24.4.3.2 Enumerations
enum SENT_TRANSMIT_MODE { SENT_TRANSMIT_ASYNCHRONOUS, SENT_TRANSMIT_SYNCHRONOUS }
Defines the SENT transmission mode (Asynchronous and Synchronous)
enum SENT_TRANSMIT_STATUS { SENT_TRANSMIT_SYNCTXEN = (1U << 0U), SENT_TRANSMIT_NIBBLE1 = (1U << 4U), SENT_TRANSMIT_NIBBLE2 = (1U << 5U), SENT_TRANSMIT_NIBBLE3 = (3U << 4U), SENT_TRANSMIT_NIBBLE4 = (1U << 6U), SENT_TRANSMIT_NIBBLE5 = (5U << 4U), SENT_TRANSMIT_NIBBLE6 = (6U << 4U), SENT_TRANSMIT_CRC = (7U << 4U), SENT_TRANSMIT_PAUSEPERIOD = (1U << 7U) }
Defines the SENT transmit 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.
2.24.4.3.3 Detailed Description
This is the generated driver types header file for the SENT driver.
SENT Generated Driver Types Header File