• AVR Freaks

Helpful ReplyHot!HOW TO: PIC32MZ USB without Harmony

Page: < 12345.. > >> Showing page 4 of 6
Author
TimmonsNew
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2019/10/17 23:15:15
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/10/25 01:46:42 (permalink)
0
Good Morning Everybody
 
Unlikely, I changed my work but my registration e-mail, for this forum was, the one of work and I did not see the updating for this post. I'm Timmons.
 
I stopped for some month my developing un Pic32 USB and I only start again in the last weeks
 
I Reach the followings target on Windows 10
  1. Right Enumeration for USB Device implemented on pic32mz2048efh144
  2. Right Receive on EP1 USB Messages sent by PC (HOST)
  3. Right Send by EP2 messages to PC (Host)
If someone had some issues for above task can ask me (If I am able to reply :)) 
 
#61
ric
Super Member
  • Total Posts : 28390
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: HOW TO: PIC32MZ USB without Harmony 2019/10/25 15:05:44 (permalink)
0
MisterHemi
I attempted to edit the first post and add this to it but the forum won't allow it.... annoying!
It often says "you don't have permission".
 ...

 
That is because of the live link towards the end of the post
See: How to avoid errors when editing posts
 

I wish they would FIX it!

Unfortunately the forum admin does not have the power or knowledge to fix problems with the web server.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#62
MisterHemi
Super Member
  • Total Posts : 293
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2019/10/26 07:27:06 (permalink)
0
ric
MisterHemi
I attempted to edit the first post and add this to it but the forum won't allow it.... annoying!
It often says "you don't have permission".
 ...

 
That is because of the live link towards the end of the post
See: How to avoid errors when editing posts 
 

I wish they would FIX it!

Unfortunately the forum admin does not have the power or knowledge to fix problems with the web server.
 




I recently saw that... some work arounds did work but i've still had a some problems.
 
At the moment i'm working on USB audio and slowly getting parts of it to work though not the entirety of it yet.
 

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS Mojave (10.14.6) and MPLAB X IDE v5.30
 
Curiosity PIC32MZ EF 1 & 2, PIC24F Curiosity, XPRESS EVAL BOARD (PIC16F18855), SAMA5D3 Xplained and various custom boards.
#63
MisterHemi
Super Member
  • Total Posts : 293
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/01/19 22:45:01 (permalink)
5 (1)
Just an update... I have a Basic USB Audio Speaker example however it's 216KB and the forum has a limit of 200KB.
 
I'll have to find another way to post it if anyone is interested.
 
Read my updates in the very first post!
 
EDITED TO ADD: I have uploaded the project to Github, i'll post the link in the first post.
post edited by MisterHemi - 2020/01/19 22:51:06

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS Mojave (10.14.6) and MPLAB X IDE v5.30
 
Curiosity PIC32MZ EF 1 & 2, PIC24F Curiosity, XPRESS EVAL BOARD (PIC16F18855), SAMA5D3 Xplained and various custom boards.
#64
JarekC
Starting Member
  • Total Posts : 32
  • Reward points : 0
  • Joined: 2016/10/20 07:06:52
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/01/20 12:40:26 (permalink)
0
Hi,
Why you don't initialize register USBFIFOA (USB FIFO Address)?
#65
MisterHemi
Super Member
  • Total Posts : 293
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/01/20 13:42:52 (permalink)
0
JarekC
Hi,
Why you don't initialize register USBFIFOA (USB FIFO Address)?


 
I forget if there was a specific reason but I believe it defaults to 0x000
 

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS Mojave (10.14.6) and MPLAB X IDE v5.30
 
Curiosity PIC32MZ EF 1 & 2, PIC24F Curiosity, XPRESS EVAL BOARD (PIC16F18855), SAMA5D3 Xplained and various custom boards.
#66
JarekC
Starting Member
  • Total Posts : 32
  • Reward points : 0
  • Joined: 2016/10/20 07:06:52
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/01/20 13:47:27 (permalink)
0
But you have all FIFOs buffers in the same place in the dedicated USB RAM (9kB)
#67
MisterHemi
Super Member
  • Total Posts : 293
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/01/20 21:15:19 (permalink)
0
JarekC
But you have all FIFOs buffers in the same place in the dedicated USB RAM (9kB)




I would assume if they're dynamically allocated (USBE0CSR3bits.DYNFIFOS = 1) that would take care of that.
 
In previous versions I did assign addresses (see below) but upon trying the Dynamic FIFO option I didn't see any difference and didn't have any problems.
 
Here's how I assigned them before, this is from a previous but different project:

USBCSR3bits.ENDPOINT = 1;
USBFIFOAbits.TXFIFOAD = 0x0040; // Transmit Endpoint FIFO Address bits (64 dec.)

USBCSR3bits.ENDPOINT = 2;
USBFIFOAbits.RXFIFOAD = 0x0440; // Receive Endpoint FIFO Address bits (1088 dec.)

USBCSR3bits.ENDPOINT = 3;
USBFIFOAbits.RXFIFOAD = 0x0840; // Transmit Endpoint FIFO Address bits (2112 dec.)

USBCSR3bits.ENDPOINT = 4;
USBFIFOAbits.TXFIFOAD = 0x0A40; // Receive Endpoint FIFO Address bits (2624 dec.)

USBCSR3bits.ENDPOINT = 5;
USBFIFOAbits.RXFIFOAD = 0x0A48; // Transmit Endpoint FIFO Address bits (2632 dec.)

USBCSR3bits.ENDPOINT = 6;
USBFIFOAbits.TXFIFOAD = 0x0A50; // Transmit Endpoint FIFO Address bits (2640 dec.)

 
I can only say it seems to work fine but if a problem arises feedback would be appreciated.

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS Mojave (10.14.6) and MPLAB X IDE v5.30
 
Curiosity PIC32MZ EF 1 & 2, PIC24F Curiosity, XPRESS EVAL BOARD (PIC16F18855), SAMA5D3 Xplained and various custom boards.
#68
MisterHemi
Super Member
  • Total Posts : 293
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/01/21 20:34:24 (permalink)
5 (1)
If anyone tries the USB Audio Speaker project let me know and let me know if it's working fine fine you.
 
If you haven't seen the project I posted a link to the Github archive in the very first post. It was too big to upload here, there is a size limit of 200KB and the audio project is 216KB.

If you happen to get the USB DMA working please share that here too. 
I may try it again soon when I have a bit more time.

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS Mojave (10.14.6) and MPLAB X IDE v5.30
 
Curiosity PIC32MZ EF 1 & 2, PIC24F Curiosity, XPRESS EVAL BOARD (PIC16F18855), SAMA5D3 Xplained and various custom boards.
#69
willysjeeps
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2020/03/19 16:27:14
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/03/23 14:17:42 (permalink)
0
Hi all -
I'm a hardware designer by trade and can manage the typical 'Hello World', run timers, grab ADC counts and LED toggling level of coding, just for board bring up mind you.
 
I thought I'd take some time and learn a little about how USB works while locked at home away from the rest of the world.  I have a "Curiosity PIC32 MZ EF" dev system.  I struggled with Harmony 3 for about 10 days before I figured out to search for a basic tutorial which landed me here.  Thank you BTW.
 
I downloaded all three projects.  I started with the basic app.  It complied out of the gate and ran, which is more than I can say for any Microchip example on Harmony 3.  Again, thanks, it's pretty straightforward, even for me.  I even made a few changes and it stilled worked!
 
So I moved on to the CDC ACM example, same hardware, same USB port.  And that's where I got stuck :(.  I compiled the downloaded files and got nothing.  Well, slightly more than nothing.  My windows 10 machine reports that I now have an "Unknown USB Device (Device Descriptor Request Failed)".  I threw in a set pin command and turned on the green led in controlTrans() -> case 0x8001 -> case 0x01, before the break so I know if gets at least that far.  I'm not sure where to go from here.  Any thoughts or ideas?
 
