Time to wait after reset transmit and receive buffer

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
msalz
Posts: 8
Joined: Wed 20. May 2020, 16:17

Time to wait after reset transmit and receive buffer

Post by msalz » Mon 27. Jul 2020, 12:46

Hello,

considering the PCAN-Basic API, the reset function clear the transmit and receive buffer of the specified channel:

Code: Select all

#  Resets the receive and transmit queues of the PCAN Channel
    #
    def Reset(
        self,
        Channel):

        """
          Resets the receive and transmit queues of the PCAN Channel
          
        Remarks:
          A reset of the CAN controller is not performed
          
        Parameters:
          Channel  : A TPCANHandle representing a PCAN Channel
        
        Returns:
          A TPCANStatus error code
        """
        try:
            res = self.__m_dllBasic.CAN_Reset(Channel)
            return TPCANStatus(res)
        except:
            print ("Exception on PCANBasic.Reset")
            raise
Are all messages up to the driver level deleted or is it possible that some messages are not deleted in the driver anymore?
Is there a minimum time to wait after calling the reset function to give the API enough time to clear the internal buffer completely?

I have noted the following behavior: 100 messages are sent at 1 Mbit (as fast as possible in a loop, i.e. the frames have to be buffered by the PCAN, because writing to the queue is faster than frames can be put on the bus). Afterwards the reset function is called and then send one frame and read directly. In this case, however, there are some old messages from the previous call.




Thanks
Martin

msalz
Posts: 8
Joined: Wed 20. May 2020, 16:17

Re: Time to wait after reset transmit and receive buffer

Post by msalz » Mon 27. Jul 2020, 12:55

I use the PCAN PRO FD and send on the first channel to the bus and read in the frames on the second channel.

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

Re: Time to wait after reset transmit and receive buffer

Post by M.Maidhof » Mon 27. Jul 2020, 13:59

Hi,

with the PCANBasic CAN_Reset() function, the driver RX and TX queue will be flusht. However, some messages could already be in the hardware buffer, which will not be deleted by that API call. Please have a look into the PCANBasic help file, there you will find more details on how to delete all buffers using the Uninitialize()/Initialize() function.

regards

Michael

Post Reply