Skip to content

CAN-J1939 documentation #164

Open
Open
@josemic

Description

I am currently enhacing the open source socketCAN test port for the eclipse titan ttcn compiler with j1939 support. (TTCN is a protocol testing language used in the telecummunication industry and is very well suited for testing j1939 and isobus.). elinux.org/TTCN
Here I read the documentation and still have questions. These questions I collect in this issue in order to fix the j1939 documentation (can-j1939-kickstart.md and can-j1939.md kernel Documentation/networking/j1939.rst).

int j1939_promisc = 1; // value range 0=deactivate??, 1= activate
res = setsockopt(sock, SOL_CAN_J1939, SO_J1939_PROMISC, &j1939_promisc, sizeof(j1939_promisc));
if (res < 0)
            error(1, errno, "setsockopt j1939_promisc %u", j1939_promisc);	

Question:
Can promicous mode be deactivated with j1939_promisc = 0

int j1939_prio = 1; // value range: 0..7
res = setsockopt(sock, SOL_CAN_J1939, SO_J1939_SEND_PRIO, &j1939_prio, sizeof(j1939_prio));
if (res < 0)
            error(1, errno, "setsockopt j1939_send_prio %u", j1939_prio);	

Question:
Here I can set the priority for the socket. What is the default value?

int pkt_len // value range: ????
res = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, pkt_len, sizeof(pkt_len));
if (res < 0)
            error(1, errno, "setsockopt rcvbuf %u", pkt_len);

Question:
What is the purpose of setting the receive buffer?
Isobus as far as I know supports extended transport protocol with (2²⁴-1)*7= 117440505 Bytes
How do I send and receive such long packages?

int val = 1; // value range: 1
res = setsockopt(sock, SOL_SOCKET, SO_TIMESTAMP, &val, sizeof(val));
if (res < 0)
            error(1, errno, "setsockopt timestamp");

Question:

  • What is the result of setting the timestamp?
  • How is the timestamp read?
const char *device;
res = setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device));
if (res < 0)
		err(1, "bindtodevice %s", device);

Question:

  • What is a device? Is this "vcan0"?
  • What is the purpose of SO_BINDTODEVICE?
  • What is the difference between bind & setsockopt(..,SO_BINDTODEVICE,..)?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions