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.

AM2431: Trying to output MCU_HFOSC0_CLK on MCU_SPI0_CS1

Part Number: AM2431
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

I would like to output the MCU_HFOSC0_CLK on MCU_SPI0_CS1 (Ball Number C6)

How do I set this up in sysconfig?
When I set GPIO pin C6 to output, in the auto generated code, it sets the PIN_MODE to 7 and I need it set to 1 to output MCU_OBSCLK0
I've looked through the other options and don't see another way to set C6 to MCU_OBSCLK0.

Another question is how do I set up the registers?
I need to set CTRLMMR_MCU_OBSCLK_CTRL bit 24 and I don't see any APIs to modify the MCU registers. What's the preferred way to set these?

Thanks
Jeff

  • Hi Jeff,

    Thanks for your query.

    How do I set this up in sysconfig?

    To configure the C6 pin as Chip select pin. Please add the MCPSI peripheral in example.syscfg file as shown below. 

    Please refer below image.

    I need to set CTRLMMR_MCU_OBSCLK_CTRL bit 24 and I don't see any APIs to modify the MCU registers.

    You can use the HW_RD_REG32() API to write the register.

    Hope the above information helps.

    Regards,

    Tushar

  • Tushar,

    I need to configure C6 to output MCU_HFOSC0_CLK
    This is described in the TRM section 5.4.3.1 Observation Clock Pins
    I can't figure out how to set it up in sysconfig

    Jeff

  • Hi Jeff,

    I can't figure out how to set it up in sysconfig

    Sysconfig doesn't provide option to select the C6 pin as MCU_HFOSC0_CLK.

    You can configure this manually inside the application.

    Please refer the below code which configures the C6 pin as MCU_HFOSC0_CLK.

    /*
     *  Copyright (C) 2021 Texas Instruments Incorporated
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    #include <kernel/dpl/DebugP.h>
    #include <kernel/dpl/ClockP.h>
    #include <kernel/dpl/AddrTranslateP.h>
    #include <kernel/dpl/HwiP.h>
    #include "ti_drivers_config.h"
    #include "ti_drivers_open_close.h"
    #include "ti_board_open_close.h"
    #include <drivers/pinmux/am64x_am243x/pinmux.h>
    
    #define CTRLMMR_MCU_OBSCLK_CTRL         (0x4508000)
    
    #define CTRLMMR_MCU_LOCK2_KICK0         (0x4509008)
    #define CTRLMMR_MCU_LOCK2_KICK1         (0x450900C)
    
    #define CTRLMMR_MCU_LOCK2_KICK0_VAL     (0x68EF3490)
    #define CTRLMMR_MCU_LOCK2_KICK1_VAL     (0xD172BC5A)
    
    #define HFOSC0_CLK                      (0x6)
    
    
    static Pinmux_PerCfg_t gPinMuxMcuDomainCfg1[] = {
        /* MCU GPIO0 pin config */
        /* MCU_GPIO0_12 -> MCU_SPI0_CS1 (C6) */
        {
            PIN_MCU_SPI0_CS1,
            ( PIN_MODE(1) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE )
        },
    
        {PINMUX_END, PINMUX_END}
    };
    
    void gpio_input_interrupt_main(void *args)
    {
        int32_t         retVal;
        HwiP_Params     hwiPrms;
    
        /* Open drivers to open the UART driver for console */
        Drivers_open();
        Board_driversOpen();
    
        // Pinmuxing the MCU_SPI0_CS1
        Pinmux_config(gPinMuxMcuDomainCfg1, PINMUX_DOMAIN_ID_MCU);
    
        // Unlock the CTRL_MMR
        HW_WR_REG32((uint32_t *)CTRLMMR_MCU_LOCK2_KICK0, CTRLMMR_MCU_LOCK2_KICK0_VAL);
        HW_WR_REG32((uint32_t *)CTRLMMR_MCU_LOCK2_KICK1, CTRLMMR_MCU_LOCK2_KICK1_VAL);
    
        // Configure the CTRLMMR_MCU_OBSCLK_CTRL register to output HFOSC0 CLK
        HW_WR_REG32((uint32_t *)CTRLMMR_MCU_OBSCLK_CTRL, (HW_RD_REG32((uint32_t*)CTRLMMR_MCU_OBSCLK_CTRL) | HFOSC0_CLK));
    
        // Lock the CTRL_MMR
        HW_WR_REG32((uint32_t *)CTRLMMR_MCU_LOCK2_KICK0, 0x0);
        HW_WR_REG32((uint32_t *)CTRLMMR_MCU_LOCK2_KICK1, 0x0);
    
        Board_driversClose();
        Drivers_close();
    }
    

    Note: Please make sure you have C6 pin physical connection or it is pinned out on the EVM to probe the clock signal.

    Regards,

    Tushar

  • Thanks, I think this is what I was looking for.

    It would be nice if examples like this were in the TRM

  • Hi Jeff,

    Thanks, I think this is what I was looking for.

    Thanks for the confirmation.

    It would be nice if examples like this were in the TRM

    Thanks for the suggestion, but we don't put code in TRM. I will create an FAQ for the same.

    Closing the thread as original query has been answered.

    Regards,

    Tushar