3.20 SENT TX 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
-
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 .
3.20.1 Module Documentation
3.20.1.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.
3.20.1.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.
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.
Definitions
#define SENT1_TX_Initialize SENT1_Initialize
This macro defines the Custom Name for SENT1_Initialize API.
#define SENT1_TX_Deinitialize SENT1_Deinitialize
This macro defines the Custom Name for SENT1_Deinitialize API.
#define SENT1_TX_Enable SENT1_Enable
This macro defines the Custom Name for SENT1_Enable API.
#define SENT1_TX_Disable SENT1_Disable
This macro defines the Custom Name for SENT1_Disable API.
#define SENT1_TX_TransmitModeSet SENT1_TransmitModeSet
This macro defines the Custom Name for SENT1_TransmitModeSet API.
#define SENT1_TX_Transmit SENT1_Transmit
This macro defines the Custom Name for SENT1_Transmit API.
#define SENT1_TX_IsTransmissionComplete SENT1_IsTransmissionComplete
This macro defines the Custom Name for SENT1_IsTransmissionComplete API.
#define SENT1_TX_TransmitStatusGet SENT1_TransmitStatusGet
This macro defines the Custom Name for SENT1_TransmitStatusGet API.
#define SENT1_TX_TransmitCompleteCallbackRegister SENT1_TransmitCompleteCallbackRegister
This macro defines the Custom Name for SENT1_TransmitCompleteCallbackRegister API.
#define SENT1_TX_ErrorCallbackRegister SENT1_ErrorCallbackRegister
This macro defines the Custom Name for SENT1_ErrorCallbackRegister API.
#define SENT1_TX_Tasks SENT1_Tasks
This macro defines the Custom Name for SENT1_Tasks API.
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 = 0x1, SENT_TRANSMIT_NIBBLE1 = 0x10, SENT_TRANSMIT_NIBBLE2 = 0x20, SENT_TRANSMIT_NIBBLE3 = 0x30, SENT_TRANSMIT_NIBBLE4 = 0x40, SENT_TRANSMIT_NIBBLE5 = 0x50, SENT_TRANSMIT_NIBBLE6 = 0x60, SENT_TRANSMIT_CRC = 0x70, SENT_TRANSMIT_PAUSEPERIOD = 0x80 }
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.
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)(void))
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)(void))
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_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.
3.20.1.1.2 Definition Documentation
SENT1_TX_Deinitialize
#define SENT1_TX_Deinitialize SENT1_Deinitialize
This macro defines the Custom Name for SENT1_Deinitialize API.
SENT1_TX_Disable
#define SENT1_TX_Disable SENT1_Disable
This macro defines the Custom Name for SENT1_Disable API.
SENT1_TX_Enable
#define SENT1_TX_Enable SENT1_Enable
This macro defines the Custom Name for SENT1_Enable API.
SENT1_TX_ErrorCallbackRegister
#define SENT1_TX_ErrorCallbackRegister SENT1_ErrorCallbackRegister
This macro defines the Custom Name for SENT1_ErrorCallbackRegister API.
SENT1_TX_Initialize
#define SENT1_TX_Initialize SENT1_Initialize
This macro defines the Custom Name for SENT1_Initialize API.
SENT1_TX_IsTransmissionComplete
#define SENT1_TX_IsTransmissionComplete SENT1_IsTransmissionComplete
This macro defines the Custom Name for SENT1_IsTransmissionComplete API.
SENT1_TX_Tasks
#define SENT1_TX_Tasks SENT1_Tasks
This macro defines the Custom Name for SENT1_Tasks API.
SENT1_TX_Transmit
#define SENT1_TX_Transmit SENT1_Transmit
This macro defines the Custom Name for SENT1_Transmit API.
SENT1_TX_TransmitCompleteCallbackRegister
#define SENT1_TX_TransmitCompleteCallbackRegister SENT1_TransmitCompleteCallbackRegister
This macro defines the Custom Name for SENT1_TransmitCompleteCallbackRegister API.
SENT1_TX_TransmitModeSet
#define SENT1_TX_TransmitModeSet SENT1_TransmitModeSet
This macro defines the Custom Name for SENT1_TransmitModeSet API.
SENT1_TX_TransmitStatusGet
#define SENT1_TX_TransmitStatusGet SENT1_TransmitStatusGet
This macro defines the Custom Name for SENT1_TransmitStatusGet API.
3.20.1.1.3 Function Documentation
SENT1_Deinitialize()
void SENT1_Deinitialize (void )
Deinitializes the SENT1 to POR values.
none |
none |
SENT1_Disable()
void SENT1_Disable (void )
Disables the SENT1 module.
none |
none |
SENT1_Enable()
void SENT1_Enable (void )
Enables the SENT1 module.
none |
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.
none |
none |
SENT1_ErrorCallbackRegister()
void SENT1_ErrorCallbackRegister (void(*)(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 |
SENT1_Initialize()
void SENT1_Initialize (void )
Initializes the SENT module.
none |
none |
SENT1_IsTransmissionComplete()
bool SENT1_IsTransmissionComplete (void )
Returns the transmit complete status.
none |
true - SENT transmit completed false - SENT transmit not completed |
SENT1_Tasks()
void SENT1_Tasks (void )
This function is used to implement the tasks for polled implementations.
none |
none |
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 |
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 |
SENT1_TransmitCompleteCallbackRegister()
void SENT1_TransmitCompleteCallbackRegister (void(*)(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 |
SENT1_TransmitModeSet()
void SENT1_TransmitModeSet (enum SENT_TRANSMIT_MODE mode)
Sets the SENT transmit mode.
in | mode |
- SENT Synchronous or Asynchronous |
none |
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 |
3.20.1.1.4 Enumeration Type Documentation
SENT_TRANSMIT_MODE
enum SENT_TRANSMIT_MODE
Defines the SENT transmission mode (Asynchronous and Synchronous)
SENT_TRANSMIT_ASYNCHRONOUS | |
SENT_TRANSMIT_SYNCHRONOUS |
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 |
3.20.1.1.5 Variable Documentation
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.
3.20.2 Data Structure Documentation
3.20.2.1 SENT_DATA_TRANSMIT Struct Reference
This data structure used to configure the SENT data packet.
3.20.2.1.1 Detailed Description
This data structure used to configure the SENT data packet.
#include <sent_tx_types.h>
Data Fields
3.20.2.1.2 Field Documentation
crc
uint8_t crc
Defines the CRC field
data1
uint8_t data1
Defines the first data nibble field
data2
uint8_t data2
Defines the second data nibble field
data3
uint8_t data3
Defines the third data nibble field
data4
uint8_t data4
Defines the fourth data nibble field
data5
uint8_t data5
Defines the fifth data nibble field
data6
uint8_t data6
Defines the sixth data nibble field
status
uint8_t status
Defines the status field
3.20.2.2 SENT_TRANSMIT_INTERFACE Struct Reference
Structure containing the function pointers of SENT driver in transmit mode.
3.20.2.2.1 Detailed Description
Structure containing the function pointers of SENT driver in transmit mode.
#include <sent_tx_interface.h>
Data Fields
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)(void))
Pointer to SENTx_TransmitCompleteCallbackRegister e.g. SENT1_TransmitCompleteCallbackRegister.
void(* ErrorCallbackRegister )(void(*handler)(void))
Pointer to SENTx_ErrorCallbackRegister e.g. SENT1_ErrorCallbackRegister.
void(* Tasks )(void)
Pointer to SENTx_Tasks e.g. SENT1_Tasks (Supported only in polling mode)
3.20.2.2.2 Field Documentation
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)(void))
Pointer to SENTx_ErrorCallbackRegister e.g. SENT1_ErrorCallbackRegister.
Initialize
void(* Initialize) (void)
Pointer to SENTx_Initialize e.g. SENT1_Initialize.
IsTransmissionComplete
bool(* IsTransmissionComplete) (void)
Pointer to SENTx_IsTransmissionComplete e.g. SENT1_IsTransmissionComplete.
Tasks
void(* Tasks) (void)
Pointer to SENTx_Tasks e.g. SENT1_Tasks (Supported only in polling mode)
Transmit
void(* Transmit) (const struct SENT_DATA_TRANSMIT *sentData)
Pointer to SENTx_Transmit e.g. SENT1_Transmit.
TransmitCompleteCallbackRegister
void(* TransmitCompleteCallbackRegister) (void(*handler)(void))
Pointer to SENTx_TransmitCompleteCallbackRegister e.g. SENT1_TransmitCompleteCallbackRegister.
TransmitModeSet
void(* TransmitModeSet) (enum SENT_TRANSMIT_MODE mode)
Pointer to SENTx_TransmitModeSet e.g. SENT1_TransmitModeSet.
TransmitStatusGet
enum SENT_TRANSMIT_STATUS(* TransmitStatusGet) (void)
Pointer to SENTx_TransmitStatusGet e.g. SENT1_TransmitStatusGet.
3.20.3 File Documentation
3.20.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_tx_types.h" #include "sent_tx_interface.h"
3.20.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.
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)(void))
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)(void))
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.
3.20.3.1.2 Macros
#define SENT1_TX_Initialize SENT1_Initialize
This macro defines the Custom Name for SENT1_Initialize API.
#define SENT1_TX_Deinitialize SENT1_Deinitialize
This macro defines the Custom Name for SENT1_Deinitialize API.
#define SENT1_TX_Enable SENT1_Enable
This macro defines the Custom Name for SENT1_Enable API.
#define SENT1_TX_Disable SENT1_Disable
This macro defines the Custom Name for SENT1_Disable API.
#define SENT1_TX_TransmitModeSet SENT1_TransmitModeSet
This macro defines the Custom Name for SENT1_TransmitModeSet API.
#define SENT1_TX_Transmit SENT1_Transmit
This macro defines the Custom Name for SENT1_Transmit API.
#define SENT1_TX_IsTransmissionComplete SENT1_IsTransmissionComplete
This macro defines the Custom Name for SENT1_IsTransmissionComplete API.
#define SENT1_TX_TransmitStatusGet SENT1_TransmitStatusGet
This macro defines the Custom Name for SENT1_TransmitStatusGet API.
#define SENT1_TX_TransmitCompleteCallbackRegister SENT1_TransmitCompleteCallbackRegister
This macro defines the Custom Name for SENT1_TransmitCompleteCallbackRegister API.
#define SENT1_TX_ErrorCallbackRegister SENT1_ErrorCallbackRegister
This macro defines the Custom Name for SENT1_ErrorCallbackRegister API.
#define SENT1_TX_Tasks SENT1_Tasks
This macro defines the Custom Name for SENT1_Tasks API.
3.20.3.1.3 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. 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.
3.20.3.1.4 Detailed Description
This is the generated driver header file for the SENT1 driver.
SENT1 Generated Driver Header File
3.20.3.2 source/sent_tx_interface.h File Reference
#include <stdbool.h> #include <stdint.h> #include "sent_tx_types.h"
3.20.3.2.1 Data structures
struct SENT_TRANSMIT_INTERFACE
Structure containing the function pointers of SENT driver in transmit mode.
3.20.3.3 source/sent_tx_types.h File Reference
This is the generated driver types header file for the SENT driver.
3.20.3.3.1 Data structures
struct SENT_DATA_TRANSMIT
This data structure used to configure the SENT data packet.
3.20.3.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 = 0x1, SENT_TRANSMIT_NIBBLE1 = 0x10, SENT_TRANSMIT_NIBBLE2 = 0x20, SENT_TRANSMIT_NIBBLE3 = 0x30, SENT_TRANSMIT_NIBBLE4 = 0x40, SENT_TRANSMIT_NIBBLE5 = 0x50, SENT_TRANSMIT_NIBBLE6 = 0x60, SENT_TRANSMIT_CRC = 0x70, SENT_TRANSMIT_PAUSEPERIOD = 0x80 }
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.
3.20.3.3.3 Detailed Description
This is the generated driver types header file for the SENT driver.
SENT Generated Driver Types Header File