Helpful ReplyHot!USB Bootloader works with some USB sticks but not others

Author
AHancock
Junior Member
  • Total Posts : 70
  • Reward points : 0
  • Joined: 2016/02/23 15:10:25
  • Location: Virginia, USA
  • Status: offline
2018/03/23 11:32:55 (permalink)
0

USB Bootloader works with some USB sticks but not others

Background: Harmony 2.05, XC32 2.05, MPLABX 4.10, PIC32MZ2048EFH144
 
The previous version of our CPU card uses a PIC32MX695 and MLA.  It uses a boot loader to load applications through USB.  It works with just about any USB 2.0 stick.  The MX695 was limited to FULL_SPEED.
 
Our new PIC32MZ CPU card (using Harmony) boot loader works great with slower (but still 2.0) USB sticks, but not with faster ones.  By slow and fast I mean ones that I ran a PC benchmark on.  Of the 5 I have sitting on my table, 2 benchmark at about 4MB/s writing and about 26 MB/s reading, these are detected by the boot loader.  Three others write at about 7MB/s writing and read again at about 26MB/s, these are not detected.  Of course, the boot loader is not writing anything to the stick, just reading.
 
I understand that USB 2.0 HIGH_SPEED is 480Mbps and the best one can hope for is about 30MB/s throughput.  That accounts for the 26MB/s read speed.
 
The much slower write speed must then be limited by the stick's internal flash write speed - and that makes sense.
 
What I am trying to understand it why the "faster writing" sticks are not detected.
 
Any ideas?
#1
AHancock
Junior Member
  • Total Posts : 70
  • Reward points : 0
  • Joined: 2016/02/23 15:10:25
  • Location: Virginia, USA
  • Status: offline
Re: USB Bootloader works with some USB sticks but not others 2018/03/23 14:12:33 (permalink)
0
One of our engineers dug out an email from 2010 (before my time here), where they were having similar issues.  Microchip would have them send in a USB stick that was not working and they would tweak the USB stack.
 
I hope we have moved (well) past that by now. 
#2
Larry.Standage
Moderator
  • Total Posts : 803
  • Reward points : 0
  • Joined: 2011/12/30 09:50:47
  • Location: 0
  • Status: offline
Re: USB Bootloader works with some USB sticks but not others 2018/03/23 14:12:56 (permalink)
0
Have you normalized the hex file? I just tried it on a thumb drive with 21.8MB/s writing, and 25.27MB/s reading, and it didn't work until the hex file was normalized.
 
In MPLAB X, the project properties for the configuration has a page called "Building". At the bottom of the page is "Normalize hex file". That's required for the bootloader to do quad-word writing. Otherwise, if a function is broken across a quad word, then the bootloader can't write the entire word.
#3
AHancock
Junior Member
  • Total Posts : 70
  • Reward points : 0
  • Joined: 2016/02/23 15:10:25
  • Location: Virginia, USA
  • Status: offline
Re: USB Bootloader works with some USB sticks but not others 2018/03/23 14:39:47 (permalink)
0
I didn't have normalize checked on either the boot loader or application(s) project files, but I don't think that is the issue.  The boot loader runs (therefore go flashed correctly), it just doesn't recognize some flash drives.
 
I checked the normalized boxes and ran it again with no difference.
#4
Paul PortSol
Super Member
  • Total Posts : 251
  • Reward points : 0
  • Joined: 2015/07/03 11:52:03
  • Location: 0
  • Status: offline
Re: USB Bootloader works with some USB sticks but not others 2018/03/26 07:44:28 (permalink)
0
a) Does your USB circuit have a large enough Capacitor on the VBUS?
Some Microchip boards required up to 100uF, some may need to be modified to add the cap.
I put in a 150uF 6V cap and my USB has been much better.
Also a parallel decoupling cap.
Some sticks make a large power hit at startup, especially larger faster ones.
 
b) Is your heap large enough? 
I haven't seen any answers to proper heap size calculation.
I had issues when I used heap of 500 like in some posts and examples, 
especially when remove and insert USB stick it would be recognized.
I had plenty of RAM so set heap to 10000 and haven't had an issue since.
 
I still have an open ticket asking for method to calculate appropriate Heap size for Harmony.
 
Paul
#5
AHancock
Junior Member
  • Total Posts : 70
  • Reward points : 0
  • Joined: 2016/02/23 15:10:25
  • Location: Virginia, USA
  • Status: offline
Re: USB Bootloader works with some USB sticks but not others 2018/03/26 08:30:07 (permalink)
0
I have a 330 uF 16V cap on VBUS with a 0.1 uF parallel cap.  A good point, but it looks like I am covered there.
 
I do have a question I need to run passed our hardware people - we have a TPD2E001 ESD diode array across the D+/D- pins, which is nothing unusual, but the 'decoupling' cap on that part is 10 uF, where the documentation says 0.1 uF. 
 
My heap is 64K.
#6
Paul PortSol
Super Member
  • Total Posts : 251
  • Reward points : 0
  • Joined: 2015/07/03 11:52:03
  • Location: 0
  • Status: offline
Re: USB Bootloader works with some USB sticks but not others 2018/03/28 11:10:00 (permalink)
0
 
10uF won't filter high frequency noise as well since its ESR is much higher than 0.1uF
You see parallel small and big caps as the small ones for high freq have small ESR and fast response, and the medium and big ones fill in the lower frequency bands. 11.1uF replaces 10uF+1uF+0.1uF only in theory, not in real life.
Best = both caps, though the 330uF may mean no need for the 10uF. 
i.e. 330uF + 0.1uF may be enough.
150uF 6V + 0.1uF may save significant cost.
The 330uF 16V may not be 330uF at USB 5V, check caps spec.
Careful of life of electrolytics, ceramics can be more stable over long product life.
 
Paul
 
#7
jiggoly
Junior Member
  • Total Posts : 89
  • Reward points : 0
  • Joined: 2016/01/19 15:02:48
  • Location: Spain
  • Status: offline
Re: USB Bootloader works with some USB sticks but not others 2018/04/02 11:37:11 (permalink)
0
Hi, one thing... did you measure the voltage at usb pins? under 4.6 Volts usb sticks connects and disconnects ramdomly.
#8
ArmstrongSubero
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2014/08/01 09:33:23
  • Location: 0
  • Status: offline
Re: USB Bootloader works with some USB sticks but not others 2018/04/02 17:00:32 (permalink)
0
Yay! I'm not alone, I hope you find a solution to your problem, I'm using the PIC32MX270F256D and getting a similar problem, I'm thinking about digging back out the old PLIB libraries, don't think that's an option with the PIC32MZ, I was thinking of shipping a thumb drive with my product to get around that problem. Smile: Smile
 
 
#9
NKurzman
A Guy on the Net
  • Total Posts : 15731
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: USB Bootloader works with some USB sticks but not others 2018/04/02 17:04:23 (permalink)
0
Any specific Brands  or models that have this issue?  
I am not seeing it in Harmony V1.11
#10
AHancock
Junior Member
  • Total Posts : 70
  • Reward points : 0
  • Joined: 2016/02/23 15:10:25
  • Location: Virginia, USA
  • Status: offline
Re: USB Bootloader works with some USB sticks but not others 2018/04/16 12:50:25 (permalink) ☄ Helpfulby Luca Pascarella 2018/04/17 04:36:04
5 (1)
Back from a 2 week vacation in Japan, and now back to work...
 
Here is what I found out.  I collected 5 different USB sticks and used FlashBench to retrieve their VID and PID values.  The ones I was having trouble with were VID 058F and PID 6387.  These are from Alcor Micro Corp.  Unfortunately, marketing bought a whole bunch of these sticks with our company logo on them.  We give them away, but we also ship them to customers with software updates, so I pretty much had to figure out a way to make them work.  These sticks work quite well (though not 100%) with our older PIC32MX based CPU card, but not with our soon to be released PIC32MZ CPU card.
 
Microchip's USB demo documentation (admittedly for older versions of Harmony) mentions this VID/PID pair as having been tested with the Harmony USB stack.
 
I loaded the USB msd_basic demo app onto a PIC32MZ demo board I have and watched the LEDs.  From that I could see that these Alcor sticks have a much longer attach time than the other sticks.  My production boot loader was waiting for 2 seconds for a USB device to attach, but these Alcors sticks take about 4.3 seconds.  I simply updated the timeout from 2 to 5 seconds and it works great every time.
 
Case closed, on to the next task.
#11
Jump to:
© 2018 APG vNext Commercial Version 4.5