• AVR Freaks

Hot!Harmony 3 DDR not working. PIC32MZ1025DAG169-I/6J crashes when DDR_Initialize() called

Author
cbeif
Starting Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2012/05/09 14:28:30
  • Location: 0
  • Status: offline
2019/06/14 15:53:27 (permalink)
0

Harmony 3 DDR not working. PIC32MZ1025DAG169-I/6J crashes when DDR_Initialize() called

I am trying to use the  PIC32MZ1025DAG169-I/6J
I drag and drop the DDR peripheral library in the Harmony 3 configurator.
I generate code.
When I run the code, the debugger gets lost in space as soon as DDR_Initialize() is called.
 
The DDR has a TON of settings, which ones do I need to change to get the DDR to run properly
on this chip.
I did set DDR Type to "Internal" and size to  "32MB"
I don't know how to set any of the other registers.
#1

6 Replies Related Threads

    friesen
    Super Member
    • Total Posts : 2073
    • Reward points : 0
    • Joined: 2008/05/08 05:23:35
    • Location: Indiana, USA
    • Status: offline
    Re: Harmony 3 DDR not working. PIC32MZ1025DAG169-I/6J crashes when DDR_Initialize() called 2019/06/22 09:31:39 (permalink)
    0
    It probably isn't harmony.  Make sure you have your clocks correct, like not too fast, as harmony 2 doesn't get it right by default.  Also, this happens if ddr doesn't have a proper 1/2 vddr reference.  The internal one doesn't work either per errata.

    Erik Friesen
    #2
    cbeif
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2012/05/09 14:28:30
    • Location: 0
    • Status: offline
    Re: Harmony 3 DDR not working. PIC32MZ1025DAG169-I/6J crashes when DDR_Initialize() called 2019/06/28 15:39:19 (permalink)
    0
    I do have a 10K-10K voltage divider on my 1.8V signal to feed 0.9v into the DDRVREF pin,
    and I disabled the internal divider using this line of code
     CFGMPLLbits.INTVREFCON = 0x00; // use the external DDRVRef circuit
     
    In Harmony clock configuration, I also set the  Memory PPL clock to lower the  DDR2 clock to 200MHz.
     
    In Harmony, I set the DDR Type to Internal, and the DDR Size to 32MB
     
    Do I need to "Enable On-Die terminations for reads and writes?"
    or enable the "On Die termination enable bit"
    I cannot find any harmony 3 documentation about the DDR setup.
    #3
    cbeif
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2012/05/09 14:28:30
    • Location: 0
    • Status: offline
    Re: Harmony 3 DDR not working. PIC32MZ1025DAG169-I/6J crashes when DDR_Initialize() called 2019/07/08 10:52:47 (permalink)
    0
    It seems that I am also not setting any of the DDR registers, they always read as a 0x0000000

    ACK! I also noticed that the PMD7.DDR2CMD bit is a 1 which means that the
    DDR2 peripheral is disabled.
     
    BUT, if I run this command to clear out bit 28
     
      PMD7 &= 0xEFFFFFFF;
     
    The program immediately crashes to this line
            .align 2
            /* Device not in proper ISA mode */
            .set nomicromips
    __reset_switch_isa:
            jal _startup      // it jumps here
            nop
     
     
    #4
    cbeif
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2012/05/09 14:28:30
    • Location: 0
    • Status: offline
    Re: Harmony 3 DDR not working. PIC32MZ1025DAG169-I/6J crashes when DDR_Initialize() called 2019/07/09 15:48:14 (permalink)
    0
      I just made one major breakthrough,
     
    Harmony 3 configuration does not enable the MPLL voltage regulator
    So this was causing the chip reset crash.
    I recommend calling this code before calling DDR_Initialize(); 
        CFGMPLLbits.INTVREFCON = 0x00; // use the external DDRVRef voltage(must be 0.9 volts)
        CFGMPLLbits.MPLLVREGDIS = 0; // turn on the MPLL voltage regulator, or chip resets when ddr enabled
        while (CFGMPLLbits.MPLLVREGRDY == 0); // wait for MPLL voltage regulator to be ready
        while (CFGMPLLbits.MPLLRDY == 0);  // wait for MPLL clock to be ready
        DDR_Initialize(); 
     
     
    It no longer crashes, BUT, when it calls this function
    the SCLEN = 1 seems to fail, the debugger always shows this register as zero.
    Any ideas why I cannot set this bit in the DDRSCLSTART register????
    static void DDR_PHY_Calib(void)
    {
                    DDRSCLSTARTbits.SCLEN = 1;
                    DDRSCLSTARTbits.SCLSTART = 1;
     
                    while (!((DDRSCLSTARTbits.SCLLBPASS & DDRSCLSTARTbits.SCLUBPASS) == 0x01));
    }
     
    #5
    Ed@Microchip
    Super Member
    • Total Posts : 146
    • Reward points : 0
    • Joined: 2017/04/06 09:39:29
    • Location: 0
    • Status: offline
    Re: Harmony 3 DDR not working. PIC32MZ1025DAG169-I/6J crashes when DDR_Initialize() called 2019/07/16 11:13:47 (permalink)
    0
    PIC32MZ DAis not currently supported in Harmony 3. The only supported PIC32MZ DA Internal DDR parts are the DAR and DAS. All the H3 demo applications for PIC32MZ DA target the DAR and DAS parts.
     
    If you want to run Harmony 3 on PIC32 MZ DAG, you will need to modify the generated plib_clk.c code to set PMD1 to 0xefff_ffff (instead of the generated value 0xffff_ffff). The rest of the generated code should work as is. Please give this a try.
     
        /* Peripheral Module Disable Configuration */
        PMD1 = 0xefffffff;
    #6
    cbeif
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2012/05/09 14:28:30
    • Location: 0
    • Status: offline
    Re: Harmony 3 DDR not working. PIC32MZ1025DAG169-I/6J crashes when DDR_Initialize() called 2019/07/17 08:34:25 (permalink)
    0
    Thanks Ed,
     
     I did try what you suggested, but the sdram never did work properly.


       But, all of the above is irrelevant because microchip has now stated that the DAG is "no longer recommend for new designs" so I am now switching over to the new DAR chip.
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5