Hot!PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b)

Author
alex_elec
Starting Member
  • Total Posts : 76
  • Reward points : 0
  • Joined: 2014/03/26 04:41:13
  • Location: UK
  • Status: offline
2017/07/19 07:17:41 (permalink)
0

PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b)

Hi MicroChippers,
 
I have recently acquired an MZ EF Starter kit (DM320007) so I can get MSD USB up and running as a host before our next (and hopefully final!) iteration of boards are due in.
 
I am having trouble getting the MSD basic demo to work with MPLABX (v3.55) and XC32v1.43. I have tried two different memory sticks but it doesn't seem to recognise that anything is attached. I have had it running standalone (powered by USB debug port but external charger) and also in debug mode but no luck.
 
Are there any pitfalls with the MZ EF starter kit? Shouldn't these demos work out of the box? I know the 24MHz xtal isn't fitted but a 24MHz oscillator is due to the MZ EF errata. And I think maybe the config bits for the demo are wrong?
 
/*** DEVCFG0 ***/

#pragma config DEBUG = OFF
#pragma config ICESEL = ICS_PGx2
#pragma config PWP = OFF
#pragma config BWP = OFF
#pragma config CP = OFF

/*** DEVCFG1 ***/

#pragma config FNOSC = PRIPLL
#pragma config FSOSCEN = OFF
#pragma config IESO = OFF
#pragma config POSCMOD = XT
#pragma config OSCIOFNC = OFF
#pragma config FPBDIV = DIV_1
#pragma config FCKSM = CSDCMD
#pragma config WDTPS = PS1048576
#pragma config FWDTEN = OFF
/*** DEVCFG2 ***/

#pragma config FPLLIDIV = DIV_2
#pragma config FPLLMUL = MUL_20
#pragma config FPLLODIV = DIV_1
#pragma config UPLLIDIV = DIV_2
#pragma config UPLLEN = ON
/*** DEVCFG3 ***/

#pragma config USERID = 0xffff
#pragma config FSRSSEL = PRIORITY_7
#pragma config FMIIEN = ON
#pragma config FETHIO = ON
#pragma config FCANIO = ON
#pragma config FUSBIDIO = ON
#pragma config FVBUSONIO = ON

 
I was unsure about POSCMOD being XT?
 
I'll keep experimenting but if anyone knows of obvious issues, please let me know!
Thanks
 
#1

