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
struct SENT_RECEIVE_INTERFACE
Structure containing the function pointers of SENT driver in receive mode.
struct SENT_DATA_RECEIVE
This data structure used to configure the SENT data packet.
Definitions
#define SENT1_RX_Initialize SENT1_Initialize
This macro defines the Custom Name for SENT1_Initialize API.
#define SENT1_RX_Deinitialize SENT1_Deinitialize
This macro defines the Custom Name for SENT1_Deinitialize API.
#define SENT1_RX_Enable SENT1_Enable
This macro defines the Custom Name for SENT1_Enable API.
#define SENT1_RX_Disable SENT1_Disable
This macro defines the Custom Name for SENT1_Disable API.
#define SENT1_RX_Receive SENT1_Receive
This macro defines the Custom Name for SENT1_Receive API.
#define SENT1_RX_IsDataReceived SENT1_IsDataReceived
This macro defines the Custom Name for SENT1_IsDataReceived API.
#define SENT1_RX_ReceiveStatusGet SENT1_ReceiveStatusGet
This macro defines the Custom Name for SENT1_ReceiveStatusGet API.
#define SENT1_RX_ReceiveCompleteCallbackRegister SENT1_ReceiveCompleteCallbackRegister
This macro defines the Custom Name for SENT1_ReceiveCompleteCallbackRegister API.
#define SENT1_RX_ErrorCallbackRegister SENT1_ErrorCallbackRegister
This macro defines the Custom Name for SENT1_ErrorCallbackRegister API.
#define SENT1_RX_Tasks SENT1_Tasks
This macro defines the Custom Name for SENT1_Tasks API.
Enumerations
enum SENT_RECEIVE_STATUS { SENT_RECEIVE_SYNCTXEN = (1U << 0U), SENT_RECEIVE_RXIDLE = (1U << 1U), SENT_RECEIVE_FRAMEERR = (1U << 2U), SENT_RECEIVE_CRCERR = (1U << 3U), SENT_RECEIVE_NIBBLE1 = (1U << 4U), SENT_RECEIVE_NIBBLE2 = (1U << 5U), SENT_RECEIVE_NIBBLE3 = (3U << 4U), SENT_RECEIVE_NIBBLE4 = (1U << 6U), SENT_RECEIVE_NIBBLE5 = (5U << 4U), SENT_RECEIVE_NIBBLE6 = (6U << 4U), SENT_RECEIVE_CRC = (7U << 4U), SENT_RECEIVE_PAUSEPERIOD = (1U << 7U) }
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.
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.
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 * 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_IsDataReceived()
bool SENT1_IsDataReceived (void )
Returns the receive complete status.
none |
true - SENT receive completed false - SENT receive not completed |
SENT1_Receive()
struct SENT_DATA_RECEIVE SENT1_Receive (void )
Reads the received data from transmitter.
none |
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.
none |
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.
in | handler |
- Address of the callback function |
none |
SENT1_ReceiveStatusGet()
enum SENT_RECEIVE_STATUS SENT1_ReceiveStatusGet (void )
Gets the reception status of the SENT module.
none |
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.
none |
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>
Public Attributes
2.23.2.1.2 Member Data Documentation
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
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.
struct SENT_DATA_RECEIVE(* Receive )(void)
Pointer to SENTx_Receive e.g. SENT1_Receive.
bool(* IsDataReceived )(void)
Pointer to SENTx_IsDataReceived e.g. SENT1_IsDataReceived.
enum SENT_RECEIVE_STATUS(* ReceiveStatusGet )(void)
Pointer to SENTx_ReceiveStatusGet e.g. SENT1_ReceiveStatusGet.
void(* ReceiveCompleteCallbackRegister )(void *handler)
Pointer to SENTx_ReceiveCompleteCallbackRegister e.g. SENT1_ReceiveCompleteCallbackRegister.
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.23.2.2.2 Member Data 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)
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.
ReceiveCompleteCallbackRegister
void(* ReceiveCompleteCallbackRegister) (void *handler)
Pointer to SENTx_ReceiveCompleteCallbackRegister e.g. SENT1_ReceiveCompleteCallbackRegister.
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
#define SENT1_RX_Initialize SENT1_Initialize
This macro defines the Custom Name for SENT1_Initialize API.
#define SENT1_RX_Deinitialize SENT1_Deinitialize
This macro defines the Custom Name for SENT1_Deinitialize API.
#define SENT1_RX_Enable SENT1_Enable
This macro defines the Custom Name for SENT1_Enable API.
#define SENT1_RX_Disable SENT1_Disable
This macro defines the Custom Name for SENT1_Disable API.
#define SENT1_RX_Receive SENT1_Receive
This macro defines the Custom Name for SENT1_Receive API.
#define SENT1_RX_IsDataReceived SENT1_IsDataReceived
This macro defines the Custom Name for SENT1_IsDataReceived API.
#define SENT1_RX_ReceiveStatusGet SENT1_ReceiveStatusGet
This macro defines the Custom Name for SENT1_ReceiveStatusGet API.
#define SENT1_RX_ReceiveCompleteCallbackRegister SENT1_ReceiveCompleteCallbackRegister
This macro defines the Custom Name for SENT1_ReceiveCompleteCallbackRegister API.
#define SENT1_RX_ErrorCallbackRegister SENT1_ErrorCallbackRegister
This macro defines the Custom Name for SENT1_ErrorCallbackRegister API.
#define SENT1_RX_Tasks SENT1_Tasks
This macro defines the Custom Name for SENT1_Tasks API.
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
struct SENT_RECEIVE_INTERFACE
Structure containing the function pointers of SENT driver in receive mode.
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
enum SENT_RECEIVE_STATUS { SENT_RECEIVE_SYNCTXEN = (1U << 0U), SENT_RECEIVE_RXIDLE = (1U << 1U), SENT_RECEIVE_FRAMEERR = (1U << 2U), SENT_RECEIVE_CRCERR = (1U << 3U), SENT_RECEIVE_NIBBLE1 = (1U << 4U), SENT_RECEIVE_NIBBLE2 = (1U << 5U), SENT_RECEIVE_NIBBLE3 = (3U << 4U), SENT_RECEIVE_NIBBLE4 = (1U << 6U), SENT_RECEIVE_NIBBLE5 = (5U << 4U), SENT_RECEIVE_NIBBLE6 = (6U << 4U), SENT_RECEIVE_CRC = (7U << 4U), SENT_RECEIVE_PAUSEPERIOD = (1U << 7U) }
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.
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