Invalid frames received

Windows® Compatible Software for Displaying CAN Messages
Post Reply
Sebastian
Posts: 2
Joined: Tue 4. Jun 2019, 14:59

Invalid frames received

Post by Sebastian » Tue 4. Jun 2019, 15:14

Hi all,

I have two PCAN-SUB-FD devices connected to each other. I have to develop LUA applications for the devices to be integrated in our workflow.

For development I control the first one with a LUA script and the second one with the PCAN-View. In LUA I load the provided DLL.

The following is already working without any problems:

Code: Select all

LUA script transmits CAN Message over first device => CAN Message is received on second device and displayed in PCAN-View
This already works without missing any data.

Now to the other direction:

Code: Select all

PCAN-View transmits CAN Message over second device => CAN Message is printed out on LUA command Line
Even that works but with one strange behaviour. The workflow here is the following: I send the same message every five seconds (please have a look at the attachment of PCAN-View).

The messages are received but at the beginning always two CAN Messages are added with all data bytes set to ZERO and I don't know what's going wrong here:

Code: Select all

Program starting as '"D:\Entwicklung\ZeroBraneStudio-1.70\bin\lua.exe" -e "io.stdout:setvbuf('no')" "D:\Entwicklung\Lua\scripts\Pcan_ReadMsg.lua"'.
Program 'lua.exe' started in 'D:\Entwicklung\Lua\scripts' (pid: 8236).

-- Starting suite "main", 1 test(s)
  Available Device Nr. 1: 0x51
===============================
Message ID: 0x1
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Timestamp: 0xA324A34A
Message ID: 0x1
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Msg: Received Data: 0x0
Timestamp: 0xA324A4C3
Message ID: 0x5
Msg: Received Data: 0x57
Msg: Received Data: 0x12
Msg: Received Data: 0x34
Msg: Received Data: 0x15
Msg: Received Data: 0x8A
Msg: Received Data: 0xBC
Msg: Received Data: 0xF8
Msg: Received Data: 0xE4
Timestamp: 0xA324A7C9
Message ID: 0x5
Msg: Received Data: 0x57
Msg: Received Data: 0x12
Msg: Received Data: 0x34
Msg: Received Data: 0x15
Msg: Received Data: 0x8A
Msg: Received Data: 0xBC
Msg: Received Data: 0xF8
Msg: Received Data: 0xE4
Timestamp: 0xA324A9ED
Message ID: 0x5
Msg: Received Data: 0x57
Msg: Received Data: 0x12
Msg: Received Data: 0x34
Msg: Received Data: 0x15
Msg: Received Data: 0x8A
Msg: Received Data: 0xBC
Msg: Received Data: 0xF8
Msg: Received Data: 0xE4
Timestamp: 0xA324AC12
Message ID: 0x5
Msg: Received Data: 0x57
Msg: Received Data: 0x12
Msg: Received Data: 0x34
Msg: Received Data: 0x15
Msg: Received Data: 0x8A
Msg: Received Data: 0xBC
Msg: Received Data: 0xF8
Msg: Received Data: 0xE4
Timestamp: 0xA324AE36
CAN Queue ist empty: Status 0x20
.
---- Testing finished in 469.00 ms, with 2 assertion(s) ----
  1 passed, 0 failed, 0 error(s), 0 skipped.
Program completed in 0.61 seconds (pid: 8236).

If I call the script after 10 seconds I receive 2 valid frames and the two additional "false" frames. If I call the scripts ater 60 seconds, I receive 12 valid frames and again the two additional "false" frames.

I'm very glad for any hints!

Kind regards
Sebastian
Attachments
PCAN_View.png
PCAN_View.png (55.06 KiB) Viewed 5161 times

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Invalid frames received

Post by M.Maidhof » Tue 4. Jun 2019, 16:04

Hi,

please check the MSGTYPE of those additional frames. This could be status or errorframes, because PCAN-View is transmitting to a CAN bus without having a second active node on the bus (no ack). So the CAN-Controller on the PCAN-View side will resend the message with 100% busload, until your app is active again. This could cause errorframes at the initialization process of your app.

regards

Michael

Sebastian
Posts: 2
Joined: Tue 4. Jun 2019, 14:59

Re: Invalid frames received

Post by Sebastian » Tue 4. Jun 2019, 16:39

Hi Michael,

thanks for the very fast and helpful answer! I did so and only print the frames if it is not an error or status frame. By printing out the message type I get this output, after the error frame there is a MSGTYPE of 0x14.

Code: Select all

-- Starting suite "main", 1 test(s)
  Available Device Nr. 1: 0x51
===============================
Message type: 0x80
Error frame received
Message type: 0x80
Error frame received
Message type: 0x14
Message ID: 0x5
Msg: Received Data: 0x57
Msg: Received Data: 0x12
Msg: Received Data: 0x34
Msg: Received Data: 0x15
Msg: Received Data: 0x8A
Msg: Received Data: 0xBC
Msg: Received Data: 0xF8
Msg: Received Data: 0xE4
Timestamp: 0x66FF7AD
Message type: 0x14
Message ID: 0x5
Msg: Received Data: 0x57
Msg: Received Data: 0x12
Msg: Received Data: 0x34
Msg: Received Data: 0x15
Msg: Received Data: 0x8A
Msg: Received Data: 0xBC
Msg: Received Data: 0xF8
Msg: Received Data: 0xE4
Timestamp: 0x66FF9D2
Message type: 0x14
Message ID: 0x5
Msg: Received Data: 0x57
Msg: Received Data: 0x12
Msg: Received Data: 0x34
Msg: Received Data: 0x15
Msg: Received Data: 0x8A
Msg: Received Data: 0xBC
Msg: Received Data: 0xF8
Msg: Received Data: 0xE4
Timestamp: 0x66FFBF6
CAN Queue ist empty: Status 0x20
In the header file I cannot find value of the MSGTYPE set to 0x14. Is it logical or'd and does mean that it is a PCAN_MESSAGE_ESI as well as a PCAN_MESSAGE_FD message?

Code: Select all

#define PCAN_MESSAGE_ESI             0x10U  // The PCAN message represents a FD error state indicator(CAN FD transmitter was error active)
#define PCAN_MESSAGE_FD              0x04U  // The PCAN message represents a FD frame in terms of CiA Specs
Kind regards
Sebastian

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Invalid frames received

Post by M.Maidhof » Wed 5. Jun 2019, 09:53

Hi,

yes, it is a bit combination. Please check your bitrate settings for FD again on both sides. You must use the same settings, otherwise CAN FD will not work correctly.

best regards

Michael

Post Reply