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.

CC2340R5: Arm-based microcontrollers forum

Part Number: CC2340R5


Tool/software:

Hello,

Using LGPT0 and LGPT1 of CC2340R5 timers it is possible to generate IR codes, but there is no driver for this.
Are there any materials for implementing a IR driver, which is working in an freeRTOS environment?

Thanks.

  • Hi,

    In the past, I have worked on a standalone FreeRTOS project which uses the IRGEN feature you've describe.

    Give me a few days to retrieve this and I can share with you.

    Will update here within 4 business days.

    Thanks,
    Toby

  • Hi,

    I still need more time for this.

    In the meantime, please refer to TRM section "10.4.3 IR Generation".

    Will update here again within 4 business days.

    Thanks,
    Toby

  • Hi Toby,

    Thank you for your willingness to help.
    I have not yet resolved this issue.
    So I will wait patiently.

    Natan.

  • Hi Natan,

    Here is a sample code which shows how to use the IRGEN feature.

    You will likely need to adjust it for your particular waveform.

    The output is on DIO11.pulseDistEncIR_LP_EM_CC2340R5_freertos_ticlang.zip

    Thanks,
    Toby

  • Hi Toby,

    Got it and compiled it. Looks very professional, respect.

    I need some time to work on it. Will report the results.

    Many thanks for the work done.

    Natan.

  • Hi Toby,

    1. test_lgpt(), test_ir_lgpt_hwreg() tested and working ok

    2. test_pdeir() working, but I don't understand everything.

    3. test_ir_lgpt() need to add:

    if (useIrGen)
    {

    ...

    LGPTimerLPF3_start(lgpt1Handle, LGPTimerLPF3_CTL_MODE_UP_PER); 
    }

    After that it works.

    Thanks,

    Natan

  • Hi Toby,

    1. NEC Infrared Transmission Protocol helps with test_pdeir():
             https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol

    2. For test_pdeir() to work correctly, it is necessary to make changes in the IR_PDE_LPF3_REG.c file, PDEIRLPF3_modulator_callback() function:

       2.1. 

    case PDEIRLPF3_STATE_DATA_CODE_2:
    {
    if ((1 << pdeIrObj->bitIndex) & gCurTrans.dataCode)
    {
    // bit is 1
    //activeCount = NEC_bitval_1.activeCount;
    //frameCount = NEC_bitval_1.frameCount;

    // bit is 1, but we need the 1's complement for this state
    activeCount = NEC_bitval_0.activeCount;
    frameCount = NEC_bitval_0.frameCount;

    }
    else
    {
    // bit is 0
    //activeCount = NEC_bitval_0.activeCount;
    //frameCount = NEC_bitval_0.frameCount;

    // bit is 0, but we need the 1's complement for this state
    activeCount = NEC_bitval_1.activeCount;
    frameCount = NEC_bitval_1.frameCount;

    }

      2.2.

    case PDEIRLPF3_STATE_STOP_BIT:
    {
    //activeCount = 0;
    activeCount = NEC_bitval_0.activeCount;

     2.3. Optional

    case PDEIRLPF3_STATE_REPEAT_CODE_2:
    {
    activeCount = NEC_repeat[1].activeCount;
    frameCount = NEC_repeat[1].frameCount;
    // pdeIrObj->state = PDEIRLPF3_STATE_REPEAT_CODE_1;
    pdeIrObj->state = PDEIRLPF3_STATE_IDLE; // repeat code only once

    3. The test_pdeir() module was tested with the LG-24LJ4540 TV, for this:


       3.1.

    In the empty.c file, in the test_pdeir() function, the following was changed:
    PDEIRGENLPF3_Transaction pdeIrTrans;
    // pdeIrTrans.customCode = 0x40;
    pdeIrTrans.customCode = 0x04; // For TV LG-24LJ4540
    // pdeIrTrans.dataCode = 0x1D;
    pdeIrTrans.dataCode = 0x08; // For TV LG-24LJ4540, command ON/OFF
    PDEIRLPF3_transfer(pdeIrHandle, &pdeIrTrans);


       3.2. The transmitter module is connected to the DIO11 output (Observing the load capacity of the DIO11 output !!!)


       3.3. Everything works ok.

    Toby, thank you very much for your help.


    Best regards,

    Natan