• AVR Freaks

Helpful ReplyHot!HOW TO: PIC32MZ USB without Harmony

Page: << < ..6 Showing page 6 of 6
Author
Wavelength
Super Member
  • Total Posts : 305
  • Reward points : 0
  • Joined: 2012/08/13 08:33:08
  • Location: Cincinnati, Ohio USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/09/04 14:18:12 (permalink)
0
Mark,
I would look for a Linux based i.MX6ULL board and just do it through that. Going bare metal on ARM processors can be a pain.
There are some pretty cheap boards. Look at Toradex or some of the others.
Thanks,
Gordon
MisterHemi
Super Member
  • Total Posts : 302
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/09/04 14:28:44 (permalink)
0
Thanks Gordon,
 
I prefer bare metal but am considering using an OS. If I remember correctly there is a Real Time version of Linux which may be worth looking into - Linux, RTOS, NuttOS, etc are some options/possibilities.
 
Thanks,
Mark

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.
Wavelength
Super Member
  • Total Posts : 305
  • Reward points : 0
  • Joined: 2012/08/13 08:33:08
  • Location: Cincinnati, Ohio USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/09/06 10:24:29 (permalink)
0
Mark,
Bare metal is going to get you where you want to be. But with these larger processors even the pre-processor setup stuff can really throw you for a loop.
If you want a head start I have a i.MX6ULL dev board here from NXP if you want it PM me your address and I will send it to you. I have like freaken 100's of dev boards here that I have used and put on a shelf.
Thanks,
Gordon
MisterHemi
Super Member
  • Total Posts : 302
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/09/06 12:00:01 (permalink)
0
Wavelength
Mark,
Bare metal is going to get you where you want to be. But with these larger processors even the pre-processor setup stuff can really throw you for a loop.
If you want a head start I have a i.MX6ULL dev board here from NXP if you want it PM me your address and I will send it to you. I have like freaken 100's of dev boards here that I have used and put on a shelf.
Thanks,
Gordon




Absolutely! THANK YOU!

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.
MisterHemi
Super Member
  • Total Posts : 302
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/09/08 22:26:08 (permalink)
0
Wavelength
Mark,
Bare metal is going to get you where you want to be. But with these larger processors even the pre-processor setup stuff can really throw you for a loop.
If you want a head start I have a i.MX6ULL dev board here from NXP if you want it PM me your address and I will send it to you. I have like freaken 100's of dev boards here that I have used and put on a shelf.
Thanks,
Gordon




PM sent.

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.
MisterHemi
Super Member
  • Total Posts : 302
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/09/10 08:57:55 (permalink)
0
Update added, see first post.
 
How to use the USB DMA is explained in the update.

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.
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/09/17 12:52:35 (permalink)
0
Wavelength
MisterHemi,
 
I stopped working on the MZ USB Audio about a year ago. The USB HS stuff was actually pretty easy. The I2S stuff was totally screwed up. The example code given in the harmony folder for mac high speed scared me about a month in when it had a comment in the startup section about forcing the word clock to a specific high or low and restarting the I2S a boat load of times and some comment stating this was the only way I could make it work. I later found out that was the senior engineer in charge of that project. He no longer works at Microchip.
 
It seems if you set the sample rate and leave it there and let the OS resample to whatever that rate you have the default then the MZ works fine. But if you change the sample rate using apps that do that like Roon, Audirvana, Bit Perfect, Pure Music ect.... then the word clock line in the I2S drifts and of course you get goobled output. One company I know has this working with SPI dac chips but it took them 3 years to do that. Another company claimed to have it working and I said try this, they did and that product got pulled.
 
There was someone on the boards here who had rewritten the I2S code from scratch and had that working really well and was going to add in the USB code and the buffering. I haven't heard from him in a year so I don't know how that went. I have a couple 100K dacs running on PIC32MX270, 274, 470 parts in all configurations without issues. The MZ was the worst year of my life and I had already done the XMOS stuff from scratch like 10 years before that.
 
Anyway, just a word of warning.
 
Thanks,
Gordon




Hi Gordon,
 
If you have "Curiosity 2.0 PIC32 MZ EF Board" I can send you my impelmentation of USB Audio 2.0 on PIC32MZ.
(Hex file without source code)
I think the main problem with Microchip Demo Code is Harmony bugs not the hardware.
My project is based on PLIBs.
 
Configuration:
- extarnal oscillator 12MHZ
- DAC on I2S1
- I2S clock generated by internal PLL
- LEDs for sampling frequency identification
- VID PID - Microchip Demo or XMOS
 
Regards,
JarekC
MisterHemi
Super Member
  • Total Posts : 302
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/09/17 15:35:04 (permalink)
0
JarekC
Wavelength
MisterHemi,
 
I stopped working on the MZ USB Audio about a year ago. The USB HS stuff was actually pretty easy. The I2S stuff was totally screwed up. The example code given in the harmony folder for mac high speed scared me about a month in when it had a comment in the startup section about forcing the word clock to a specific high or low and restarting the I2S a boat load of times and some comment stating this was the only way I could make it work. I later found out that was the senior engineer in charge of that project. He no longer works at Microchip.
 
It seems if you set the sample rate and leave it there and let the OS resample to whatever that rate you have the default then the MZ works fine. But if you change the sample rate using apps that do that like Roon, Audirvana, Bit Perfect, Pure Music ect.... then the word clock line in the I2S drifts and of course you get goobled output. One company I know has this working with SPI dac chips but it took them 3 years to do that. Another company claimed to have it working and I said try this, they did and that product got pulled.
 
There was someone on the boards here who had rewritten the I2S code from scratch and had that working really well and was going to add in the USB code and the buffering. I haven't heard from him in a year so I don't know how that went. I have a couple 100K dacs running on PIC32MX270, 274, 470 parts in all configurations without issues. The MZ was the worst year of my life and I had already done the XMOS stuff from scratch like 10 years before that.
 
Anyway, just a word of warning.
 
Thanks,
Gordon




Hi Gordon,
 
If you have "Curiosity 2.0 PIC32 MZ EF Board" I can send you my impelmentation of USB Audio 2.0 on PIC32MZ.
(Hex file without source code)
I think the main problem with Microchip Demo Code is Harmony bugs not the hardware.
My project is based on PLIBs.
 
Configuration:
- extarnal oscillator 12MHZ
- DAC on I2S1
- I2S clock generated by internal PLL
- LEDs for sampling frequency identification
- VID PID - Microchip Demo or XMOS
 
Regards,
JarekC




I also managed to get I2S to send data but haven't been able to test it yet, I can only view it on my oscilloscope.
I was planning to use an external clock but it's having some problems.
 
I also got the USB DMA to work.

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.
GerhardJL
Starting Member
  • Total Posts : 54
  • Reward points : 0
  • Joined: 2009/12/08 03:09:46
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/10/17 09:38:21 (permalink)
0
Good day,
mchp proc : PIC32MZ2048EFM100 on my own custom application board, not a a mchp dev panel like curiosity.
Target application is to create (device) dual_cdc_usb>>uart serial converter for 2 uarts U1&u3
I am starting this journey with  MisterHemi's 2 usb implementation (mz2048efm100) basic & basic_cdc  (thank you for sharing) as reference to getting started -
I have a few questions since I can't get any of the two applications to enumerate on host.
Can you please comment -
What is the target board for the 2 applications
I have compiled both 'out of the box', the host does not detect the usb therefor fails to enumerate.
Are both the applications meant to compile, execute and numerate on host? (provided inf is on host)
 
Ultimately, I would like to use Harmony3 to do this.
 
I had a look a mchp's harmony3 examples,
 but the reference is for the MZ2048EFM144. 
I have attempted to modify the examples to EFM100, but I am probably doing something wrong,
since it does not seems to work, meaning, as device, it fails to enumerate on host.
 
Are there anyone who have done similar and is prepared to share example code snippets,
pointers or basic example project to demo usb (cdc_acm) implementation on a MZ2048EFM100 proc
 
Thank you for your feedback -
 
 
 
MisterHemi
Super Member
  • Total Posts : 302
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/10/17 18:42:47 (permalink)
0
GerhardJL
Good day,
mchp proc : PIC32MZ2048EFM100 on my own custom application board, not a a mchp dev panel like curiosity.
Target application is to create (device) dual_cdc_usb>>uart serial converter for 2 uarts U1&u3
I am starting this journey with  MisterHemi's 2 usb implementation (mz2048efm100) basic & basic_cdc  (thank you for sharing) as reference to getting started -
I have a few questions since I can't get any of the two applications to enumerate on host.
Can you please comment -
What is the target board for the 2 applications
I have compiled both 'out of the box', the host does not detect the usb therefor fails to enumerate.
Are both the applications meant to compile, execute and numerate on host? (provided inf is on host)
 
Ultimately, I would like to use Harmony3 to do this.
 
I had a look a mchp's harmony3 examples,
 but the reference is for the MZ2048EFM144. 
I have attempted to modify the examples to EFM100, but I am probably doing something wrong,
since it does not seems to work, meaning, as device, it fails to enumerate on host.
 
Are there anyone who have done similar and is prepared to share example code snippets,
pointers or basic example project to demo usb (cdc_acm) implementation on a MZ2048EFM100 proc
 
Thank you for your feedback -
 
 
 




Hi Gerhard,
 
I got your message, it's no problem. I thought i'd answer here in case anyone else has the same questions later.
 
My code was originally for the Curiosity PIC32MZEF Development board version 1 and later version 2.
 
You would only need to make a few small changes I think to make it run on your own board.
 
Also, since you're using your own board... be aware that to use USB on the PIC32MZ your clock needs to be 24MHz in order for PIC to generate the correct clock rate for USB.
 
I'll take a look at the data sheet then look at my code and try to see if there's any major differences.

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.
GerhardJL
Starting Member
  • Total Posts : 54
  • Reward points : 0
  • Joined: 2009/12/08 03:09:46
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/10/18 03:35:41 (permalink)
0
Hi Mark,
Thank you for your feedback -

Just to confirm -
my target proc - PIC32MZ2048EFM100   Xtal =24Mhz  (attachments hw refr)
USBID = no connect, open
USB mode : device
The usb hw connectivity - I have a choice to connect to a pc Win10 platform,
 but in my target application, the EFM100 will connect to a linux proc nxp i.mx6dull SOM

I would like to create a dual cdc usb >> serial convert  er iow dual cdc_usb <> procc local uarts U1,U3

Ultimately, I would like to use Harmony3 framework for this, however, having tried it, found the examples
all for SAM and EFM144.

As mentioned, I came upon your implementation, w/o Harmony, which on my end fail to
be recognized by host and enumerate.  (on Win10 and linux) and was hoping that you
can provide some pointers/and/or snippets for me to consider.
 
I found reference to, I assume an older (1st gen?), curiosity module, populated with MZ2048EFM100,
for which there was a cdc_com_port_dual example, I guess based on harmony2? FW.  Which has now been supercede
by Harmony3, with, as mentioned above,  which refers to Curiosity 2 with EFM144 populated or SAM eva modules
The mchp link to this demo in attached wlink.txt
 
Is there a a way one can request the 'older' demo?

Thank you for your valuable feedback.

Gerhard
 
post edited by GerhardJL - 2020/10/18 04:16:14

Attached Image(s)

MisterHemi
Super Member
  • Total Posts : 302
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/10/18 09:46:11 (permalink)
0
Ok, you will also need to connect VBUS. This is how the USB module in the PIC detects when it's connected to the USB bus.
 
In my code, as per the USB specs, VBUS MUST be detected before the USB module is enabled which connects the resistors (international's to the USB module) to the bus.
 
To clarify the VBUS must be detected before the pull up/down resistors are attached to the DP and DM lines.
 
Those resistors are how the host determines if the device is Full Speed, High Speed, etc.

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.
MisterHemi
Super Member
  • Total Posts : 302
  • Reward points : 0
  • Joined: 2017/11/02 12:24:21
  • Location: Commerce, CA USA
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/10/18 09:56:04 (permalink)
0
Also since you're not using the USBID pin be sure you use an internal pull-up resistor so that the USB module knows it's operating as a device (not as a host) rather than leaving it floating.
 
I do believe you can set it in your code but I always connect it or use a pull up resistor (to indicate device mode).

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.
vexorg
Senior Member
  • Total Posts : 156
  • Reward points : 0
  • Joined: 2019/09/27 10:59:40
  • Location: 0
  • Status: offline
Re: HOW TO: PIC32MZ USB without Harmony 2020/10/18 11:00:45 (permalink)
0
You dont need Vbus or USBID with connections on them, they are only software to determine the state of the usb connection. USBID can be set just by enabling the pullup/pulldown on the port pin. Vbus goes to a comparitor that sets flags for the Vbus voltage on the line.
 
As said in your other thread, it depends on what you are doing, and better just to keep it all in one clean thread for your stuff. Vbus should be switchable and powers the USB of the device atached, and should really have overcurrent monitoring.
Page: << < ..6 Showing page 6 of 6
Jump to:
© 2020 APG vNext Commercial Version 4.5