Community
cancel
Showing results for 
Search instead for 
Did you mean: 
APann
Beginner
899 Views

Read and Write problem with EG20T CAN Driver

Dear all, I'm developing a multithreading C++ application on a PC104 board with the EG20T CAN Controller and Windows 7 Embedded. I'm using the intel library (EG20T_WinXP_WePOS_Package_241) to use that controller. My application has two thread, one to Write and the other to Read on the CAN bus.

These threads call the following function:

Write Thread -> bRet = DeviceIoControl(hDevice, IOCTL_CAN_WRITE, &msg, sizeof(msg), NULL, 0, &dwBytesReturned, NULL);

Read Thread -> bRet = DeviceIoControl(hDevice, IOCTL_CAN_READ, NULL, 0, &msg, sizeof(msg), &dwBytesReturned, NULL);

But when the Read function is called in the Read Thread (it could be in blocking mode) the Write one doesn't work, the Write function doesn't write any bytes on the CAN bus until something is received from the Read.

This seems that this library can't be used in multithreading application, is it right?

Have you any suggestion?

Best regards.

0 Kudos
0 Replies
Reply