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.

LCD backlight control using PWM/CAP pin in OMAP L138/AM18XX

Other Parts Discussed in Thread: AM1808, OMAPL138, OMAP-L138, TPS65070

Hi,

 

I am working on AM1808 processor, I have designed my LCD back-light with the below pin mux configuration.

 

I have configured ECAP2 & EPWM0 (#define PWM_DEVICE_ID          "ehrpwm.0" &&  #define PWM_DEVICE_ID  "ecap.2")

 

two configuration, but it is not working. This ECAP2 & EPWM0 pin we are controlling with LCD backlight. But at the boot time

 

I need the uboot configuration and also where I need to configure it in kernel. Please find my LCD pwm driving circuit

Please need your suggestions to enable the LCD backlight using pwm or ecap.. 

 

Thanks,

Francis

  • Hi Francis,

    Thanks for the post.

    Kindly provide more details on the pinmux configuration which you have shared in the above thread inorder to help you out.

    Please refer Example 17-1 (Page no.444) in Section 17.2.1 to implement various ePWM module configuration and Section 16.3 will provide applications examples and code snippets to show how to configure and operate the eCAP module in the OMAPL138 TRM below

    http://www.ti.com/lit/spruh77

    Please refer Section 5.28 (ECAP) & Table 5-124 for the list of the ECAP registers & Section 5.29 (eHRPWM) & Table 5-127. eHRPWM Module Control and Status Registers Grouped by Submodule in the OMAPL138 datasheet below:

    http://www.ti.com/lit/omap-l138

    Thanks & regards,

    Sivaraj K

    ---------------------------------------------------------------------------------
    Please click the
    Verify Answer button on this post if it answers your question.
    ---------------------------------------------------------------------------------

  • Hi Sivaraj,

    Please find the below pinmux configured registers

    /*******************/
    MUX_CFG(DA850, ECAP0_APWM0, 2, 28, 15, 2, false)
    /* eCAP1 function */
    MUX_CFG(DA850, ECAP1_APWM1, 1, 28, 15, 4, false)
    /* eCAP2 function */
    MUX_CFG(DA850, ECAP2_APWM2, 1, 0, 15, 4, false)
    /*******************/

    Thanks,

    Francis

  • Hi,

    Still i am not getting the answer for my above LCD back-light query.

    Please do the needful.

    Thanks,

    Francis

  • Hi Francis,

    Thanks for the post. 

    Schematic design review:

    I hope, you have referred the schematics review checklist to design the circuit. 

    If not please review with below wiki links.

    http://processors.wiki.ti.com/index.php/Hardware_Design_Checklist

    http://processors.wiki.ti.com/index.php/OMAP-L13x_/_C674x_/_AM1x_Schematic_Review_Checklist

    Sample programs:

    • You shall test the LCD back light control by writing/modifying the samples provided by TI.
    • The Starterware 01.10.03.03 has the examples & drivers for OMAP-L138.

    Link to Starterware: http://processors.wiki.ti.com/index.php/StarterWare

    Logic PD EVM's has the LCD Brightness control on DA850/OMAP-L138:

    Refer PSP releases 03.22: http://processors.wiki.ti.com/index.php/DaVinci_(ARM9)_PSP_Releases#DA850.28Spectrum_Digital_EVM.29.2C_DA830.28Spectrum_Digital_EVM_and_Spectrum_Digital_WiFi_EVM.29_and_OMAP-L138.28_Logic_PD_EVM_and_LCDK.29

    Linux configuration: http://processors.wiki.ti.com/index.php/LCD_brightness_control_on_da850/omap-l138

    Link to hardware resources shall be found at: http://processors.wiki.ti.com/index.php/OMAP-L138_designer%27s_resource_guide

  • Hi,

    I configured in my hardware the pin “ECAP2 APWM2” is defined as CAP2. With this pwm I want to control the LCD backlight.

    With the below link patch I have modified my kernel and I am able to see the sysfs file under the /sys/class/pwm/ecap.2/run

    http://linux.davincidsp.com/pipermail/davinci-linux-open-source/2010-October/020567.html

    when I am running and trying to fire the below commands it is not giving any action and not litting my LCD. The pin ECAP2 APWM2

    is shows always 0 V with the help of my CRO.

    At least the platform driver part have created and find the below response using SYSFS. Please give your suggestions.

    root@am180x-evm:~# echo 0 > /sys/class/pwm/ecap.2/run

    root@am180x-evm:~# echo 100000000 > /sys/class/pwm/ecap.2/period_ns

    root@am180x-evm:~# echo 500000000 > /sys/class/pwm/ecap.2/duty_ns

    root@am180x-evm:~# echo 1 > /sys/class/pwm/ecap.2/run

    root@am180x-evm:~# echo 0 > /sys/class/pwm/ecap.2/run

    root@am180x-evm:~# echo 1 > /sys/class/pwm/ecap.2/request

    kernel BUG at drivers/pwm/pwm.c:127!

    Unable to handle kernel NULL pointer dereference at virtual address 00000000

    pgd = c3b68000

    [00000000] *pgd=c3ace031, *pte=00000000, *ppte=00000000

    Internal error: Oops: 817 [#1] PREEMPT

    last sysfs file: /sys/devices/platform/ecap.2/pwm/ecap.2/request

    Modules linked in:

    CPU: 0    Not tainted  (2.6.33-rc4 #228)

    PC is at __bug+0x20/0x2c

    LR is at release_console_sem+0x1f8/0x210

    pc : [<c004e414>]    lr : [<c005f55c>]    psr: 60000013

    sp : c1c5dec0  ip : c1c5de00  fp : c1c5decc

    r10: c1c5df70  r9 : c29df618  r8 : c0457580

    r7 : c3842cc8  r6 : c29df600  r5 : c3956b10  r4 : c3842e40

    r3 : 00000000  r2 : 00000000  r1 : 0002650b  r0 : 0000002b

    Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user

    Control: 0005317f  Table: c3b68000  DAC: 00000015

    Process sh (pid: 1206, stack limit = 0xc1c5c270)

    Stack: (0xc1c5dec0 to 0xc1c5e000)

    dec0: c1c5dee4 c1c5ded0 c01a4898 c004e404 00000002 c3956b10 c1c5defc c1c5dee8

    dee0: c01a4910 c01a4860 00000002 c3956b10 c1c5df0c c1c5df00 c01d9e0c c01a4908

    df00: c1c5df3c c1c5df10 c010efc0 c01d9df8 c1c5df70 c3b5c180 4001f000 c1c5df70

    df20: 00000002 00000002 c1c5c000 00000001 c1c5df6c c1c5df40 c00c2f10 c010eec0

    df40: c1c5dfa4 c1c5df50 c00622d4 00000000 00000000 c3b5c180 00000002 4001f000

    df60: c1c5dfa4 c1c5df70 c00c3080 c00c2e68 00000000 00000000 c1c5dfa4 00000000

    df80: c00d0544 00000002 4001f000 401f35d0 00000004 c004b0a4 00000000 c1c5dfa8

    dfa0: c004af20 c00c304c 00000002 4001f000 00000001 4001f000 00000002 00000000

    dfc0: 00000002 4001f000 401f35d0 00000004 00000002 000b13f0 00000001 000b1008

    dfe0: 00000000 bed0a598 4012f4d0 401829ec 60000010 00000001 00000000 00000000

    Backtrace:

    [<c004e3f4>] (__bug+0x0/0x2c) from [<c01a4898>] (pwm_release+0x48/0xa8)

    [<c01a4850>] (pwm_release+0x0/0xa8) from [<c01a4910>] (pwm_request_store+0x18/0x20)

     r5:c3956b10 r4:00000002

    [<c01a48f8>] (pwm_request_store+0x0/0x20) from [<c01d9e0c>] (dev_attr_store+0x24/0x28)

     r5:c3956b10 r4:00000002

    [<c01d9de8>] (dev_attr_store+0x0/0x28) from [<c010efc0>] (sysfs_write_file+0x110/0x148)

    [<c010eeb0>] (sysfs_write_file+0x0/0x148) from [<c00c2f10>] (vfs_write+0xb8/0x164)

    [<c00c2e58>] (vfs_write+0x0/0x164) from [<c00c3080>] (sys_write+0x44/0x70)

     r8:4001f000 r7:00000002 r6:c3b5c180 r5:00000000 r4:00000000

    [<c00c303c>] (sys_write+0x0/0x70) from [<c004af20>] (ret_fast_syscall+0x0/0x28)

     r8:c004b0a4 r7:00000004 r6:401f35d0 r5:4001f000 r4:00000002

    Code: e1a01000 e59f000c eb0be792 e3a03000 (e5833000)

    ---[ end trace bebfff2765c682cc ]---

     _____                    _____           _         _

    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_

    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|

    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|

                  |___|                    |___|

    Arago Project http://arago-project.org am180x-evm ttyS2

    Arago 2010.12 am180x-evm ttyS2

    am180x-evm login:


    Thanks,

    Francis

  • Hi Francis,

    1. Have you reviewed your schematics with LogicPD EVM? 

    2. Please find observation from above log, The kernel version seems old and it uses pwm.c instead ehrpwm.c driver.

    Suggestion:

    Please download the PSP from AM18x from below link.

    http://processors.wiki.ti.com/index.php/DaVinci_(ARM9)_PSP_Releases#AM18x

    Please follow the steps provided in the below wiki and check the LCD backlight.

    http://processors.wiki.ti.com/index.php/LCD_brightness_control_on_da850/omap-l138

    Thanks.

  • Hi Francis,

    Have you tested PWM with examples provided in Starterware? 

    Thanks.

  • Hi,

     

    We procured AM1808 EVM from logicPD from long back i.e 2 1/2 years gone, which have backlight LCD using LG 3.5 Inch one.

     

    I observed TI haven’t given any PWM calls in kernel and in boot loader. Because it is direct control which goes 5V to DC-DC

     

    regulator and gives the constant voltage between 19V-28V based on the load. You cannot control these backlight intensity using any calls what I observed till.

     

    The backlight POWER is going with respect to PWM, but pwm is not controlling under Linux & bootloader. You can’t find any SYSFS calls after extracted the kernel

     

    for doing any examples.

     

    The same schematics we designed in our board, But we are able to lit the LCD, But you can’t control it. At present I am using WLED(TPS6507x) to drive the

     

    LCD. But this IC is getting more load due to LCD current, because with this TPS65070 IC, I can mange 15V-18V maximum and even the LCD flickers in

     

    sometime after drain my battery to 25% level.

     

    After seen 2.6.37 kernel they have given PWM calls, but it is not working after compiled all the kernel.

     

    Thanks,

    Francis 

  • Hi Francis,

    Note:

    Please check the board revision of Logic PD. The older revision uses eCAP whereas the latest revisions uses the eHRPWM peripheral.

    Step to build:

    All your commands looks OK. Please try with following kernel version.

    1. Please download the PSP(Kernel source) from AM18x from below link.

    http://processors.wiki.ti.com/index.php/DaVinci_(ARM9)_PSP_Releases#AM18x

    2. Enable the PWM supports in Menuconfig

     Device Drivers ---> <*> PWM Support ---> <*> Davinci eHRPWM support 
     Device Drivers ---> <*> PWM Support ---> <*> eCAP PWM support  
    3. Disable the Framebuffer & SPI controller support in Menuconfig as below
     Device Drivers ---> Graphics support ---> <*> Support for frame buffer devices ---> < > DA8xx/OMAP-L1xx Framebuffer support 
     Device Drivers ---> [*]SPI support ---> < > Texas Instruments DaVinci/DA8x/OMAP-L/AM18x SoC SPI controller 
    4. Build the kernel.
    Testing the PWM with built kernel:
    1. Please follow the below wiki link to control the PWM using eHRPWM. (The valid instance should be 0 to 1)
    http://processors.wiki.ti.com/index.php/AM335x_PWM_Driver's_Guide#eHRPWM_2
    2. Please follow the below wiki link to control the PWM using eCAP. (The valid instance should be 0 to 2)
    http://processors.wiki.ti.com/index.php/AM335x_PWM_Driver's_Guide#eCAP_2
    3. To verify, probe the eHRPWM / eCAP pin's.
    Thanks.
  • Hi Francis,

    Look at the similar thread, In which they are able to modify the LCD brightness using eCAP on the LogicPD & using eHRPWM on a custom board.

    http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/p/279120/974813.aspx#974813

    Thanks.

  • Hi Rajasekaran,

     

    Thanks a lot for your valuable suggestions.

    At lost finally, I am able to drive my LCD using PWM as well as duty cycle for controlling the back-light intensity.

    The problem is still there is open in AM1808 Kernel., After gone through AM335X driver across i have modified my eCAP driver then it is running.

    Problem is PWM driver is not probing, This change need to be done in board-da850-evn.c & pwm_bl.c.


    Once again thanks for your comments.

    Thanks,

    Francis