Why canoe display error frame ID's message? - canoe

I am automotive software engineer.
I use vector Canoe tool to simulation can network.
For example, at Ecu sleep status in vehicle, I transmitted general message to Ecu having IG Block function in Canoe. After that, Ecu was wake up.but tx error frame generated. I saw Error frame information. It was message's id I sent. And, after 1ms time, message of same Id transmitted in canoe. I guess can controller may transmit error frame because of message to send uses IG Block. And I think that Can controller should not receive message. And I think IG block message was lost.But in Canoe display, seems to transmit error frame and normal message. Is it true? Can controller know whather or not Normal message ?
And can controller receive that message?
enter image description here

In your screenshot, you can see, that the error frame is caused by a bit error.
Bit error means, that the message observed on the bus during sending did not match the message sent. It is a Tx error, i.e. the sender itself detects and alerts the error, and will try again.
Bit errors are caused mostly by wiring problems, e.g. wires too long for the used baud rate, bus not terminated correctly, etc.
It may also be that the baudrate is not setup correctly.
I hope that helps you to find the root cause.

Related

Ethernet bond failure detection

I was testing my transmitter application on an ethernet interface and I deliberately put down the interface using "ifdown eth0". This stopped the message transmission and socket function "sendto" raised err ENETUNREACH. When the same interface was brought up again using "ifup eth0", message transmission resumed automatically.
However, when I am doing the same steps using bonded ethernet interface, then the error is not recovered. In other words, "sendto" gives ENETUNREACH error when bonded interface goes down. But when it is made up again, the transmission is not started back. Instead, the error is changed to "ENODEV".
Is there any action an application needs to perform on bonded interface failure, in order to recover from the same? If yes, how an application comes to know about the failure?
In case of infiniband bond, application receives RDMA errors like PORT_ERR so it is easy to reconnect the socket.
Also, is there any specific bond configuration which may auto-recover from such failures or indicate the application about the same. As far as I understand, the bonded interface should behave like a normal interface and should auto-recover from the failure.
Appreciate your help!

J1939 Communication over CAN, J1939 Protocol Stack

I need some guidance on how to use the J1939 library for the Simulink Real-time toolbox.
I am using the previous version which is 6.7 (R2017b). There is very little documentation or example on it.
What I want to achieve is to send a CAN message on the channel 1 and receive it on channel 2.
Can anyone share the steps on how to send a frame, with the setup of the different blocks.
In my model I have considered the blocks:
J1939 Database where I added the dbc and it is fine
J1939 Controller Application : I just used the General tab. I am not about the Network management tab content, where I have put Arbitrary Address Capable
J1939 Protocol Stack: Not sure what I can connect to the inputs or outputs of the block: CAN Msg and N?
J1939 Transmit message, I added the frame and it seems ok
J1939 Receive message, I also added the same frame and the block seems ok too
Setup block CAN-AC2-PCI B1 FIFO: CAN1 / CAN2 to manage the CAN board which also seem to be OK
At the moment with the way I configured them, I am seeing any frame sent on the bus.
Can anyone share with me how to configure the blocks?
Many thanks for your support.

SocketCAN stops read after RX overflow, is it normal?

I’m doing tests on embedded hardware with integrated CAN bus interface.
The driver provides Linux Socket API.
I try to see the limits:
I have one transmitter that writes CAN frames as fast as possible and a receiver that reads continuously.
After a moment the receiver gets an error frame signalling RX overflow.
I have no problem with that, it's normal and expected.
But my question is why at this point no more frame is received ?
(The restart-ms option is set)
I expected some dropped frames and others RX buffer errors but not the end of reception.
After exchanging emails with socket-can developers and my device provider, it was an bug in the driver.
In the mean time a patch was released to move at91_can to new rx_fifo architecture.
this patch fix the issue.

How do I make sure WinSock sends to all clients?

I have written a vb6 game to allow 4 players to play a card game.
One of the players will host the game and the others will join.
I used a socket array to join all of the other players with the host socket
Everything went smooth and I am able to send messages from each player to the rest of the players, from host to guests and vice versa
However, during the game, one player would "tell" the host that a card is chosen. The host will then send the same message to each of the clients connected to the socket array like this
For i=1 to 3
Me.SocketArray(i).SendData player.selectedCard
DoEvents
Next
but for some reason, one of the player never receives the message. Although the same player did receive messages before this point, and possible will receive other messages later.
So there is a Syncing problem with what was send and what was not.
I looked for answers everywhere, and some suggested to use DoEvents more often to force the winsock to send the data immediately.
I then thought of implementing an inbox for each player in which each player must reply with an acknowledgment of the received message, and the host will not send any more messages until the arrival of acknowledgement, but that made the game slower and I had the same problem I had before, but this time it's not the messages that got lost, it's the acknowledgment.
The number 1 reason I think I am having all of this is that the Winsock control sometimes sends incomplete messages (one character missing) and that will create a mess, because I need every character at the other end, otherwise the message is useless.
How can I make sure that whenever the host sends a message, all the other guests receive ALL of it intact?
DoEvents() calls are hazardous in the wrong hands.
What you probably have going on is the assumption of "magic" message framing, a failure to buffer and parse messages from inbound data streams, and reentrant calls to your DataArrival handler because you are calling DoEvents().
Nagle could be an issue as well but it should result in responsiveness problems and not apparent data loss.
This same issue has been asked about and answered innumerable times over the last decade.

Ensuring send() data delivered

Is there any way of checking if data sent using winsock's send() or WSASend() are really delivered to destination?
I'm writing an application talking with third party server, which sometimes goes down after working for some time, and need to be sure if messages sent to that server are delivered or not. The problem is sometimes calling send() finishes without error, even if server is already down, and only next send() finishes with error - so I have no idea if previous message was delivered or not.
I suppose on TCP layer there is information if certain (or all) packets sent were acked or not, but it is not available using socket interface (or I cannot find a way).
Worst of all, I cannot change the code of the server, so I can't get any delivery confirmation messages.
I'm sorry, but given what you're trying to achieve, you should realise that even if the TCP stack COULD give you an indication that a particular set of bytes has been ACK'd by the remote TCP stack it wouldn't actually mean anything different to what you know at the moment.
The problem is that unless you have an application level ACK from the remote application which is only sent once the remote application has actioned the data that you have sent to it then you will never know for sure if the data has been received by the remote application.
'but I can assume its close enough'
is just delusional. You may as well make that assumption if your send completes as it's about as valid.
The issue is that even if the TCP stack could tell you that the remote stack had ACK'd the data (1) that's not the same thing as the remote application receiving the data (2) and that is not the same thing as the remote application actually USING the data (3).
Given that the remote application COULD crash at any point, 1, 2 OR 3 the only worthwhile indication that the data has arrived is one that is sent by the remote application after it has used the data for the intended purpose.
Everything else is just wishful thinking.
Not from the return to send(). All send() says is that the data was pushed into the send buffer. Connected socket streams are not guarenteed to send all the data, just that the data will be in order. So you can't assume that your send() will be done in a single packet or if it will ever occur due to network delay or interruption.
If you need a full acknowledgement, you'll have to look at higher application level acks (server sending back a formatted ack message, not just packet ACKs).