Re: J1939 Questions on Intended usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 14 May 2021 12:04:47 +0000, Patrick Menschel wrote:
> Hi Kurt,
> 
> J1939 just hit the raspberrypi-kernel-headers and will soon be part of
> regular raspberrypi-kernel [1] while it was already
> available in Python 3.9 for a couple of month. [2]
> 
> I was about to give it a spin but was confused of the call parameters.
> 
> Could you shed some light on the intended usage.
> 
> Do I need to open one socket per PGN I'm sending?
> e.g.
> 
> s1 = socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_J1939)
> s1.bind(interface_name, MY_NAME, PGN_OF_TSC1, MY_SA)
> s1.write(bytes(8))
> 
> s2 = socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_J1939)
> s2.bind(interface_name, MY_NAME, PGN_OF_EBC1, MY_SA)
> s2.write(bytes(8))

No, you don't _need_ to. You can.

If you need quite some different PGN's, it may be more interesting to:
s = socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_J1939)
s.bind(interface_name, MY_NAME, ANY_PGN, MY_SA)
s.sendto(bytes(8), DST_1, PGN_1)
s.sendto(bytes(8), DST_2, PGN_2)
...

I'm not a python expert, I just assume something like that is possible.

> 
> 
> What about the cyclic transmitted PGNs? Do I drop those into
> BroadcastManager somehow?

The broadcast manager is seperate from j1939, so it's apart.
> 
> 
> If I want to open an ISOTP Channel while a j1939 socket exists for my
> SA, does anything weird happen on that socket?

No, nothing weird will happen.

The only possible disadvantage I can think of is that the messages sent
using ISOTP do not honor the NAME-SA mapping, so on a bus with dynamic
addressing, you should be carefull to use local/remote addresses.

Kind regards,
Kurt



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux