AM62P: How to access MCU_CAN from Linux ?

Part Number: AM62P
Other Parts Discussed in Thread: TPS65224, TDA4VM

Tool/software:

Hello TI Team,

I want to access the MCU_CAN from linux side for which I have followed the instructions provided in the below link:

https://software-dl.ti.com/processor-sdk-linux/esd/AM62PX/10_00_07_04/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/MCAN.html#mcan

but it gives an error "Cannot find device "mcu_mcan0".

After that I have also tried to enable the related device tree overlay 'k3-am62x-sk-mcan.dtbo' but I didn't find this file in the /boot directory and it did not work.

So, please guide how to enable/access MCU_MCAN from Linux side .

Also, can you please share the command to disable the watchdog on AM62P ?

Regards,

Shrikant

  • Hi Shrikant,

    What command have you used to enable the DT overlays?

    Looks like the overlay file is not applied properly and hence mcu_mcan0 is not getting recognized.

    Please share the output of dmesg | grep can

    Regards,
    Aparna

  • Hello ,

    Thanks for your quick response.

    I have used below commands to enable DT overlay:

    setenv name_overlays ti/k3-am62x-sk-mcan.dtbo 
    boot

    The dmesg output is as below:

    root@am62pxx-evm:~# dmesg | grep can
    [    0.385449] HugeTLB: 0 KiB vmemmap can be freed for a 1.00 GiB page
    [    0.398785] HugeTLB: 0 KiB vmemmap can be freed for a 32.0 MiB page
    [    0.412121] HugeTLB: 0 KiB vmemmap can be freed for a 2.00 MiB page
    [    0.425457] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
    root@am62pxx-evm:~#

    Let me know if you need any additional details.

    Regards,

    Shrikant

  • Hi Shrikant,

    The DT overlay is not applied on top of the base dtb.

    Could you share the output of => ls mmc 1:2 boot/dtb/ti at the U-boot prompt

    There should be a separate dtbo file for AM62P

    Also could you try running

    setenv name_overlays <name-of-dtbo>.dtbo 
    boot

  • Hello ,

    The output of ls mmc 1:2 boot/dtb/ti at the U-boot prompt is as below:

    => ls mmc 1:2 boot/dtb/ti
    <DIR>       4096 .
    <DIR>       4096 ..
                3313 k3-am62p5-sk-dsi-rpi-7inch-panel.dtbo
                 928 k3-am62p5-sk-dss-shared-mode.dtbo
                 936 k3-am62p5-sk-eqep.dtbo
                3124 k3-am62p5-sk-mcan.dtbo
                1983 k3-am62p5-sk-microtips-mf101hie-panel.dtbo
                1531 k3-am62p5-sk-microtips-mf103hie-lcd2.dtbo
                2545 k3-am62p5-sk-rpi-hdr-ehrpwm.dtbo
               60449 k3-am62p5-sk.dtb
                1915 k3-am62x-sk-csi2-imx219.dtbo
                1886 k3-am62x-sk-csi2-ov5640.dtbo
                1886 k3-am62x-sk-csi2-tevi-ov5640.dtbo
                2131 k3-am62x-sk-csi2-v3link-fusion.dtbo
                1345 k3-am62x-sk-hdmi-audio.dtbo
                 478 k3-am62x-sk-hdmi-disable-fastboot.dtbo
                4232 k3-am62x-sk-lpm-wkup-sources.dtbo

    I have tried with 'setenv name_overlays ti/k3-am62p5-sk-mcan.dtbo' command as well but no luck.

    For the command, I am not sure which .dtbo file to be used.

    Regards,

    Shrikant

  • Hi Shrikant,

    Try the following:

    setenv name_overlays ti/k3-am62p5-sk-mcan.dtbo

    boot

    Regards

    Aparna

  • Hello ,

    I was able to load the .dtbo file using below command:

    setenv name_overlays k3-am62p5-sk-mcan.dtbo

    Now, I am able to bring up the MCU_MCAN interface.
    Can you please let us know, how to disable Watchdong on AM62P ?

    Regards,
    Shrikant
  • Hi,

    Yes, that is one possible option but I am looking for command which will write to a register to disable the watchdog .

    Regards,

    Shrikant

  • The watchdog is disabled by default. You donot need to disable it additionally.

    Please check the values of RTI0, RTI1 etc from Linux prompt. The value should be 0x5312ACDE, which means WDT is disabled.

    Regards,
    Aparna

  • Hello ,
    Is the procedure same for external watchdog as well ?

    Regards,

    Shrikant

  • Hello Shrikant,

    The internal watchdog can't be disabled once the Watchdog starts.

    I am not sure if you are talking to which watchdog ? PMIC watchdog ?

    Regards,

    Anil.

  • Hello ,

    I am talking about PMIC watchdog (PMIC TPS65224). I want to disable the the watchdog by writing into WD_THR_CFG Register's WD_EN bit but I am not able to access the I2C device by linux I2C utility. The PMIC is connected to WKUP_I2C0. After looking into it further, I understood that wkup_i2c0 device node in k3-am62p-wakeup.dtsi itself is disabled. Unlike TDA4VM, there is no dts node for PMIC. Please suggest a way to disable the PMIC watchdog on AM62P.

    Regards,

    Shrikant

  • Hello Shrikant,

    The WAKUP I2C example is available on MCU+SDK.

    I need to check which command needs to be sent to disable the watchdog.

    I can update the status by tomorrow.

    Regards,

    Anil.

  • Hello Shrikant,

    The example of the PMIC is available in MCU+SDK.

    Now take the PMIC example and try to disable the watchdog from the example.

    Path :  \ti\mcu_plus_sdk_am62px_10_00_00_14\examples\drivers\pmic

    The Watchdog disable support is not there in the example.

    But, the driver is available to control the Watchdog disable as well .

    So, call the API below and make it disabled.

    The example below is enabling watchdog, but in your case you wanted to be disable, and I hope the below example is suitable for you and try with this example.

    Please let us know if you face any issues.

    Regards,

    Anil.

  • Hello Shrikant,

    Is the issue resolved ?

    Do you need help ?Since you posted a reply and deleted it.

    Regards,

    Anil.

  • Hello Swargam,
    The issue is not yet resolved. We are performing theses steps on our custom board which is using TPS6522430W RAHRQ1 PMIC . We have tried to modify the existing pmic_user_reg_cfg example as below.

    void pmic_user_reg_cfg_main(void *args)
    {
        uint32_t status = SystemP_FAILURE;
    
        /* PMIC interface handle initialized by PMIC_open */
        Pmic_CoreHandle_t *coreHandle = gPmicConfig[CONFIG_PMIC0].pmicCoreHandle;
        DebugP_assert(NULL != coreHandle);
    
        DebugP_log("\r\n");
        DebugP_log("Starting PMIC user space register configuration example !!\r\n\n");
    
    /*    status = PMICApp_configureADC(coreHandle);
        if(SystemP_SUCCESS == status)
        {
            status = PMICApp_thermalMonitoring(coreHandle);
        }
    
        if(SystemP_SUCCESS == status)
        {
            status = PMICApp_voltageMonitoring(coreHandle);
        }
    
        if(SystemP_SUCCESS == status)
        {
            status = PMICApp_configureGPIO(coreHandle);
        } */
        
        status = Pmic_wdgDisable(coreHandle);
    
        if(SystemP_SUCCESS == status)
        {
            DebugP_log("All tests have passed!!\r\n");
        }
        else
        {
            DebugP_logError ("Some tests have failed!!\r\n");
        }
    
        return;
    }
    

    We have also done the PMIC configuration using Syscfg-gui for our custom board. Please find the attached screenshot for reference.

    Compiled the modified pmic_user_reg_cfg example with updated sys configuration. We are getting the "All tests have passed !" log but the Watchdog is not getting disabled. Can we have a quick call to look into this issue.

    Regards,

    Shrikant

  • Hi Shrikant,

    The subject matter expert is currently out of office for this & next week. Please expect a delayed response. Thanks for your patience.

    Regards,

    Tushar

  • Hello ,

    We are blocked on this issue for long time, and waiting for 2 weeks will be difficult. So, request you to re-direct the issue to another expert. Also, you can suggest the things which we can try at our end before a call.

    Regards,

    Shrikant

  • Hello Shrikant,

    You may expect reply by EOD .

    Regards,

    Anil.

  • Hello ,
    Can we have a quick call to discuss this issue. It will help us to resolve it faster.

    Regards,

    Shrikant

  • Hello Shrikanth ,

    Sorry for delayed replies.

    I am looking at the PMIC datasheet and suggest one method by today. If this is not working, we can have the call.

    Regards,

    Anil.

  • Hello ,
    Just to add to the previous details. I have executed below code on evaluation board as well as our custom board. The code works fine on evaluation board, I get the register default value and after disabling watchdog the updated values reflects but in case of our custom board , I always get register value as 0x00000000.

    void pmic_user_reg_cfg_main(void *args)
    {
        uint32_t status = SystemP_FAILURE;
        bool    wdgEnabled = false;
        uint8_t regVal = 0x0U;
    
        /* PMIC interface handle initialized by PMIC_open */
        Pmic_CoreHandle_t *coreHandle = gPmicConfig[CONFIG_PMIC0].pmicCoreHandle;
        DebugP_assert(NULL != coreHandle);
    
        DebugP_log("\r\n");
        DebugP_log("Starting PMIC user space register configuration example !!\r\n\n");
        
        status = Pmic_commIntf_recvByte(coreHandle, PMIC_WD_THR_CFG_REGADDR, &regVal);
        if (PMIC_ST_SUCCESS == status)
        {
        	DebugP_log("regval before WDG disable = %p\r\n",regVal);
        }
        
        status = Pmic_wdgGetEnableState(coreHandle, &wdgEnabled);
        if(SystemP_SUCCESS == status)
        {
            DebugP_log("Fetched Watchdog state successfully!!\r\n");
        }
        else
        {
            DebugP_logError ("Unable to fetch the Watchdog state !!\r\n");
        }
        
        if(wdgEnabled)
        {
    	status = Pmic_wdgDisable(coreHandle);
    
    	if(SystemP_SUCCESS == status)
    	{
    		DebugP_log("Watchdog disabled successfully!!\r\n");
    	}
    	else
    	{
    		DebugP_logError ("Watchdog disable failed!!\r\n");
    	}
        }
        
        status = Pmic_commIntf_recvByte(coreHandle, PMIC_WD_THR_CFG_REGADDR, &regVal);
        if (PMIC_ST_SUCCESS == status)
        {
        	DebugP_log("regval After WDG disable = %p\r\n",regVal);
        }
    
        return;
    }

  • Hello Shrikant,

    Can you please confirm how many I2C's did you interface to PMIC on custom Hw?

    On the EVm side, we interfaced two I2C's and one I2C for dedicated for Watchdog QA mode support. 

    Can you please also confirm which is the example did you try on custom and EVM hw ?

    Regards,

    Anil.

  • Hello ,

    Can you please confirm how many I2C's did you interface to PMIC on custom Hw?

    We have interfaced 2 I2C's on custom board, one is MCU_I2C0 and another is WKUP_I2C0. Please see

    below image for reference:

    Can you please also confirm which is the example did you try on custom and EVM hw ?

    I have tried 'pmic_qa_watchdog_reset' and 'pmic_user_reg_cfg' examples.

    Regards,

    Shrikant

  • Hello Shrikant,

    You can take the PMIC qa watchdog example and copy the highlighted red mark code in your example in the same place and compile it.

    After compilation, connect the debugger and load the example from CCS and see the watchdog still is enabled or disabled.

    Regards,

    Anil.

  • Hello

    I tried your solution, but I am getting the following error:

    Starting Q&A watchdog interrupt example !!
    Configure PMIC GPIO pins for Q&A watchdog based on communication mode... DONE
    [Error] Sciclient event config failed!!!
    ASSERT: 0.12501s: ../board.c:Sciclient_gpioIrqSet:98: FALSE failed !!!

    Can we have a call to discuss this issue?

  • Hello Naman Kumar,

    The above example is I have already verified on the EVM, and it is working.

    The error you got from the SCI client error. This might be from your Linux application.

    The MCU GPIO port is already used in the Linux Application.

    If this is the case, try the steps below. 

    A GPIO bank interrupt can be routed to only one core at a time. For example if a gpio interrupt is routed to Linux A53 core, the same cannot be routed to other cores (M4/R5).Before running the GPIO Input interrupt example on a processor with Linux cores, disable any overlapping entries in the Linux devicetree board file. The GPIO can be excluded from the linux device tree by modifying the device tree board file (arch/arm62P/boot/dts/ti/k3-am642-evm.dts)

    &mcu_gpio0 {
    status = "reserved";
    };
    &mcu_gpio_intr {
    status = "reserved";
    };
    If you still face the issues then please schedule a call from FAE .
    Regards,
    Anil.
  • Hello

    I checked the sciclient_defaultBoardcfg_rm.c

    I did not find any GPIO bank interrupt which was routed to both Linux A53 and (M4/R5) cores.

    Sharing the snapshot

    We are using TISCI_DEV_MAIN_GPIOMUX_INTROUTER0, here we can see start_resource  is different for Linux A53 and (M4/R5) cores.

    Is my understanding correct?

  • Hello Team,

    Currently we are stuck in development due to this issue? Could you please respond to the query.

  • Hello Naman,

    You need to look at the Linx device tree file and check if Linux core uses the MCU GPIO or not.

    If Linux core uses the MCU GPIO port, you need to apply the method below.

    &mcu_gpio0 {
    status = "reserved";
    };
    &mcu_gpio_intr {
    status = "reserved";
    };

    Regards,

    Anil.