• AVR Freaks

Hot!How to change the default values of device configuration in Harmony3?

Author
yts
Super Member
  • Total Posts : 609
  • Reward points : 0
  • Joined: 2005/09/06 17:45:30
  • Status: offline
2019/04/16 02:41:12 (permalink)
0

How to change the default values of device configuration in Harmony3?

I would like to change the default values of device configuration in Harmony 3.

For example, the default value of "Ethernet MII Enable Configuration bit" is ON in case of the device configuration of PIC32MZ2048EFM064 (see the attached figure).
I would like to change the default value to OFF.

Which file should I modify to set the new default value to OFF?
post edited by yts - 2019/04/19 01:14:42

Attached Image(s)

#1

4 Replies Related Threads

    yts
    Super Member
    • Total Posts : 609
    • Reward points : 0
    • Joined: 2005/09/06 17:45:30
    • Status: offline
    Re: How to change the default values of device configuration in Harmony3? 2019/04/19 17:15:47 (permalink)
    0
    I found the solution as seen in figure1.

    995th line from the top of the file “HarmonyFramework\dev_packs\Microchip\PIC32MZ_EF_DFP\0.1\PIC32MZEF\atdf\PIC32MZ2048EFM064.atdf”


    <modules>
       <module caption="" id="" name="FUSECONFIG" version="">
          <register-group name="FUSECONFIG">
             <register caption="Device Configuration Word 3" name="DEVCFG3" initval="0xFEFFFFFF">  //  <--------------- give the initial value for DEVCFG3


    Meaning of Configuration bits is known by selecting menu “Window-> Target Memory Views->Configuration Bits” on the MPLAB X IDE (see figure2).


    post edited by yts - 2019/04/19 17:24:41

    Attached Image(s)

    #2
    LostInSpace
    Super Member
    • Total Posts : 306
    • Reward points : 0
    • Joined: 2016/03/11 22:47:59
    • Location: 0
    • Status: offline
    Re: How to change the default values of device configuration in Harmony3? 2019/04/25 18:12:30 (permalink)
    0
    Wow, good sleuthing!
     
    Overwriting the file just puts you at risk of updating the file from the installer and overwriting it again.
     
    Another method would be to set the device as you wish, then export all the settings. When you start another project you an just import your basic settings file that you previously saved.
     
    Naturally this will have limits also, because who knows if the settings file will be / is compatible between V3 and Vx Harmony for instance.
     
    You get a star for "digging into files to fins an undocumented setting" against all odds however!
     
    :-)
    post edited by LostInSpace - 2019/04/25 18:15:05
    #3
    yts
    Super Member
    • Total Posts : 609
    • Reward points : 0
    • Joined: 2005/09/06 17:45:30
    • Status: offline
    Re: How to change the default values of device configuration in Harmony3? 2019/04/26 18:15:31 (permalink)
    0
    Hi Lostin Space,
     
    Thank you for your suggesions.
     
    Do you know how to export all/selected settings in Harmony 3?
    I can open "Export Menu" window, but nothing appears on the list (please see the figure).
     
     yts

    Attached Image(s)

    #4
    yts
    Super Member
    • Total Posts : 609
    • Reward points : 0
    • Joined: 2005/09/06 17:45:30
    • Status: offline
    Re: How to change the default values of device configuration in Harmony3? 2019/12/16 05:09:07 (permalink)
    0
    Just for information.

    I can change the default values of device configuration in Harmony 3 by modifying a  “bsp.py” file.
    The following is the BSP settings (bsp.py) for my board (PIC32MX270F256B-50I/SP with a 20MHz external crystal).


    """*****************************************************************************
    * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries.
    *
    * Subject to your compliance with these terms, you may use Microchip software
    * and any derivatives exclusively with Microchip products. It is your
    * responsibility to comply with third party license terms applicable to your
    * use of third party software (including open source software) that may
    * accompany Microchip software.
    *
    * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
    * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
    * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
    * PARTICULAR PURPOSE.
    *
    * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
    * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
    * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
    * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
    * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
    * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
    * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
    *****************************************************************************"""

    def instantiateComponent(bspComponent):

        # LED 1: RA0
        Database.setSymbolValue("core", "BSP_PIN_2_FUNCTION_TYPE", "LED_AH")
        Database.setSymbolValue("core", "BSP_PIN_2_FUNCTION_NAME", "LED1")
        Database.setSymbolValue("core", "BSP_PIN_2_MODE", "DIGITAL")
        Database.setSymbolValue("core", "BSP_PIN_2_DIR", "Out")
        Database.setSymbolValue("core", "BSP_PIN_2_LAT", "")

        # LED 2: RA1
        Database.setSymbolValue("core", "BSP_PIN_3_FUNCTION_TYPE", "LED_AH")
        Database.setSymbolValue("core", "BSP_PIN_3_FUNCTION_NAME", "LED2")
        Database.setSymbolValue("core", "BSP_PIN_3_MODE", "DIGITAL")
        Database.setSymbolValue("core", "BSP_PIN_3_DIR", "Out")
        Database.setSymbolValue("core", "BSP_PIN_3_LAT", "")

        # LED 3: RA4
        Database.setSymbolValue("core", "BSP_PIN_12_FUNCTION_TYPE", "LED_AH")
        Database.setSymbolValue("core", "BSP_PIN_12_FUNCTION_NAME", "LED3")
        Database.setSymbolValue("core", "BSP_PIN_12_MODE", "DIGITAL")
        Database.setSymbolValue("core", "BSP_PIN_12_DIR", "Out")
        Database.setSymbolValue("core", "BSP_PIN_12_LAT", "")

        #Switch 1: RB15
        Database.setSymbolValue("core", "BSP_PIN_26_FUNCTION_TYPE", "SWITCH_AL")
        Database.setSymbolValue("core", "BSP_PIN_26_FUNCTION_NAME", "SWITCH1")
        Database.setSymbolValue("core", "BSP_PIN_26_MODE", "DIGITAL")
        Database.setSymbolValue("core", "BSP_PIN_26_PU", "True")
        Database.setSymbolValue("core", "BSP_PIN_26_DIR", "")

        # Switch 2: RB14
        Database.setSymbolValue("core", "BSP_PIN_25_FUNCTION_TYPE", "SWITCH_AL")
        Database.setSymbolValue("core", "BSP_PIN_25_FUNCTION_NAME", "SWITCH2")
        Database.setSymbolValue("core", "BSP_PIN_25_MODE", "DIGITAL")
        Database.setSymbolValue("core", "BSP_PIN_25_PU", "True")
        Database.setSymbolValue("core", "BSP_PIN_25_DIR", "")

        # Switch 3: RB13
        Database.setSymbolValue("core", "BSP_PIN_24_FUNCTION_TYPE", "SWITCH_AL")
        Database.setSymbolValue("core", "BSP_PIN_24_FUNCTION_NAME", "SWITCH3")
        Database.setSymbolValue("core", "BSP_PIN_24_MODE", "DIGITAL")
        Database.setSymbolValue("core", "BSP_PIN_24_PU", "True")
        Database.setSymbolValue("core", "BSP_PIN_24_DIR", "")

        # DEVCFG3
        Database.setSymbolValue("core", "CONFIG_FUSBIDIO", "OFF")
        Database.setSymbolValue("core", "CONFIG_FVBUSONIO", "OFF")

        # DEVCFG2
        Database.setSymbolValue("core", "CONFIG_FPLLIDIV", "DIV_4")
        Database.setSymbolValue("core", "CONFIG_FPLLMUL", "MUL_20")
        Database.setSymbolValue("core", "CONFIG_UPLLIDIV", "DIV_5")

        # DEVCFG1
        Database.setSymbolValue("core", "CONFIG_FNOSC", "PRIPLL")
        Database.setSymbolValue("core", "CONFIG_POSCMOD", "HS")

        # DEVCFG0
        Database.setSymbolValue("core", "CONFIG_DEBUG", "ON")

        # CLOCK
        Database.setSymbolValue("core", "CONFIG_SYS_CLK_CONFIG_PRIMARY_XTAL", 20000000)

        BSP_NAME = "pic32mx270f256b"

        pinAttributes = [{"attrib":"type", "symbol":"BSP_CUSTOM_TYPE", "label":"Type Name"},
            {"attrib":"mode", "symbol":"BSP_CUSTOM_MODE", "label":"Mode"},
            {"attrib":"dir", "symbol":"BSP_CUSTOM_DIR", "label":"Direction"},
            {"attrib":"lat", "symbol":"BSP_CUSTOM_LAT", "label":"Initial Latch Value"},
            {"attrib":"od", "symbol":"BSP_CUSTOM_OD", "label":"Open Drain"},
            {"attrib":"cn", "symbol":"BSP_CUSTOM_CN", "label":"Change Notice"},
            {"attrib":"pu", "symbol":"BSP_CUSTOM_PU", "label":"Pull Up"},
            {"attrib":"pd", "symbol":"BSP_CUSTOM_PD", "label":"Pull Down"}]

        pinTypes = [{"type":"LED_AH", "mode":"DIGITAL", "dir":"OUT"},
                {"type":"LED_AL", "mode":"DIGITAL", "dir":"OUT", "lat":"High"},
                {"type":"SWITCH_AH", "mode":"DIGITAL"},
                {"type":"SWITCH_AL", "mode":"DIGITAL"},
                {"type":"VBUS_AH", "mode":"DIGITAL", "dir":"OUT"},
                {"type":"VBUS_AL", "mode":"DIGITAL", "dir":"OUT","lat":"High"}]

        execfile(Variables.get("__BSP_DIR") + "/boards/config/bsp_common.py")


    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5