PORTS Forum
Ports and Interfaces => USB => Topic started by: EddieSW on July 31, 2019, 11:40:55 pm
-
Dear All,
I am a new user of C# and USB. I want to design a window tool which to transfer the data between the PC and uC.
Currently, I am studying the visual studio C# and USB complete books, but I don't know how to start it.
Is anyone able to give me the suggestions? or where could i find the simple example code? Thanks for your help. :)
-
For bulk transfers for an application that doesn't fit another defined class, I suggest using WinUSB:
http://www.janaxelson.com/winusb.htm
or virtual COM port:
http://www.janaxelson.com/serport.htm#usb_virtual_com_ports
Microchip and other chip providers have example firmware for these.
If you are using an existing device, start by learning what driver the host is using (Windows Device Manager).
-
Hi Jan,
Really thank for your reply. I am starting to trace code (winusb_cs_31) and try to understand it.
Currently, my USB flash is able to be detected by program when program is launched or USB flash is plug-in.
But I still have some problems to test bulk transfer with winusb_cs_31.
I will check it first and learn some knowledge from you later. Thanks a lot.
-
If your device is a flash drive, it uses the mass storage class. Use the C# File class.
-
Hi Jan,
Yes, I found the USB flash uses the different driver (usb storage), not winusb. If I want to test and trace the behavior of winusb_cs_31, which development kit could I use? Thanks for your advice.
-
Microchip and others have development kits and example firmware for WinUSB.
http://www.janaxelson.com/winusb.htm
-
Hi, Jan,
When I use MPLAB X to compile device-winusb_lvr.zip. There are error messages as below,
../main.c:135:10: fatal error: 'USB/usb.h' file not found
#include "USB/usb.h"
^~~~~~~~~~~
1 error generated.
../usb_descriptors.c:160:10: fatal error: './USB/usb.h' file not found
I think usb.h and usb library are offered from Microchip, so we need to set the include and library path in the project, is it?
After I search the usb.h in the MPLAB X environment, there are many folders include usb.h
May I learn how do you solve this compile error? Thanks a lot.
-
See
https://www.microchip.com/forums/m728325.aspx
The Microship forums are likely the best place for Microchip-specific advice.