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.

Linux/PROCESSOR-SDK-AM335X: PWMSS register change on kernel start

Part Number: PROCESSOR-SDK-AM335X

Tool/software: Linux

Hi,

Regarding: https://e2e.ti.com/support/embedded/linux/f/354/p/584899/2169023#2169023

I have set PWMSS_CTRL register in u-boot. But it does not retain its state!

BR

Stefan

  • The software team have been notified. They will respond here.
  • Hi Stefan,

    I suspect some code (u-boot, linux, user space) is overwriting the PWMSS_CTRL register value.

    Could you please clarify which version of the AM335x TI PSDK you are using, how and where exactly you set PWMSS_CTRL register in u-boot, and how and where exactly you check PWMSS_CTRL register afterwards?

    Regards,
    Pavel
  • Hi Pavel,

    I'm using u-boot-2017.01 and TI Linux Kernel (git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git, version 4.9.51).
    I set the pwmss_ctrl register in board.c:
    int board_init(void)
    {
    ...
    __raw_writel(0x00000002, 0x44E10664);
    ...
    }

    Afterwards I check it in a custom pwm driver. It is resetted during kernel startup. PWM output goes low before custom pwm driver is loaded.

  • STFZ said:
    I'm using u-boot-2017.01 and TI Linux Kernel (git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git, version 4.9.51).

    This latest version of the kernel that is tested and officially supported is v4.9.41, the one that comes with the latest AM335x TI PSDK v4.1

    I would suggest you to use u-boot-2017.01 and kernel 4.9.41 that comes with AM335x TI PSDKv4.1

    STFZ said:
    I set the pwmss_ctrl register in board.c:

    board.c file in u-boot or in kernel?

    Regards,
    Pavel

  • I have the same issue with PROCESSOR-SDK-LINUX-AM335X 03_02_00_05 (software-dl.ti.com/.../index_FDS.html)!!

    board.c file is in u-boot
  • Stefan,

    I assume you mean u-boot-2017.01/board/ti/am335x/board.c file.

    I would suggest you right after writel(), to read back the value from 0x44E10664 address and print it with printf

    int board_init(void)
    {
    ...
    __raw_writel(0x00000002, 0x44E10664);

    printf("%x\n", __raw_readl(0x44E10664));
    ...
    }

    Then interrupt the boot process, enter into the u-boot prompt and check again 0x44E10664 register value with md command. Thus you will be sure your value is accepted at u-boot stage and then not overwritten by u-boot code, but from linux or user space code.

    Regards,
    Pavel

  • Then you should check/verify the value in user space with devmem2 tool.

    See also:

    e2e.ti.com/.../557045

    Regards,
    Pavel
  • Hi Pavel,

    Thanks!

    Output during u-boot start:
    "DRAM:  512 MiB
    3
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1"

    Check register with md command:
    => md.l 0x44E10664 1
    44e10664: 00000003                               ....


  • devmem2 is a tool to read write memory during linux runtime?
    I think this doesn't help. I'm able to read this register in my custom driver with ioremap and ioread32.
    It is 0x00000000 at that time.
  • Stefan,

    Can you also print PWMSS_CTRL register value before you set it with 0x2, what well be the result?

    int board_init(void)
    {
    ...
    printf("%x\n", __raw_readl(0x44E10664));

    __raw_writel(0x00000002, 0x44E10664);

    printf("%x\n", __raw_readl(0x44E10664));
    ...
    }


    Check also what is the default value in register PWMSS_CTRL, with default u-boot code (remove your __raw_writel(0x00000002, 0x44E10664) modification), check with md command.


    What value exactly you need to set up in register PWMSS_CTRL? You might try with applying mask, thus change only the bit(s) you need and leave the rest bits unchanged.

    Note also that a special sequence might be needed for modifying register PWMSS_CTRL, see below pointers:

    AM335x TRM, section 15.2.2.3.4 Phase Locking the Time-Base Clocks of Multiple ePWM Modules


    e2e.ti.com/.../557045