Author Topic: custom J1939 RX no source  (Read 1190 times)

Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 194
  • Karma: +4/-0
custom J1939 RX no source
« on: January 06, 2021, 05:38:59 PM »
Hey guys,

Does anyone have try to receive a J1939 PGN with a standard CAN RX component but setting a no source?

for Instance, lets say you have can id RX 0X18FEFF31 where the 31 is the source, how can I set don´t care about source?



the danfoss blocks comes with that feature but they do not have all the blocks you may need, I wonder what is the trick for that

Thanks

Offline spittet

  • PLUS+1 Guru
  • *****
  • Posts: 113
  • Karma: +5/-1
Re: custom J1939 RX no source
« Reply #1 on: January 06, 2021, 06:36:09 PM »
If you are using the blocks form the "J1939 FB Library", simply set the "Use Source" at False and set the "Source" at "0".

If you are using a standard CAN receiver block, then I would use the "Receive CAN with ID mask" block. I would set the mask as "0xFFFFFF00" and I would set the ID as "0x18FEFF31".

Sam

Offline FluidPowerTom

  • PLUS+1 Guru
  • *****
  • Posts: 265
  • Karma: +20/-0
Re: custom J1939 RX no source
« Reply #2 on: January 06, 2021, 07:58:54 PM »
Exactly as mentioned above.  If you want to understand more about what's going on there I'd recommend reading up on 'logical masking' assuming you already are comfortable with binary.
Mechanical Engineer
Hydra-Power Systems - Distributor - Pacific Northwest

Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 194
  • Karma: +4/-0
Re: custom J1939 RX no source
« Reply #3 on: January 06, 2021, 08:05:25 PM »
Thanks for the hint guys,

I will do the reading for " logical masking" and I will do a try as Spittet describes with the Receive CAN ID with ID mask

Thanks again.

Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 194
  • Karma: +4/-0
Re: custom J1939 RX no source
« Reply #4 on: January 06, 2021, 11:43:48 PM »
alright one more question.

if the same PGN is broadcasted by the ECM and the VCU, but the one from the ECM has no data or it is FF and the one from the VCU is the one with the data what is going to happen?

I will be getting both messages, correct? so basically I will need some kind of logic to keep the valid data and ignore the invalid data, am I correct?


Offline FluidPowerTom

  • PLUS+1 Guru
  • *****
  • Posts: 265
  • Karma: +20/-0
Re: custom J1939 RX no source
« Reply #5 on: January 07, 2021, 06:25:13 PM »
I'm not what the VCU is, but if the ECM and VCU message have the same PGN and are coming from the same vehicle I'd expect that they'll have a different source address. 

If you're somehow receiving messages with the exact same CAN ID then your controller will read either one of them more or less randomly.  Sure you could try to ignore it when you receive the one without data and hope that on the next scan you receive the correct one, but it'd be a total crap shoot.  I don't think this is what you're referring to though.  Surely they have different source addresses.
Mechanical Engineer
Hydra-Power Systems - Distributor - Pacific Northwest

Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 194
  • Karma: +4/-0
Re: custom J1939 RX no source
« Reply #6 on: January 07, 2021, 08:22:38 PM »
Hey FluidpowerTom,

that is correct the ECM and the VCU- Vehicle Contro Unit, renault trucks call it like that- are in the same truck, so yes the difference between the same PGN been broadcasted is the source.

so, if the receive CANblock with ID Mask is going to ignore the source, it will getting both messages, one with valid data and one with wrong data.

that is why I was thinking that I will need some source of logic to capture only the correct data and ignore the wrong data

I guess for now I have to try and see


Offline niteRider

  • PLUS+1 Developer
  • ***
  • Posts: 39
  • Karma: +3/-0
Re: custom J1939 RX no source
« Reply #7 on: January 07, 2021, 09:31:05 PM »
just curious... why are you wanting to ignore the Source in the first place?  Seems like looking at the Source is exactly what you need to solve the problem you have with VCU vs ECM sending the same PGN but with one having the bogus data...

Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 194
  • Karma: +4/-0
Re: custom J1939 RX no source
« Reply #8 on: January 08, 2021, 01:04:46 AM »
Nite rider,

the problem is that if source is used, then we have to customize the software for each chassy manufacturer.

For instance Kenworth chassy uses source 31, International uses source 21, and hopefully it will not change based on tranmission and engine manufacturer.

I am agree with you if I know the source then no worries but if the source is not matching it will not work

latest test, it was doing that, reading the correct data and the wrong data so it was switching. I have added a selection logic but not tried yet

I tried to use the Danfoss block PGN65264 but it did not work using source or not, that is why I had to go with a regualr CAN Rx function and I was lost on how to ignore the source.

 ;D


Offline acmall

  • PLUS+1 Guru
  • *****
  • Posts: 115
  • Karma: +22/-1
Re: custom J1939 RX no source
« Reply #9 on: January 08, 2021, 09:16:39 AM »

As FluidPowerTom has said if you ignore the source and receive the messages from both the ECM & VCU there is no guarantee that you will receive the message with the data consistently. What you end up with will depend on transmission rates from both units and the program loop time.

You could store the source in NV memory then you would not need to customise the software for each chassis, just set the correct value for the source from the service tool, a display screen or some other logic.









Offline niteRider

  • PLUS+1 Developer
  • ***
  • Posts: 39
  • Karma: +3/-0
Re: custom J1939 RX no source
« Reply #10 on: January 08, 2021, 02:52:40 PM »

For instance Kenworth chassy uses source 31, International uses source 21, and hopefully it will not change based on tranmission and engine manufacturer.


Ah... gotcha.  Was assuming the same source addresses (as it usually the case) on your ECM/VCUs every time.

Tricky one indeed!

Offline pinias

  • PLUS+1 Guru
  • *****
  • Posts: 194
  • Karma: +4/-0
Re: custom J1939 RX no source
« Reply #11 on: January 08, 2021, 10:58:09 PM »
Check this out

it is all what is needed and the correct data is what is shown on the screen always. wrong data is ignored.

thank you all