ISSUE with USING WINUSB Driver & Arduino AS USB & CATERINA boatlaoder

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Project Goal: Create a custom USBDevice.
Name of device : "CapiaZ"
Board USed: Arduino MICRO
summary:
I was able to modify the Caterina boatloader for my CapiaZ board, to have a specific VID & PID for it. and when you plug it to the pc the ARDUINO IDE will show the port and the name "CAPIAZ".
Then I used WINUSB.sys and WINUSB.inf to generate the driver. Successfully, I am able to install the driver and Device manager shows it as follwoing -which is the goal so far-:

+CapiaZ Device
CapiaZ-S01
Also I wrote my C++ library that communicate with CapiaZ using WINUSB.lip and SETAPI.lib. Using read Endpoints bulik in and Builk out to read and write from it.
I use WinUsb_WritePipe and WinUsb_ReadPipe,. I write data to the Capia and read data from the capia no problems.

# The issue,
when I unplug (soft or hard) the Capia then plug it back, and try to run my C++ application, the C++ application will connect and write to it but I'm not able to read data from it. any suggestions what could be the issue ?
thanks

You must fall before you get up !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't have the software and hardware that you have. 

 

I presume that if you close the PC program and restart it, it works okay.

 

Have you confirmed that when you detach the device and reattach it, the data you send from the PC is received by the device?

 

Your PC software may not notice when the device is detached, or if it does, it is not reconnecting correctly when you send.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Recently I saw a video from OpenTechLab about a USB debugging session with Sigrok and a USD100 Logic Analyser.

If the operating system detects some fault from the device it is flagged as faulty and further communication attempts are ignored by low level drivers in the OS.

 

https://www.youtube.com/watch?v=...

https://www.youtube.com/results?...

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

Last Edited: Sat. Jan 27, 2018 - 01:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks Steve17 to replying but no it doesn't matter how many times to restart my pc it still doesn't work. In order for it to work again I need to uninstall the driver , re burn the boatloader, connect it to my pc, then install the driver then it will work. I setup a led light that will flash in a specific sequence when the device get the data and this part is working after detaching and reattaching the usb device.

When you say not reconnecting correctly what do you exactly mean? I am assuming it is connecting corrrectly because I can write data to the device , but I can't read from it.

 

You must fall before you get up !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Pauldh  thanks for the I will check it out

You must fall before you get up !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wireshark is able to capture and decode USB traffic.  It may shed light on the issue(s).

 

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you have to re-install a bootloader on the device, that would imply the bootloader is modifying itself.  If you are using the bootloader to install an application on the device, maybe the hex file you are trying to install is overwriting the bootloader.  If that is the case, don't use the bootloader and see if you can unplug and re-plug the device. Or use the bootloader to do something else like verify, etc.

 

I implemented WinUSB and it works very well.  I made my device a WCID (Windows compatible ID) device.  Windows installs its own driver automatically the first time a plug in the device.  I'm not an expert, I just followed directions.

https://github.com/pbatard/libwdi/wiki/WCID-Devices

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay so I used a tip from the comment, and I installed a free usb data analyzer which gave me the following clue.

When I deattache and then reattache my usb device to my pc I get the following error 

000004: Bulk or Interrupt Transfer (UP), 2018-01-29 14:35:28.9014727 +0.2010032. (1. Device: R&S FS-SNS26) Status: 0xc0010000
Pipe Handle: 0x2d221d78 (Endpoint Address: 0x83)
Get 0x0 bytes from

and when i searched it means :-

The USB stack reports this error whenever it completed a transfer because of an AbortPipe request from the client driver.

 

But what that means ? DO i need to re find the endpoints or something?

 

You must fall before you get up !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Steve17 , I don't have to reinstall the boatloader , But I have to uninstall and install the drivers ,

 

 

ALso guys ignore the previous error, This error happens because I request time out .

But If I took the time out away , the program will stay busy and nothing comes back not even to the USB analyzer 

You must fall before you get up !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Whenever you plug in your device, do you see it in Device Manager?  When you unplug, does it go away?

 

When you get a good connection, kill the PC program.  Then unplug and re-plug the device.  Then restart the PC program and see if it works.

 

When it does not work, go to Device Manager and disable and re-enable the device. Sometimes that fixes a problem.