Stuff Error on CAN-FD output channel

Universal Programmable Converter for CAN FD and CAN
Locked
rixccaptv
Posts: 11
Joined: Wed 14. Apr 2021, 03:23

Stuff Error on CAN-FD output channel

Post by rixccaptv » Mon 13. Dec 2021, 09:52

Hello

I am trying to make a gateway which takes in standard CAN (non-FD) on CAN1, manipulates selected signals and then transmits them as new messages on CAN-FD on CAN2.

I have previously successfully made some gateways like this but with standard CAN on both input and output (using standard PCAN-Routers).

However, while this time I followed the same process and had the same physical setup, but I'm getting errors on the output channel.

Working with CAN-FD (and PCAN-Router FD) is what is new for me, so maybe there is something obvious that I'm missing.

Through CANalyzer, I am sending simulated standard CAN input on CAN1 and just monitoring the gateway output on CAN2.
CAN1 is probably fine since it shows no errors in the Trace and LEDs are blinking, whose code depends on: CAN_UserRead (CAN_BUS1, &RxMsg) == CAN_ERR_OK
CAN2 shows a CAN FD stuff error (see attached pictures).

Here is what I tried so far for troubleshooting:
1) Checked that the baud rates and data rates are set as expected
- on the gateway code 'can_user.c', both channels are initialized with "_80M_500K_80____4M_80_ISO"
- in CANalyzer measurement setup, both channels are set to mode 'ISO CAN FD', baud rate '500.0 kBaud', data rate '4000.0 kBaud' (same as on code, right?)
2) checked all CAN terminations
- tried with 1x120ohm resistor on each channel (my usual setup for quick bench tests) --> 'CAN FD Error' msg with some data and a stuff error
- tried with 2x120ohm resistor on each channel (the 'proper' way) ---> same output error
- tried with no resistors --> 'CAN Error' message (no FD) with NO data and stuff error
- my thoughts: maybe the difference in errors is a clue but I'm not sure what to make of it. At least I know the terminations are making SOME difference... maybe the error is elsewhere
3) flashed the GW again but with the example code: 10_CAN_FD
- same or similar error as with my code
- my thoughts: it is maybe not my code which is causing the error, but something with the setup after all... back to doubting the setup from above point (1)

Any ideas are much appreciated.

- Ricardo
Attachments
physicalSetup.jpg
physicalSetup.jpg (29.87 KiB) Viewed 16297 times
measurementSetup.jpg
measurementSetup.jpg (54.38 KiB) Viewed 16297 times
stuffError2_withTermination.jpg
stuffError2_withTermination.jpg (109.99 KiB) Viewed 16297 times
stuffError1_noTermination.jpg
stuffError1_noTermination.jpg (62.56 KiB) Viewed 16297 times

rixccaptv
Posts: 11
Joined: Wed 14. Apr 2021, 03:23

Re: Stuff Error on CAN-FD output channel

Post by rixccaptv » Mon 13. Dec 2021, 10:05

PS. I took the screenshot of the CANalyzer measurment setup after disconnecting the equipment, which is why it says the channel hardware is non-existent.. Don't mind this

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Stuff Error on CAN-FD output channel

Post by M.Heidemann » Mon 13. Dec 2021, 11:22

Hello,

When using FD the bitrates on the bus have to match EXACTLY, otherwise BUS-Errors will occur.

So please check if the FD bitrates of the PCAN-Router FD and the VN1610 are identical (Same bitrate, same samplepoint, etc)

Please check again and also check for error frames on the bus when testing, this way you
can determine if its a phyiscal issue or an issue due to your firmware code.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

rixccaptv
Posts: 11
Joined: Wed 14. Apr 2021, 03:23

Re: Stuff Error on CAN-FD output channel

Post by rixccaptv » Mon 13. Dec 2021, 12:11

Hello

Thank you. So the problem is likely in these settings...
Is there a reference material to know exactly how the bitrate settings are defined/customized in the code?

