• AVR Freaks

Hot!HOW TO: PIC32MZ USB without Harmony

Page: < 123 > Showing page 2 of 3
Author
JPortici
Super Member
  • Total Posts : 674
  • Reward points : 0
  • Joined: 2012/11/17 06:27:45
  • Location: Grappaland
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/28 03:44:12 (permalink)
0
IIRC the device descriptor is for a CDC device, correct?
It may be that Francesco is using windows 8.1 or older as an host. Linux, OSX and Windows 10 can enumerate a CDC device using a generic driver integrated with the OS, older versions of windows require a specific driver to be tied with the VID/PID number
 
I haven't tried the code yet :( but you should use <xc.h> which will select the correct device include file for you.
post edited by JPortici - 2019/01/28 03:45:33
#21
Timmons
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2018/02/07 01:09:23
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/28 04:18:10 (permalink)
0
Yes JPortici
 
I'm using Windows 7.
maybe I have to change the class device in device descriptor?
 
 
#22
qhb
Superb Member
  • Total Posts : 9998
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/28 04:49:01 (permalink)
0
If you're using Windows older than 10, and change the VID/PID, then you have to supply an INF file with the matching info for Windows to install it, even for standard classes.
 

Nearly there...
#23
Timmons
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2018/02/07 01:09:23
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/29 00:17:32 (permalink)
0
Hi 
 for now,  I can not solve the problem. 
Only a question. In the code, the case  0x8000 for getstatus is without response...
I know that the host make this request, maybe the device can not start for missing replay?
i Tryed to replay to this request with two byte 0x00  0x00 but nothing is changed....
 
Francesco
#24
MisterHemi
Junior Member
  • Total Posts : 118
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: 0
  • Status: online
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/29 01:24:38 (permalink)
0
Timmons
Hi 
 for now,  I can not solve the problem. 
Only a question. In the code, the case  0x8000 for getstatus is without response...
I know that the host make this request, maybe the device can not start for missing replay?
i Tryed to replay to this request with two byte 0x00  0x00 but nothing is changed....
 
Francesco




Did you try creating the INF file as was suggested above?

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS High Sierra (10.13.3) and MPLAB X IDE v4.15
 
Curiosity PIC MZ EF, PIC24F Curiosity, and XPRESS EVAL BOARD (PIC16F18855).
#25
Timmons
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2018/02/07 01:09:23
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/29 05:20:07 (permalink)
0
YES
I Created it, after update, windows recognise the device but 
identifies it with a exclamation point on its icon
 
#26
qhb
Superb Member
  • Total Posts : 9998
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/29 12:25:19 (permalink)
0
So what message do you see when you open it in Device Manager?
 

Nearly there...
#27
Timmons
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2018/02/07 01:09:23
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/29 14:14:57 (permalink)
0
[image]file:///C:/Users/Francesco/Desktop/USB.png[/image]
#28
Timmons
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2018/02/07 01:09:23
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/29 14:19:51 (permalink)
0
Sorry , I can't attach.....
#29
Timmons
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2018/02/07 01:09:23
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/29 14:35:01 (permalink)
0
Now maybe it is ok

Attached Image(s)

#30
Timmons
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2018/02/07 01:09:23
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/01/30 00:42:56 (permalink)
0
Sorry qhb, you ask me the windows message:
 
"the device can not start (error code 10)"
 
Francesco
#31
MisterHemi
Junior Member
  • Total Posts : 118
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: 0
  • Status: online
Re: HOW TO: PIC32MZ USB without Harmony 2019/02/04 09:53:13 (permalink)
0
Timmons
Sorry qhb, you ask me the windows message:
 
"the device can not start (error code 10)"
 
Francesco




I'm curious were you able to resolve this problem?

The only version of Windows I have access to is Windows 10 running on a virtual machine on my Mac Book Pro, which doesn't apply since you're using an older version of Windows.
 
You mentioned case 0x8000 was Windows requesting this?

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS High Sierra (10.13.3) and MPLAB X IDE v4.15
 
