Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

985x CAN Error handling

Hi all, 

What is the best error handling approach for CAN protocol working with a 9853 at FPGA Level?

 

In the examples that I found I saw two approaches:

1.- To see if there are Frames Lost (code 65539) and then call CAN Reset and CAN Start 

2.- To check if Comm State is different to Error Active and then call CAN Reset and CAN Start 

 

In all options you have to uncheck auto start at the module configuration, isn't it?

 

What is the best? or if you think there is another best option please let me know!

Thanks!!

 

 

0 Kudos
Message 1 of 4
(3,251 Views)

Anyone can help me?

 

Nobody wants some Kudos?? 🙂

 

Thanks

0 Kudos
Message 2 of 4
(3,198 Views)

I do but haven't done any CAN work on FPGA in many years, and I don't remember any thing specific.  We just read the frames and send them in a DMA buffer back to the Windows PC that either read, or wrote them.  There was no work on the FPGA other than send and receive.  We were only using it this CAN device (instead of a cheap USB CAN) because we already had an expansion chassis for c series modules and it was easier to just drop in a CAN device in an empty slot.

Message 3 of 4
(3,195 Views)

Hi,

I saw that this is an old thread, but as I have just implemented a CAN reader in FPGA, I though it can be useful to put down my experience:

  • The loops in the FPGA are typically timed ones and the CAN reader blocks do not work in that type of loops, so they need to be placed in a separate block. I guess the reason is that, the readings are interrupt driven, so probably it is a good idea not to put too much load in the reading loop. I have only two actions: pass over data if the CAN is OK or reset the can if any error occurred – see last comment.
  • I use cluster format to read the data and local variable to pass the cluster between the two loops. The error flag is also passed over, so I can send error code from the timed loop.
  • In the timed loop, the messages need to be read: I send them across the FPGA and the RT, via a FIFO.
  • I came across two errors: 65538 (time out) and 65539 (loss of frames).
    The communication times out, when there are no income messages, like when the CAN is disconnected: this is normal and the reset sorts it out.
    The loss of frames happens, when the messages are not read out, so it is probably a buffer overflow. This needs to be handled in the code – see comment before this.

The basic VI is attached.

I am using Labview 2015 SP1 on Windows 7 with Compact RIO.

 

Regards,

 

Zoltan

 

Message 4 of 4
(2,652 Views)