I am seeing these options in can_user.h, but actually in the final version the gateway will need to support 500K arbitration and 2M data.
- I don't see _80M_500K_80____2M_80_ISOas one of the pre-defined options
- I found that on CANalyzer the sample points were not exactly 80% but 70% and 75%, so this probably needs to be changed to 80% to match the 80% from the code.
- I don't have the protocol knowledge to know how these are defined (how each brp, tseg1, tseg2, sjw etc translate to a setting of _X_Y_Z____X_Y_Z)
- I need to know the numbers to put here to make the data phase 2M
Attachments
canalyzerBitrates.PNG
canalyzerBitrates.PNG (21.6 KiB) Viewed 16287 times
bitrates.PNG
bitrates.PNG (55.73 KiB) Viewed 16287 times

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Stuff Error on CAN-FD output channel

Post by M.Heidemann » Mon 13. Dec 2021, 12:45

Hello,

You can use the PEAK-Bitrate Calculation Tool to get the values:

https://www.peak-system.com/Bit-Rate-Ca ... 496.0.html

Make sure to select "CAN FD bitrate", if you want to calculate specific sample point, enter it both into "from"
and "to".

This however makes sense if adapting bitrates from Canalyzer to PCAN-Router FD.

If you want to use the same settings on Canalyzer, select a fitting bitrate and the right
sample-point.

See if that resolves it.

Best regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

rixccaptv
Posts: 11
Joined: Wed 14. Apr 2021, 03:23

Re: Stuff Error on CAN-FD output channel

Post by rixccaptv » Tue 14. Dec 2021, 03:17

Thank you.

I did not know about this tool (or these settings really).

I imagine I will need to talk with some people to verify the exact timing parameters required to match the vehicle bus then.

If I just want to test on the bench for now, though, I only need to make sure the gateway code matches the CANalyzer settings.
Just a few more questions on this topic:
- Of course I'll select CAN-FD in the bitrate calculation tool, but what did you mean by 'from' and 'to'? I don't see any fields to select this...
- On the gateway code there are 'misc' properties in the CANTiming_t struct which I don't see anywhere on the bitrate calculation tool results: 'limit', 'lo', and 'mod'
- - I guess these can remain unchanged? (96, 0, 1 respectively)

And on the CANalyzer side, I can see something called BTL cycles which is not on the code parameters. Do I need to worry about this value too?

Best regards,
- Ricardo
Attachments
CANalyzer_bitTimingSettings.jpg
CANalyzer_bitTimingSettings.jpg (85.66 KiB) Viewed 16269 times

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Stuff Error on CAN-FD output channel

Post by M.Heidemann » Tue 14. Dec 2021, 08:32

Hello,
Of course I'll select CAN-FD in the bitrate calculation tool, but what did you mean by 'from' and 'to'? I don't see any fields to select this...
I was refering to the "sample-point" field so that only the intended sample-points are given:
2021-12-14 08_28_49-Window.png
2021-12-14 08_28_49-Window.png (4.9 KiB) Viewed 16261 times
On the gateway code there are 'misc' properties in the CANTiming_t struct which I don't see anywhere on the bitrate calculation tool results: 'limit', 'lo', and 'mod'
limit = Error Threshold , lo= listen-only, mod = ISO / NON-Iso mode
I guess these can remain unchanged? (96, 0, 1 respectively)
most likely, yes. Maybe there is non ISO connection then you would
have to set mod = 0. Non-ISO connections are not that common nowadays.

You can disregard btl on the Canaylzer side, there is no equivalent on our side.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

rixccaptv
Posts: 11
Joined: Wed 14. Apr 2021, 03:23

Re: Stuff Error on CAN-FD output channel

Post by rixccaptv » Tue 14. Dec 2021, 09:48

Perfect.

It's all working nicely now.

Thank you very much.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Stuff Error on CAN-FD output channel

Post by M.Heidemann » Tue 14. Dec 2021, 10:35

Hello,

Glad to hear that!

Thank you for the feedback.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

Locked