Hot!pic32 + harmony changing clock freq problem

Author
Shishi
Super Member
  • Total Posts : 290
  • Reward points : 0
  • Joined: 2016/06/15 05:34:10
  • Location: 0
  • Status: offline
2018/07/12 02:02:46 (permalink)
0

pic32 + harmony changing clock freq problem

Hi all
i am using Pic32(mz)starter kit and harmony v2.05,with wifi module and Ethernet RJ45... it is my first time that i am using harmony.I have 2 problems:
1.in main.c why while(true) just executed one time and does not loop always? if i want to add my code what should i do?
2.the pic is now have 200MHZ of clock freq , i tried to change it with 40 MHZ but the pic stacks to SYS_DEBUG_BreakPoint(),in system_exeptions.c file.why?
#1

16 Replies Related Threads

    Paul PortSol
    Super Member
    • Total Posts : 298
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/12 06:19:58 (permalink)
    0
    1. Do some of the online Harmony Tutorials to see how to add code
    * See Harmony tutorials in: http://microchipdeveloper.com/harmony:start
    2. PICs have limits on Clock Frequency if using PLL. If you want really slower clock then add an External Oscillator/Resonator directly (Don't select SPLL/PLL as Clock). See Datasheet for the chip for limitations. You'll probably have to make Own PCB to experiment with Slower clock.
    Paul
    #2
    Shishi
    Super Member
    • Total Posts : 290
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/12 08:20:06 (permalink)
    0
    Paul PortSol
    1. Do some of the online Harmony Tutorials to see how to add code
    * See Harmony tutorials in: http://microchipdeveloper.com/harmony:start
    2. PICs have limits on Clock Frequency if using PLL. If you want really slower clock then add an External Oscillator/Resonator directly (Don't select SPLL/PLL as Clock). See Datasheet for the chip for limitations. You'll probably have to make Own PCB to experiment with Slower clock.
    Paul


    I already used this Pic in our custom board and i used External Oscillator and clock freq without PLL,everything worked well,but i did not use harmony and also just had Ethernet RJ45,
    but in this case i am using harmony... the pic is the same... why it is not working with 40MHZ?
    #3
    Paul PortSol
    Super Member
    • Total Posts : 298
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/12 09:51:54 (permalink)
    0
    1. Check that MHC has correct settings for PGECx/PGEDx to match your PCB
    2. Send picture of your MHC Clock Settings
    #4
    Paul PortSol
    Super Member
    • Total Posts : 298
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/12 09:52:55 (permalink)
    0
    If you are new to Harmony then notes in this might help: MHC_CreatingProjectWithoutBSP_v00PR.txt
    #5
    Shishi
    Super Member
    • Total Posts : 290
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/16 00:28:45 (permalink)
    0
    Paul PortSol
    1. Check that MHC has correct settings for PGECx/PGEDx to match your PCB
    2. Send picture of your MHC Clock Settings


    settings for PGECx/PGEDx is correct because i can program and mak the pic RUN with 200MHZ.
    i attached my MHC Clock Settings with 40 MHZ that does not work.
    can anyone tell me about main.c file and its while(true)????why it does not loop always,and after
    SYS_Tasks ( ); it does not return to while(true)?i need to use this while ...
    what should i do?
    post edited by Shishi - 2018/07/16 00:38:45

    Attached Image(s)

    #6
    Paul PortSol
    Super Member
    • Total Posts : 298
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/16 04:32:48 (permalink)
    0
    Hope someone elese can help you, I don't see anything wrong.
     
    Few more Points:
    - Comparing Harmony implementation to previous, arethe clock dividers and multipliers exactly same? Are the PBCLKs exactly the same for each module you use, etc....
    - Some Harmony modules have fine print points, such as minimum SYSCLK 60MHz for USB. 
    - That is written somewhere in Datasheet for many PIC32. I was bitten by this with my PIC32MZ.
    - You may have to go through the Harmony Datasheet, PIC errata, and docs for modules you are using to find such fine points :/ 
     
    *Would be great if there was a wiki that we could all add these recurring issues to so easier to find.
     
    Good Luck
    Paul
    #7
    Shishi
    Super Member
    • Total Posts : 290
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/16 05:04:15 (permalink)
    0
    Paul PortSol
    Hope someone elese can help you, I don't see anything wrong.
     
    Few more Points:
    - Comparing Harmony implementation to previous, arethe clock dividers and multipliers exactly same? Are the PBCLKs exactly the same for each module you use, etc....
    - Some Harmony modules have fine print points, such as minimum SYSCLK 60MHz for USB. 
    - That is written somewhere in Datasheet for many PIC32. I was bitten by this with my PIC32MZ.
    - You may have to go through the Harmony Datasheet, PIC errata, and docs for modules you are using to find such fine points :/ 
     
    *Would be great if there was a wiki that we could all add these recurring issues to so easier to find.
     
    Good Luck
    Paul


    thanks paul.
    i found the issue and it was spi clock freq of ethernet Rj45 that was 14MHZ..when i reduced this the pic runs at 40 MHZ 
    #8
    Shishi
    Super Member
    • Total Posts : 290
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/16 05:10:57 (permalink)
    0
    can anyone tell me about main.c file and its while(true)????why it does not loop always,and after
    SYS_Tasks ( ); it does not return to while(true)?i need to use this while ...
    what should i do?
    i saw that in task.c file in static portTASK_FUNCTION( prvIdleTask, pvParameters ), the program always loop here,
    can anyone explain alittle for me? can it be instead of while(true) in main.c?
    because as i now in main file while(1) should always loop and we can add codes there,but now i confused.
     
    #9
    muellernick
    Super Member
    • Total Posts : 396
    • Reward points : 0
    • Joined: 2015/01/06 23:58:23
    • Location: Germany
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/16 05:39:47 (permalink)
    0
    Under normal circumstances (of for the beginning), you shouldn't care about the main loop. The main loop does call your APP_Tasks().
    Additionally, Harmony once calls your APP_Initialize().
     
    APP_Tasks() is where most of your code goes to (including calls to your functions.
     
    Nick
    #10
    Shishi
    Super Member
    • Total Posts : 290
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/16 06:11:09 (permalink)
    0
    muellernick
    Under normal circumstances (of for the beginning), you shouldn't care about the main loop. The main loop does call your APP_Tasks().
    Additionally, Harmony once calls your APP_Initialize().
     
    APP_Tasks() is where most of your code goes to (including calls to your functions.
     
    Nick



    sorry but i did not get my answer... i could not understand what you want to say me
    post edited by Shishi - 2018/07/16 06:13:51
    #11
    muellernick
    Super Member
    • Total Posts : 396
    • Reward points : 0
    • Joined: 2015/01/06 23:58:23
    • Location: Germany
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/16 07:36:19 (permalink)
    4 (2)
    You should not place code in the loop of main.c (unless you understand what you do and need to do it exactly there; I highly doubt that).
    You code just goes into APP_Initialize and APP_Tasks. Both are in app.c.
     
    Nick
    #12
    Shishi
    Super Member
    • Total Posts : 290
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/16 07:59:09 (permalink)
    0
    muellernick
    You should not place code in the loop of main.c (unless you understand what you do and need to do it exactly there; I highly doubt that).
    You code just goes into APP_Initialize and APP_Tasks. Both are in app.c.
     
    Nick


    thank you so much now i got it
    #13
    qɥb
    Monolothic Member
    • Total Posts : 2913
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: online
    Re: pic32 + harmony changing clock freq problem 2018/07/16 19:14:10 (permalink)
    0
    shirin87
    ...
    settings for PGECx/PGEDx is correct because i can program and mak the pic RUN with 200MHZ.
    ...

    Just an FYI that your conclusion here is totally wrong.
    The PGECx/PGEDx setting only affects debugging, not programming.
    It is entirely possible to program the chip with that setting incorrect.
    If you think about it, how could you program the chip at all if this were not true?
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #14
    Shishi
    Super Member
    • Total Posts : 290
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/17 02:59:45 (permalink)
    0
    qɥb
    shirin87
    ...
    settings for PGECx/PGEDx is correct because i can program and mak the pic RUN with 200MHZ.
    ...

    Just an FYI that your conclusion here is totally wrong.
    The PGECx/PGEDx setting only affects debugging, not programming.
    It is entirely possible to program the chip with that setting incorrect.
    If you think about it, how could you program the chip at all if this were not true?
     


    so where can i check this?in configuration bits?
    #15
    Paul PortSol
    Super Member
    • Total Posts : 298
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/17 05:29:16 (permalink)
    0
    For: PGECx/PGEDx
    MHC -> Options -> Device & Project Configuration
    Rest varies with PIC registers
    For PIC32MZ it is under:  DevCfg0 -> ICE\ICD Com Channel Select (ICESEL)
     
    *It is worthwhile to periodically step through ALL your MHC settings
    a) To catch any unexpected changes
    b) To update settings for things you have gained a better understanding of
    c) To just become familiar with the settings available
     
    Paul
     
    #16
    Shishi
    Super Member
    • Total Posts : 290
    • Reward points : 0
    • Joined: 2016/06/15 05:34:10
    • Location: 0
    • Status: offline
    Re: pic32 + harmony changing clock freq problem 2018/07/17 06:47:28 (permalink)
    0
    Paul PortSol
    For: PGECx/PGEDx
    MHC -> Options -> Device & Project Configuration
    Rest varies with PIC registers
    For PIC32MZ it is under:  DevCfg0 -> ICE\ICD Com Channel Select (ICESEL)
     
    *It is worthwhile to periodically step through ALL your MHC settings
    a) To catch any unexpected changes
    b) To update settings for things you have gained a better understanding of
    c) To just become familiar with the settings available
     
    Paul
     


    thanks paul...the ICE\ICD Com Channel Select (ICESEL) is ICS_PGx2.
    because i will use icd3 on PGEC2/D2 for our custom board
    but all the test now that i am doing is with pickit3 via mini usb that is on starter kit
    #17
    Jump to:
    © 2018 APG vNext Trial Version 4.5