J1939 Documentation
Version 4.16.00
Loading...
Searching...
No Matches
j1939_mgr.h File Reference

Detailed Description

This module holds all functions for the initialisation and control of the J1939 stack. Some functions of this module need to be adopted to the application:

These functions are located in the j1939_user.c file.

+ Include dependency graph for j1939_mgr.h:

Macros

#define J1939_CONF_BITRATE_250K   (uint16_t)(0x0000)
 
#define J1939_CONF_BITRATE_500K   (uint16_t)(0x0001)
 
#define J1939_CONF_FD   (uint16_t)(0x0100)
 
#define J1939_CONF_NMEA   (uint16_t)(0x0200)
 

Functions

void J1939_MgrEventRcvTimeout (uint8_t ubNetV, uint32_t ulPgnV)
 
uint8_t J1939_MgrGetAddress (uint8_t ubNetV)
 
uint8_t J1939_MgrGetDestination (uint8_t ubNetV)
 
J1939_Status_tv J1939_MgrInit (uint8_t ubCanIfV, uint8_t ubNetV, uint8_t ubAddressV, uint16_t uwConfigV)
 
void J1939_MgrOnBusOff (uint8_t ubNetV)
 
J1939_Status_tv J1939_MgrProcess (void)
 
J1939_Status_tv J1939_MgrRelease (uint8_t ubNetV)
 
void J1939_MgrSetAddress (uint8_t ubNetV, uint8_t ubAddressV)
 
J1939_Status_tv J1939_MgrStart (uint8_t ubNetV)
 

Function Documentation

◆ J1939_MgrEventRcvTimeout()

void J1939_MgrEventRcvTimeout ( uint8_t ubNetV,
uint32_t ulPgnV )
Parameters
[in]ubNetVJ1939 Network channel
[in]ulPgnVParameter Group Number
Note
Adopt this function to the application, a sample implementation is located in the file j1939_user.c.

This function is called by the stack if a timeout of a receive PDU occurs. The parameter uwPgnV defines the Parameter Group Number of the PDU where the timeout occurred.

◆ J1939_MgrGetAddress()

uint8_t J1939_MgrGetAddress ( uint8_t ubNetV)
Parameters
[in]ubNetVJ1939 Network channel
Returns
Current ECU address
See also
J1939_MgrSetAddress

The function returns the actual ECU address.

◆ J1939_MgrGetDestination()

uint8_t J1939_MgrGetDestination ( uint8_t ubNetV)
Parameters
[in]ubNetVJ1939 Network channel
Returns
Destination address of PDU1 request

The function returns the destination address of the current PDU1 request.

◆ J1939_MgrInit()

J1939_Status_tv J1939_MgrInit ( uint8_t ubCanIfV,
uint8_t ubNetV,
uint8_t ubAddressV,
uint16_t uwConfigV )
Parameters
[in]ubNetVJ1939 Network channel
[in]ubCanIfVPhysical CAN interface
[in]ubAddressVInitial CA address
[in]uwConfigVJ1939 configuration
Returns
eJ1939_ERR_NONE on success, negative J1939_Err_e value on failure

The function is responsible for initialisation of the J1939 stack. The parameter ubAddressV denotes the initial CA address. The address can be in the range from 0 to 253. The parameter uwConfigV allows configuration of the stack during run-time. The bit-rate can be selected by either J1939_CONF_BITRATE_250K (default) or J1939_CONF_BITRATE_500K.

◆ J1939_MgrOnBusOff()

void J1939_MgrOnBusOff ( uint8_t ubNetV)
Parameters
[in]ubNetVJ1939 Network channel
Note
Adopt this function to the application, a sample implementation is located in the file j1939_user.c.

This function is called by the stack on a bus-off condition.

◆ J1939_MgrProcess()

J1939_Status_tv J1939_MgrProcess ( void )
Returns
eJ1939_ERR_NONE on success, J1939_Err_e value on failure

Handle J1939 messages if they are not served within the CAN interrupt. Please note that this function serves all logical J1939 networks.

◆ J1939_MgrRelease()

J1939_Status_tv J1939_MgrRelease ( uint8_t ubNetV)
Parameters
[in]ubNetVJ1939 Network channel
Returns
eJ1939_ERR_NONE on success, J1939_Err_e value on failure

This function stops the J1939 protocol stack. Messages on the CAN bus are not further processed.

◆ J1939_MgrSetAddress()

void J1939_MgrSetAddress ( uint8_t ubNetV,
uint8_t ubAddressV )
Parameters
[in]ubNetVJ1939 Network channel
[in]ubAddressVNew ECU address
See also
J1939_MgrGetAddress

The function sets the ECU address. The parameter ubAddressV must be in the range from 0 to 253.

◆ J1939_MgrStart()

J1939_Status_tv J1939_MgrStart ( uint8_t ubNetV)
Parameters
[in]ubNetVJ1939 Network channel
Returns
eJ1939_ERR_NONE on success, J1939_Err_e value on failure

This routine starts the J1939 protocol stack, i.e. the Address Claim message is sent.