15
©2017 Guangzhou ZHIYUAN Electronics
Date: 2017/10/09
User Manual
V1.00
C
Guangzhou ZHIYUAN Electronics Co., Ltd.
High performance CAN card for PCIe interface
PCIe-9140I User Manual
VCI_CloseDevice function only need to be called once when the application is
initialized and exited.
In order to disable the current CAN port when closing device, the VCI_ResetCAN
function should be called to make the current CAN port away from CAN-bus. The
device driver automatically call VCI_ReseCAN to exit CAN bus only if the last
device handler is closed.
8. How to utilize an interrupt to operate the communication card?
The PCIe-9140I card does not provide an interface for direct interrupt operation,
because the interrupt has been processed in the driver. The most of the reasons
for that an interrupt needs to be handled in the application are: the application
does not know when the data will arrive, and it can read the data from buffer only
if the message reception operation is triggered. The general method to solve this
problem is to use multiple threads (or multiple tasks), i.e., start a new thread and
the VCI_Receive function is looped in the thread to query the receive buffer. The
blocking mechanism has been implemented inside the VCI_Receive, and the
thread calling will be suspended when there is no data in the buffer. At this point,
it does not take up the CPU time and the application can still handle other
transactions.
9. How to use the VCI_Transmit transmitting function better?
The PCIe-9140I device driver provides 16 frames of software transmit buffer
FIFO. 16-frame data are transmitted at most each time the VCI_Transmit is called.
The transmitting speed of device is decided by current computer software and
hardware performance. The continuous transmitting speed is generally between
2000 frames/s and 4000 frames/s (11Bytes and 1Mbps for standard data frame).
If the transmitting speed is too fast, the data of remote receiving device is
possible to overflow so that the response is lost. Users can increase delay time
appropriately in the application to reduce the transmitting speed.
Each frame has a timeout limit during transmission. The timeout for single frame
transmission is about 2 seconds. If multiple frames are transmitted at a time, the
timeout for last frame transmission is 2 seconds, and the timeout for other frames
is 1 second. The transmission timeout generally occurs when the CAN-bus is
busy and the priority of current node is low. It is not a function calling or
communication error, and users can write codes to achieve data re-transmission
(the timeout event seldom occurs in the middle-speed and low-speed network).
So, it should ensure that the occupancy ratio of CAN bus should not exceed the
60-70% of bus capacity.
10. How to use the VCI_Receive function better?
The device driver provides 100000 frames of software receive buffer, which
provides sufficient response handling time for application programmers. When
the software receive buffer overflows, the device driver will call VCI_ResetCAN to