This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM335X: Board init() function

Part Number: PROCESSOR-SDK-AM335X

Hi,

Where is the definition of Board_init(boardCfg) function and how you are linking to main.c file in example project for skAM335x board.

I am using PSDK TI RTOS.

What does it mean by value of boardCfg?

How you are writing to registers by using Macro, functions, structures, etc. Actually I am not getting where you are writing to registers directly or indirectly.

Regards

Gaurav

  • Gaurav,

    The Board_init() API supports initialization of PLL, peripheral clocks, external DDR memory, pinmux and IO Delay configurations.

    Board_init() is declared in below header file:

    pdk_am335x_1_0_14/packages/ti/board/board.h

    For AM335x StarterKit board, Board_init() is defined in below file:

    pdk_am335x_1_0_14/packages/ti/board/src/skAM335x/skAM335x.c

    Refer to the below user guide for more info regarding Board_init() and Board_initCfg




    We are writing to registers with functions and macros, not directly. For example, to enable GPIO1 module you need to write 0x2 in register
    CM_PER_GPIO1_CLKCTRL. This is done in below files and functions:

    pdk_am335x_1_0_14/packages/ti/board/src/skAM335x/skAM335x.c

    Board_STATUS Board_moduleClockInit()
    {
        int32_t status;
    ....
     /* GPIO */
    if(S_PASS == status)
        {
            status = PRCMModuleEnable(CHIPDB_MOD_ID_GPIO, 1U, 0U);
        }
    }


    pdk_am335x_1_0_14/packages/ti/starterware/soc/am335x/am335x_prcm.c

    int32_t PRCMModuleEnable(chipdbModuleID_t moduleId, uint32_t instNum,
                                                        uint32_t isBlockingCall)
    {
        int32_t status = S_PASS;
        switch(moduleId)
        {
    ...

    #if defined(BUILDCFG_MOD_GPIO)

            case CHIPDB_MOD_ID_GPIO:
            {
                switch(instNum)
                {
    case 1:
                        enableModule(SOC_CM_PER_REGS, CM_PER_GPIO1_CLKCTRL,
                            CM_PER_L4LS_CLKSTCTRL,
                            CM_PER_L4LS_CLKSTCTRL_CLKACTIVITY_L4LS_GCLK);
                        break;


    Regards,
    Pavel



  • Hi,

    But how you are linking 

    pdk_am335x_1_0_14/packages/ti/board/src/skAM335x/skAM335x.c to main.c file, because in every main.c file we need to use board_init() function.

    What about boardCfg variable? What does it mean?

    Regards

    Gaurav
  • Gaurav Aggarwal1 said:

    But how you are linking 

    pdk_am335x_1_0_14/packages/ti/board/src/skAM335x/skAM335x.c to main.c file, because in every main.c file we need to use board_init() function.

    Let we take for example this main file: pdk_am335x_1_0_14/packages/ti/drv/gpio/test/led_blink/src/main_led_blink.c

    This file links to skAM335x Board_init() in below files:

    pdk_am335x_1_0_14/packages/ti/drv/gpio/test/led_blink/am335x/armv7/bios/am335x_app_skam335x.cfg

    /* Load the board package */
    var Board = xdc.loadPackage('ti.board');
    Board.Settings.boardName = "skAM335x";

    pdk_am335x_1_0_14/packages/ti/drv/gpio/test/led_blink/am335x/armv7/bios/GPIO_LedBlink_skAM335x_armTestProject.txt

    -ccs.setCompilerOptions "-c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard  -DSOC_AM335x -DskAM335x -DUSE_BIOS

    Gaurav Aggarwal1 said:
    What about boardCfg variable? What does it mean?

    boardCfg is uint32_t

    typedef uint32_t Board_initCfg;

    Regards,
    Pavel

  • Hi,

    For what value of clock you are configuring in Board_init() function? If I want to change the value of clock then how can I change?

    Actually I don't know what does .cfg file means?

    What does it mean given below?

    pdk_am335x_1_0_14/packages/ti/drv/gpio/test/led_blink/am335x/armv7/bios/am335x_app_skam335x.cfg

    /* Load the board package */
    var Board = xdc.loadPackage('ti.board');
    Board.Settings.boardName = "skAM335x";

    pdk_am335x_1_0_14/packages/ti/drv/gpio/test/led_blink/am335x/armv7/bios/GPIO_LedBlink_skAM335x_armTestProject.txt

    -ccs.setCompilerOptions "-c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard  -DSOC_AM335x -DskAM335x -DUSE_BIOS

    Is this some command written in .txt file?

    Please elaborate in brief.

    Regards

    Gaurav

  • Gaurav Aggarwal1 said:
    For what value of clock you are configuring in Board_init() function? If I want to change the value of clock then how can I change?

    In Board_init() -> Board_moduleClockInit() -> PRCMModuleEnable(), we just enable GPIO1 functional clock (OCP clock) that is provided from devcie PRCM to GPIO1 module. We do not configure any clock frequency here.

    Which clock frequency exactly you are interested?

    Gaurav Aggarwal1 said:

    Actually I don't know what does .cfg file means?

    What does it mean given below?

    pdk_am335x_1_0_14/packages/ti/drv/gpio/test/led_blink/am335x/armv7/bios/am335x_app_skam335x.cfg

    This is SYS/BIOS Configuration Files, check below link for details:

    Gaurav Aggarwal1 said:

    pdk_am335x_1_0_14/packages/ti/drv/gpio/test/led_blink/am335x/armv7/bios/GPIO_LedBlink_skAM335x_armTestProject.txt

    -ccs.setCompilerOptions "-c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard  -DSOC_AM335x -DskAM335x -DUSE_BIOS

    Is this some command written in .txt file?

    Yes, command. Check below FAQ for details.

    Regards,
    Pavel