13 Replies Related Threads

    simong123
    Lab Member No. 003
    • Total Posts : 1113
    • Reward points : 0
    • Joined: 2012/02/07 18:21:03
    • Location: Future Gadget Lab (UK Branch)
    • Status: online
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/19 07:42:37 (permalink)
    3 (1)
    Those config bits look like they are for an MX not an MZ. Have you selected the correct PIC?
    #2
    alex_elec
    Starting Member
    • Total Posts : 76
    • Reward points : 0
    • Joined: 2014/03/26 04:41:13
    • Location: UK
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/19 08:00:19 (permalink)
    0
    Yes, I think after having open a few projects I was looking at the wrong file! Apologies for confusion
     
    My current config bits using the MSD Basic demo on the MZ starter kit are:
     
    #pragma config DEBUG = ON
    #pragma config JTAGEN = OFF
    #pragma config ICESEL = ICS_PGx2
    #pragma config TRCEN = OFF
    #pragma config BOOTISA = MIPS32
    #pragma config FECCCON = OFF_UNLOCKED
    #pragma config FSLEEP = OFF
    #pragma config DBGPER = PG_ALL
    #pragma config SMCLR = MCLR_NORM
    #pragma config SOSCGAIN = GAIN_2X
    #pragma config SOSCBOOST = ON
    #pragma config POSCGAIN = GAIN_2X
    #pragma config POSCBOOST = ON
    #pragma config EJTAGBEN = NORMAL
    #pragma config CP = OFF

    /*** DEVCFG1 ***/

    #pragma config FNOSC = SPLL
    #pragma config DMTINTV = WIN_127_128
    #pragma config FSOSCEN = OFF
    #pragma config IESO = OFF
    #pragma config POSCMOD = EC
    #pragma config OSCIOFNC = OFF
    #pragma config FCKSM = CSECME
    #pragma config WDTPS = PS1048576
    #pragma config WDTSPGM = STOP
    #pragma config FWDTEN = OFF
    #pragma config WINDIS = NORMAL
    #pragma config FWDTWINSZ = WINSZ_25
    #pragma config DMTCNT = DMT31
    #pragma config FDMTEN = OFF
    /*** DEVCFG2 ***/

    #pragma config FPLLIDIV = DIV_3
    #pragma config FPLLRNG = RANGE_5_10_MHZ
    #pragma config FPLLICLK = PLL_POSC
    #pragma config FPLLMULT = MUL_50
    #pragma config FPLLODIV = DIV_2
    #pragma config UPLLFSEL = FREQ_24MHZ
    /*** DEVCFG3 ***/

    #pragma config USERID = 0xffff
    #pragma config FMIIEN = ON
    #pragma config FETHIO = ON
    #pragma config PGL1WAY = ON
    #pragma config PMDL1WAY = ON
    #pragma config IOL1WAY = ON
    #pragma config FUSBIDIO = ON

    /*** BF1SEQ0 ***/

    #pragma config TSEQ = 0xffff
    #pragma config CSEQ = 0xffff

     
    Trying to step through the code it seems that my deviceState= USB_HOST_DEVICE_STATE_ERROR_HOLDING (-2) so something has gone wrong initially?
     
    I've tried detaching and re-inserting but it still gets into the same state.
    #3
    RISC
    Super Member
    • Total Posts : 4477
    • Reward points : 0
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/19 12:34:01 (permalink)
    0
    Hi,
     
    XC32 v1.43 has some potentially unpleasant issues...
    I suggest you either use v1.44 latest release or the v1.42 just to be on the safe side...
    There is no errata related issue using PIC32MZ EF because it uses a TCXO.
    Don't change the configuration bits related to clock settings.
    In the Harmony documentation there is a long list of USB sticks which have been tested to work OK.
    I personally always try the good old USB sticks (1GB, 2GB,...) to start with
     
    Did you try various USB sticks ? none of them worked ?
     
    I tried the same project as you used (msd_basic) with the configuration pic32mz_ef_sk_int_dyn with 2 different USB sticks (both 2GB) and it worked out of the box. When the demo works (write the file file.txt with "hello world" string into it) the yellow led LED2 will be lit. You can remove it and check the content on your PC 
     
    Regards
     
    post edited by RISC - 2017/07/19 13:05:36
    #4
    alex_elec
    Starting Member
    • Total Posts : 76
    • Reward points : 0
    • Joined: 2014/03/26 04:41:13
    • Location: UK
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/20 00:05:22 (permalink)
    0
    Thanks for the info RISC, I'll give xc32v1.44 a try then, didn't realise a new version had been released.
     
    Can you tell me how you powered the starter kit? Did you have it running in debug or did you download the code? I have connected it to my PC with the mini usb debug port and have it powered using the micro usb connector to an external supply (1A) to run in debug. 
     
    One thing I haven't played around with is JP1 - I know this jumper has an effect if the PIC is a USB host?
     
    Ah, and which version of the harmony demo code worked for you? 
     
    Thanks,
    Alex
     
    #5
    alex_elec
    Starting Member
    • Total Posts : 76
    • Reward points : 0
    • Joined: 2014/03/26 04:41:13
    • Location: UK
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/20 00:26:58 (permalink)
    0
    Ah, it's working now!
    I went back to the MSD Basic demo in Harmony 2.03b as I had tried 1.11 to no avail.
     
    It seems that the pic32mz_ef_sk_int_dyn starter kit is expecting the PIC32MZ2048EFM144 but my starter kit has the the EFso I searched my project and changed all references from EFM to EFH and hey presto! that has worked
     
    So, I have an older starter kit? Or Microchip decided to change their minds every harmony release? I'm very confused! Anyway, it's all sorted now so I can hopefully build this USB MSD demo into my (non-harmony) project :D
     
    Should be fun
     
    #6
    NKurzman
    A Guy on the Net
    • Total Posts : 14834
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/20 06:16:07 (permalink)
    0
    I would stick with V1.42 like it says in the harmony documentation. Harmony is usually not a fan of the latest compiler.
    #7
    RISC
    Super Member
    • Total Posts : 4477
    • Reward points : 0
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/20 10:50:16 (permalink)
    0
    Hi,
    Why do you mean you have an old starter kit ?
    there are 2 different models of PIC32MZ EF starter kits which use almost the same processor except that one has a crypto unit ( PIC32MZ2048EFM144 ) and the other one does not ( PIC32MZ2048EFH144 ). 
    All the Harmony project are based on the crypto version. As they are fully compatible (except just the crypto unit), the easiest way in Harmony is to open the project, launch MHC plugin, change the processor name in the project properties window.
    Regards
     
    #8
    alex_elec
    Starting Member
    • Total Posts : 76
    • Reward points : 0
    • Joined: 2014/03/26 04:41:13
    • Location: UK
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/21 04:06:12 (permalink)
    0
    Ah yes, I chose not to order the crypto chip version EFM but obviously hadn't twigged that that was the reason why the target ID wasn't matching with these demo projects.
     
    In other news, I have tried six different USB sticks in the MSD basic demo app and four of them are working OK. The one's that it can't properly connect to are the ones that require the full 500mA
     
    I've used the very handy ChipGenius windows app to interrogate each USB stick to find out their credentials. I have changed over to use an external +5V supply wired directly onto the J2 connector so as to hopefully overcome the 400mA USB host current limit but still these 500mA sitcks can't be written to
     
    Has anyone had any experience with getting 500mA usb devices to work with the starter kit & MSD basic code?
     
    Thanks
     
     
    post edited by alex_elec - 2017/07/21 04:19:00
    #9
    RISC
    Super Member
    • Total Posts : 4477
    • Reward points : 0
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/21 07:54:08 (permalink)
    4 (1)
    Hi,
    In the USB 2.0 specification, during the enumeration the device will request up to 500mA :
    http://www.usbmadesimple.co.uk/ums_2.htm
    The device descriptor parameter MaxPower contains this value each "unit" is worht 2mA hence you can encode in a single byte up to 500mA.
    I am not sure what the PIC32MZ USB HOST will accept as maximum MaxPower parameter...
    If you read the PIC32MZ EF starter kit, it says page 21 that cannot manage to deliver 500mA.
    I must warn you about one very important point : the Vcap value is "only" C46 = 100uF (page 21)...the USB specification mention it should be no less than 120uF.
    I have already struggled with this in the past...make sure to be above 120uF to save yourself issues with enumeration....when somebody plugs a power hungry device...due to capacitor tolerances I would suggest always above 150uF


    Read carefully this excellent document : http://www.usb.org/develo...ivery_motherboards.pdf
    Bottom line : don't use the PIC32MZ EF starter kit with high current USB devices. You'll have potential enumeration issues due to the power supply...not due to the USB HOST stack...
    Make your own board ;=)
    Regards
    post edited by RISC - 2017/07/21 07:59:13
    #10
    alex_elec
    Starting Member
    • Total Posts : 76
    • Reward points : 0
    • Joined: 2014/03/26 04:41:13
    • Location: UK
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/24 00:55:15 (permalink)
    0
    Thanks a lot for the info RISC, I'll try to get at least a 150uF cap on our board
     
    The last link you posted doesn't work - ...seems like it has been incorrectly shortened (forum bug I imagine!) I had a poke around the USB website and found this: http://www.usb.org/developers/docs/whitepapers/power_delivery_motherboards.pdf
    Hopefully that is the one you linked to. That's very useful
     
    I might try and piggyback another 0805 cap on top of C46 on the starter kit to see if that helps with the 500mA devices
     
     
    #11
    RISC
    Super Member
    • Total Posts : 4477
    • Reward points : 0
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/07/24 03:22:45 (permalink)
    0
    Hi,
     
    The addition of a CAP will help only to reduce surges when plugging in a USB stick but I am not sure if the PIC32MZ starter kit design can support 500mA....
    The components on the starter kit consume probably 200mA so if you power the starter kit from the USB you will never get 500mA for the USB key.
    The PIC32MZ starter kit can be self-powered (directly powered) but you would need to add some adapter boards :
    PIC32 I/O expander board + PIC32 starter kit adapter board
    in this case it may be able to source more power to he USB type A connector but again you need to check the schematic (I think there is a jumper to change in that case) 
     
    Regards
    #12
    jdcoburn
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2011/11/13 16:37:26
    • Location: 0
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/08/11 14:07:28 (permalink)
    0
    hi - any luck with this?
    I have a PIC32MZ starter kit and I'm trying to use the Harmony 2.03 framework for a USB device connection. It doesn't work (ie the host doesn't recognize it and doesn't begin the enumeration), but I haven't seriously debugged it yet. I was hoping to find example code for Harmony 2.0 and the MZ CPU. I can find MZ code but only harmony 1.x or Harmony 2.0 and MX code. it's also not clear whether Harmony 2.x is beta or not.
     
    Any guidance would be appreciated.
    thanks,
    #13
    jdcoburn
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2011/11/13 16:37:26
    • Location: 0
    • Status: offline
    Re: PIC32MZ EF Starter Kit MSD Basic Demo (Harmony 2.03b) 2017/08/11 14:17:41 (permalink)
    0
    a note to the above: I'm using the vendor device profile.
    #14
    Jump to:
    © 2017 APG vNext Commercial Version 4.5