Set the CAN frame data length used to transmit on a link.
Set the CAN frame data length used to transmit on a link.A Classical CAN link uses 8. CAN FD links may use 12, 16, 20, 24, 32, 48, or 64, subject to the compiled ISO_TP_MAX_CAN_FRAME_SIZE.
- Parameters
-
| [in,out] | link | Initialised link, or NULL. |
| [in] | tx_dl | Desired transmit data length. |
- Return values
-
| ISOTP_RET_OK | The value was applied. |
| ISOTP_RET_ERROR | The link is NULL, the value is not a legal CAN data length, or it exceeds ISO_TP_MAX_CAN_FRAME_SIZE. |
| ISOTP_RET_INPROGRESS | A segmented transmission is active; its TX_DL cannot be changed. |
- Note
- RX_DL is learned independently from each incoming First Frame.
#include "example_platform.h"
#define EXAMPLE_TX_ID 0x7E0u
static uint8_t send_buffer[4095];
static uint8_t receive_buffer[4095];
int isotp_user_send_can(
const uint32_t arbitration_id,
const uint8_t* data,
const uint8_t size,
const uint8_t flags,
void* arg) {
ExampleCan* can = (ExampleCan*)arg;
return example_can_send(can, arbitration_id, data, size, fd, brs);
}
void example_can_fd_init(ExampleCan* can) {
isotp_init_link(&link, EXAMPLE_TX_ID, send_buffer,
sizeof(send_buffer), receive_buffer,
sizeof(receive_buffer));
}
int example_can_fd_use_classical_frames(
void) {
return isotp_set_tx_dl(&link,
ISOTP_CAN_DL_CLASSIC); }
void isotp_init_link(IsoTpLink *link, uint32_t sendid, uint8_t *sendbuf, uint32_t sendbufsize, uint8_t *recvbuf, uint32_t recvbufsize)
Initialise an ISO-TP link and its caller-owned buffers.
#define ISOTP_CAN_FRAME_FLAG_BRS
#define ISOTP_CAN_FRAME_FLAG_FD
#define ISOTP_CAN_DL_CLASSIC
Public ISO-TP link and transport API.
State for one independent, full-duplex ISO-TP conversation.