Page 1 of 1

Time to wait after reset transmit and receive buffer

Posted: Mon 27. Jul 2020, 12:46
by msalz
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

Re: Time to wait after reset transmit and receive buffer

Posted: Mon 27. Jul 2020, 12:55
by msalz
I use the PCAN PRO FD and send on the first channel to the bus and read in the frames on the second channel.

Re: Time to wait after reset transmit and receive buffer

Posted: Mon 27. Jul 2020, 13:59
by M.Maidhof
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