case 0x8006:{   // Get Descriptor(s)  
            switch (ep0data[3]) {
                case 0x00: { // Undefined
                    USBE0CSR0bits.STALL = 1;
                    led_4b = 0;
                }
                break;
                
                case 0x01: { // Device Descriptor
                        
                        //led_4r = 0;
                        ep0BlockData = dev_desc;
                        txBlock_ep0(sizeof(dev_desc));
                    }
                    led_4g=0;                   
break;

#70
MisterHemi
Super Member
  • Total Posts : 293
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/03/26 15:43:02 (permalink)
0
willysjeeps
Hi all -
I'm a hardware designer by trade and can manage the typical 'Hello World', run timers, grab ADC counts and LED toggling level of coding, just for board bring up mind you.
 
I thought I'd take some time and learn a little about how USB works while locked at home away from the rest of the world.  I have a "Curiosity PIC32 MZ EF" dev system.  I struggled with Harmony 3 for about 10 days before I figured out to search for a basic tutorial which landed me here.  Thank you BTW.
 
I downloaded all three projects.  I started with the basic app.  It complied out of the gate and ran, which is more than I can say for any Microchip example on Harmony 3.  Again, thanks, it's pretty straightforward, even for me.  I even made a few changes and it stilled worked!
 
So I moved on to the CDC ACM example, same hardware, same USB port.  And that's where I got stuck :(.  I compiled the downloaded files and got nothing.  Well, slightly more than nothing.  My windows 10 machine reports that I now have an "Unknown USB Device (Device Descriptor Request Failed)".  I threw in a set pin command and turned on the green led in controlTrans() -> case 0x8001 -> case 0x01, before the break so I know if gets at least that far.  I'm not sure where to go from here.  Any thoughts or ideas?
 
case 0x8006:{   // Get Descriptor(s)  
            switch (ep0data[3]) {
                case 0x00: { // Undefined
                    USBE0CSR0bits.STALL = 1;
                    led_4b = 0;
                }
                break;
                
                case 0x01: { // Device Descriptor
                        
                        //led_4r = 0;
                        ep0BlockData = dev_desc;
                        txBlock_ep0(sizeof(dev_desc));
                    }
                    led_4g=0;                   
break;





Did you make any other changes to case 8006?
 
From the error message you posted it seems Windows didn't get the Device Descriptor but did get the Configuration Descriptor since it recognizes there's a device attached.

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS Mojave (10.14.6) and MPLAB X IDE v5.30
 
Curiosity PIC32MZ EF 1 & 2, PIC24F Curiosity, XPRESS EVAL BOARD (PIC16F18855), SAMA5D3 Xplained and various custom boards.
#71
willysjeeps
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2020/03/19 16:27:14
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/03/26 20:07:58 (permalink)
0
I added led on/off to other areas of the code to try and track down where I'm broken.  I identified this as the farthest I could get. So yes, it does get on the bus.  It doesn't make it to any category like comm port or HID or its own thing (like the basic example does).  It shows up under "Universal Serial Bus Controllers".  If I look at the properties (right click) -> details (tab) -> any of the Property drop down items are blank or say DEVICE_DESCRIPTOR_FAILURE.
 
 
#72
MisterHemi
Super Member
  • Total Posts : 293
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/03/27 02:06:35 (permalink)
0
willysjeeps
I added led on/off to other areas of the code to try and track down where I'm broken.  I identified this as the farthest I could get. So yes, it does get on the bus.  It doesn't make it to any category like comm port or HID or its own thing (like the basic example does).  It shows up under "Universal Serial Bus Controllers".  If I look at the properties (right click) -> details (tab) -> any of the Property drop down items are blank or say DEVICE_DESCRIPTOR_FAILURE.
 
 




Did you make any changes to the Device Descriptor or Configuration Descriptor?
 
I've had many instances where I made simple edits to the Configuration Descriptor and it has cause many problems. It seems simple but easy to introduce errors.
 
Maybe try using the original descriptors and see what Windows reports. Even if the wrong descriptors are used (e.g.- USB MIDI versus USB CDC) it'll show a working device though it's not really correct but it can be used for testing - swapping a "known good" for (a) suspected bad descriptor(s).
It just won't actually work until the correct type of descriptors are used later.

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS Mojave (10.14.6) and MPLAB X IDE v5.30
 
Curiosity PIC32MZ EF 1 & 2, PIC24F Curiosity, XPRESS EVAL BOARD (PIC16F18855), SAMA5D3 Xplained and various custom boards.
#73
willysjeeps
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2020/03/19 16:27:14
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/03/29 09:53:27 (permalink)
0
Hi MisterHemi -
 
Thanks again for the help.
 
No, I did not make changes to the Device Descriptor or Configuration Descriptor. 
 
I downloaded a fresh copy of the _CDC_ACM project, compiled it, load it and get the same results.  All of the properties -> details ->properties are missing.  And just to make sure there isn't something (ESD) wrong with my port, I loaded the _BASIC demo and it comes up with properties filled in.
 
I then took the _BSAIC and compiler it with Microchip settings for Vendorid and Productid and that puts the _BASIC into the "Ports" as an unused comm (where I'd like to see it!).  Then it doesn't seem to matter what the "Product Name" or "Vendor Name" is set to, it just knows its Microchip.  Of course the device has the yellow '!' and cannot start error #10 since it has no backing code to run.
 
It's got to be user error with the _CDC_ACM project.  I'm just not figuring out where, right?
#74
MisterHemi
Super Member
  • Total Posts : 293
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/03/29 11:52:35 (permalink)
0
willysjeeps
Hi MisterHemi -
 
Thanks again for the help.
 
No, I did not make changes to the Device Descriptor or Configuration Descriptor. 
 
I downloaded a fresh copy of the _CDC_ACM project, compiled it, load it and get the same results.  All of the properties -> details ->properties are missing.  And just to make sure there isn't something (ESD) wrong with my port, I loaded the _BASIC demo and it comes up with properties filled in.
 
I then took the _BSAIC and compiler it with Microchip settings for Vendorid and Productid and that puts the _BASIC into the "Ports" as an unused comm (where I'd like to see it!).  Then it doesn't seem to matter what the "Product Name" or "Vendor Name" is set to, it just knows its Microchip.  Of course the device has the yellow '!' and cannot start error #10 since it has no backing code to run.
 
It's got to be user error with the _CDC_ACM project.  I'm just not figuring out where, right?




Ok just to be sure I remember correctly, you're using Windows 10?
 
There was another person that had a problem while running an earlier version of Windows, I believe Windows 7.
Someone had mentioned that it was necessary to create an .ino file (if I remember correctly) because the earlier versions of Windows needed that to identify the device but it's supposedly not necessary for Windows 10.
 
 

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS Mojave (10.14.6) and MPLAB X IDE v5.30
 
Curiosity PIC32MZ EF 1 & 2, PIC24F Curiosity, XPRESS EVAL BOARD (PIC16F18855), SAMA5D3 Xplained and various custom boards.
#75
ric
Super Member
  • Total Posts : 28390
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: HOW TO: PIC32MZ USB without Harmony 2020/03/29 12:16:44 (permalink) ☄ Helpfulby willysjeeps 2020/03/29 16:06:33
5 (1)
MisterHemi
Someone had mentioned that it was necessary to create an .ino file (if I remember correctly) because the earlier versions of Windows needed that to identify the device but it's supposedly not necessary for Windows 10.

"ino" -> "inf"
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#76
willysjeeps
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2020/03/19 16:27:14
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/03/29 15:58:57 (permalink)
0
inf -> ;)
 
Yeah, windows 10 here. 
#77
willysjeeps
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2020/03/19 16:27:14
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/03/29 16:06:24 (permalink)
0
Francesco /Timmons mentioned a wMaxPacketSize of 7 but I don't see here that is (that's a couple pages back).  Unfortunately he never posted his fixes.
#78
MisterHemi
Super Member
  • Total Posts : 293
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/03/30 17:52:20 (permalink)
0
TimmonsNew
Good Morning Everybody
 
Unlikely, I changed my work but my registration e-mail, for this forum was, the one of work and I did not see the updating for this post. I'm Timmons.
 
I stopped for some month my developing un Pic32 USB and I only start again in the last weeks
 
I Reach the followings target on Windows 10
  1. Right Enumeration for USB Device implemented on pic32mz2048efh144
  2. Right Receive on EP1 USB Messages sent by PC (HOST)
  3. Right Send by EP2 messages to PC (Host)
If someone had some issues for above task can ask me (If I am able to reply :)) 
 




Hi Timmons,
 
Maybe you can answer WillysJeeps question. See the above posts. Hopefully you'll get a notification.

My configuration:
MacBook Pro (Retina, 15-inch, Mid 2015) with MacOS Mojave (10.14.6) and MPLAB X IDE v5.30
 
Curiosity PIC32MZ EF 1 & 2, PIC24F Curiosity, XPRESS EVAL BOARD (PIC16F18855), SAMA5D3 Xplained and various custom boards.
#79
kalunga
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2011/01/18 12:40:49
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/05/07 16:17:59 (permalink)
0
Hi everybody.
 
I have here a Curiosity PIC32MZ EF board, and I was trying to use it for my personal projects. One problem I had was with the USB, because I always thought that Harmony was too dificult to handle... So, searching for an alternative, I've found this thread, and I have to thank the author for all the efforts.
At first, I have also the problem as willysjeeps: "Unknown USB Device (Device Descriptor Request Failed)". So I decided to investigate what was happening. While doing this, I've found also some issues that I have to ask if they are meant to be so, or not.
 
Well, first things first. The problem of failed descriptor was caused by a mismatch between the bMaxPacketSize0 field in the Device Descriptor (you set it to 8) and the EP0 buffer size that you defined, as the code has:

/* USB related values */
#define EP0BUFFSIZE 8 // In multiples of 8, e.g.- 8 (x8) equals a size of 64
#define EP1TXBUFFSIZE 2 // Also in multiples of 8, e.g.- 1 (x8) equals a size of 8
#define EP2TXBUFFSIZE 8 // Also in multiples of 8, e.g.- 8 (x8) equals a size of 64
#define EP3RXBUFFSIZE 8 // Also in multiples of 8, e.g.- 8 (x8) equals a size of 64
#define EP0_MAX_PACKET_SIZE (EP0BUFFSIZE * 8)
#define EP1_MAX_PACKET_SIZE (EP1TXBUFFSIZE * 8)
#define EP2_MAX_PACKET_SIZE (EP2TXBUFFSIZE * 8)
#define EP3_MAX_PACKET_SIZE (EP3RXBUFFSIZE * 8)
#define VBUS_VALID 0x3

 
I Just defined bMaxPacketSize0 as 64 (as the Basic example you wrote has) or defined EP0BUFFSIZE as 1, and my device is numerated correctly.
 
Found other points that I have to ask. For example, in the basic example, you re-enable the EP0 interrupt inside the USB reset interrupt, along with other Endpoint interrupts. But in the CDC example, you aren't doing this... It is not necessary?
The case 0x8006 inside controlTrans function doesn't have a break statement at its end, making the next case (case 0x810A) being also executed...
Finally, in some cases, you have, for example, written:

ep0BlockData = &usbConfiguration;
txBlock_ep0(sizeof(ep0BlockData));

But, doing this way, aren't you taking the pointer size rather than the structure size? The correct wouldn't be:

ep0BlockData = &usbConfiguration;
txBlock_ep0(sizeof(usbConfiguration));

 
Thank you again, and I hope that what I wrote here can help to make this project better.
 
#80
Page: < 12345.. > >> Showing page 4 of 6
Jump to:
© 2020 APG vNext Commercial Version 4.5