Other Parts Discussed in Thread: C2000WARE
Hello,
we are developing a GUI application on Windows in 64 Bit which is supposed to communicate with a microcontroller via USB 2.0 using C++ in Visual Studio 2022. We have previously asked for assistance in regards to providing a 64 Bit version of the tiusbdll functionality. We are currently using the file shared in the response marked as answer in the post below:
In order to initialize the communication, we roughly follow the order of usb_bulk_example.c found in C2000Ware Version 3.02.00.00 under utilities/tools/f2838x/usb_bulk_example of calling InitializeDevice() to set the TIUSB_HANDLE hUSB and use it to call WriteUSBPacket() with the appropriate function arguments. In our case, this is only sending 2 bytes which do get sent according to our monitoring of the PC side USB port with WireShark and do arrive according to a debugging mode monitoring the buffer in the microcontroller.
However, calling ReadUSBPacket() to read the returned data results in an unexpected Access Violation Exception during a read operation called by winusb.dll which is in turn called by tiusbdll.dll, before any response can be sent by the microcontroller.
As we do have a working communication protocol based on 32 Bit tiusbdll written in C from a previous project, we can confirm that the microcontroller can send back the requested data when instructed through the 32 Bit protocol, which can be seen in WireShark as well. The function call of ReadUSBPacket() is identical to the one we are trying to implement in the 64 Bit version, including all function arguments.
Is it possible that something changed in the recompilation of the dll-file for 64 Bit that could prevent only the read operation from working the same way as before? Please feel free to ask if you need further clarification.
Thank you in advance and best regards.
Edit 02/23/2023: We have tested further and thought of the possibility that we may need to declare or initialize certain variables used in the function calls differently in 64 Bit than in 32 Bit (e.g. regarding buffer size, address types etc.). Is it possible that anything like that has to change to accomodate the switch to 64 Bit?
Additionally, is it possible that the driver files ucrtbased.dll or vcruntime140d.dll that are installed in folder Windows/system32/ for the 32 Bit protocol, have to be changed or installed elsewhere for the 64 Bit version?