Curiosity PIC MZ EF, PIC24F Curiosity, and XPRESS EVAL BOARD (PIC16F18855).
#32
Howard Long
Super Member
  • Total Posts : 672
  • Reward points : 0
  • Joined: 2005/04/04 08:50:32
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/02/04 10:52:28 (permalink)
0
The error I got on Windows 10 (latest build 1809) was that the driver was missing: it detected the device, and retrieved the correct descriptors. It might need an INF. I am running the stack on the Curiosity MZ board.
 
One further thing, I would recommend being careful and run this stack through a hub rather than directly on a computer's host port. Although I don't think it was the stack that directly caused me the problem, coincidentally since the Curiosity's OTG port was connected directly to my Macbook (a 2017 model with the single USB C port), the USB 2.0 pins on the port have stopped working (D+ and D- diode clamped to 0.7v), apparently permanently, and numerous SMC and PRAM resets haven't worked. The power, video and USB 3.x still work on the port. I was programming/debugging from a separate PC.
#33
MisterHemi
Junior Member
  • Total Posts : 118
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: 0
  • Status: online
Re: HOW TO: PIC32MZ USB without Harmony 2019/02/04 14:17:17 (permalink)
0
Howard Long
The error I got on Windows 10 (latest build 1809) was that the driver was missing: it detected the device, and retrieved the correct descriptors. It might need an INF. I am running the stack on the Curiosity MZ board.
 
One further thing, I would recommend being careful and run this stack through a hub rather than directly on a computer's host port. Although I don't think it was the stack that directly caused me the problem, coincidentally since the Curiosity's OTG port was connected directly to my Macbook (a 2017 model with the single USB C port), the USB 2.0 pins on the port have stopped working (D+ and D- diode clamped to 0.7v), apparently permanently, and numerous SMC and PRAM resets haven't worked. The power, video and USB 3.x still work on the port. I was programming/debugging from a separate PC.




I use a Mac Book and the Curiosity MZ board too... i'm curious what caused it. Were you using the other endpoints besides endpoint zero?
How were they configured (ISO, TX/RX, etc)?
Was the Curiosity board's USB configuration changed from the original settings in the stack?

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS High Sierra (10.13.3) and MPLAB X IDE v4.15
 
Curiosity PIC MZ EF, PIC24F Curiosity, and XPRESS EVAL BOARD (PIC16F18855).
#34
Howard Long
Super Member
  • Total Posts : 672
  • Reward points : 0
  • Joined: 2005/04/04 08:50:32
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/02/05 01:25:18 (permalink)
0
MisterHemi
I use a Mac Book and the Curiosity MZ board too... i'm curious what caused it. Were you using the other endpoints besides endpoint zero?
How were they configured (ISO, TX/RX, etc)?
Was the Curiosity board's USB configuration changed from the original settings in the stack?



This was one of the 12" Macbook retina units that only has a single physical USB-C port, it's a completely stupid design decision by Apple not least because if that one port becomes physically damaged (and it's not hard to do so with USB-C), all bets are off, you can't even charge it. I have another laptop with two USB-C ports, and one of them was physically damaged by inadvertently trying to plug in a Lightning cable into one of the USB-C ports, so don't do that ;-)
 
I usually run in Windows, even on Macs I run Bootcamp 95% of the time, but I wanted to see how OS X recognised the device compared to Windows.
 
Like I suggest, I don't really think it's necessarily the device stack itself, more likely it's a simple ESD failure. It was a slightly unusual (but not illegal) configuration too, running the device port to the Macbook and the debug port to a PC. As the Macbook only has a single physical port, it was running from batteries at the time, so I can't really suggest it was a ground loop problem.
 
The easy solution, of course, is to use a sacrificial hub to save your mobo ports, and is probably a recommended solution for USB development in any event!
#35
Timmons
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2018/02/07 01:09:23
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/02/05 05:49:48 (permalink)
0
I wanted to write to you after finally resolving the problem, for now I have solved but I still have a little problem.
 
However I used Wireshark to sniff USB packets, for example, for my usb mouse
 
substantially, in order:
 
  1. the host requires device description
  2. the device responds with the device description
  3. the host requires configuration description
  4. the device responds with only the configuration description
  5. the host requests the configuration description again, but expects a response that also includes interface description + endpoint + description
  6. The device responds with configuration + interface + endpoint description
  7. .......
 
So, I have modified the code from MisterSemi to match the upper sequence
 
Now, the remain problem, maybe timing problem, once on 3,4 time Windows notifie "unknow device"; otherwise, is correctly installed and ready to use
 
Note. I do not know if the upper sequence is valid only for Windows 7......
 
Francesco
 
 
#36
MisterHemi
Junior Member
  • Total Posts : 118
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: 0
  • Status: online
Re: HOW TO: PIC32MZ USB without Harmony 2019/02/05 08:51:55 (permalink)
0
Timmons
I wanted to write to you after finally resolving the problem, for now I have solved but I still have a little problem.
 
However I used Wireshark to sniff USB packets, for example, for my usb mouse
 
substantially, in order:
 
  1. the host requires device description
  2. the device responds with the device description
  3. the host requires configuration description
  4. the device responds with only the configuration description
  5. the host requests the configuration description again, but expects a response that also includes interface description + endpoint + description
  6. The device responds with configuration + interface + endpoint description
  7. .......
 
So, I have modified the code from MisterSemi to match the upper sequence
 
Now, the remain problem, maybe timing problem, once on 3,4 time Windows notifie "unknow device"; otherwise, is correctly installed and ready to use
 
Note. I do not know if the upper sequence is valid only for Windows 7......
 
Francesco
 
 




That's correct. The first time it ask for the configuration it usually only needs the first 8 bytes so it can get the buffer size for endpoint zero.

The next time it will request all of the descriptors, as you've noticed.

I thought it would request them one by one, not by requesting the configuration descriptor again and expecting all of the others too.... unless i'm missing something. I should check that.

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS High Sierra (10.13.3) and MPLAB X IDE v4.15
 
Curiosity PIC MZ EF, PIC24F Curiosity, and XPRESS EVAL BOARD (PIC16F18855).
#37
Timmons
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2018/02/07 01:09:23
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/02/05 11:30:29 (permalink)
0
 
You mentioned case 0x8000 was Windows requesting this?

 
Yes, I'm using a Franceschino Evaluation Board (Myself Made: Smile) and on "case 0x8000" I light a led on my board, so i am sure of that. Otherwise if I replay with status or not, it seems it no change very much.
 
Only a observation.....the length of endpoint description should be 7 , wMaxPacketSize is two byte
post edited by Timmons - 2019/02/05 11:39:25
#38
MisterHemi
Junior Member
  • Total Posts : 118
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: 0
  • Status: online
Re: HOW TO: PIC32MZ USB without Harmony 2019/02/05 13:27:02 (permalink)
0
Timmons
 
You mentioned case 0x8000 was Windows requesting this?

 
Yes, I'm using a Franceschino Evaluation Board (Myself Made: Smile) and on "case 0x8000" I light a led on my board, so i am sure of that. Otherwise if I replay with status or not, it seems it no change very much.
 
Only a observation.....the length of endpoint description should be 7 , wMaxPacketSize is two byte


Thanks! Smile: Smile

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS High Sierra (10.13.3) and MPLAB X IDE v4.15
 
Curiosity PIC MZ EF, PIC24F Curiosity, and XPRESS EVAL BOARD (PIC16F18855).
#39
AGL59
Starting Member
  • Total Posts : 32
  • Reward points : 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/02/08 16:38:20 (permalink)
0
Thank you !
I will try it for HID device on PIC32MM, even if I have already boards working well for some applications.
I'm a hardware guy, so this is software as I like. Harmony drives me crazzy. I wrote many applications with TCP/IP, web server, digital filtering... without Harmony, which is painfull for me.
Now, the dream would be same code but for host HID on PIC32MZ2048EFM144, as I'm unable to do same thing with Harmony. It was working with a PIC32MX570 and old stack... I will think about it, now I've seen it was possible to use USB without thousands of lines.
#40
Page: < 123 > Showing page 2 of 3
Jump to:
© 2019 APG vNext Commercial Version 4.5