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.

CC2530DK IR generation

Other Parts Discussed in Thread: REMOTI, CC2530, CC2533, CC2540, Z-STACK

Section 9.9 describes how to do IR signal generation using T1 in combination with T3.

However, the documentation is not very clear (at least to me) and I'm having trouble making this work. As far as I can tell, the RemoTI sample code does not use these techniques or maybe I'm missing something.

Has anyone got IR working in the way that is described?

Is there an App note or sample code??

Thanks,

  • Answering my own question, I have a partial fix for this.

    The documentation for this in the CC2530 user guide is wrong.

    The following code generates the T3/Ch1 output as shown in FIG 9-8 using pins 1.6 & 1.7.

    I have yet to get T1 to respond correctly and toggle the IR on and off.

        CLKCONCMD = 0;
        while (CLKCONSTA != 0);// wait until stable

        PERCFG |= BIT5;    // Timer 3 using alt 2 config (pins 1.6/ch0 & 1.7/ch1)

        P1SEL = 0xff;        // peripheral function
        P1DIR = 0xff;        // output
       
        // T3
        T3CTL = 0;
        T3CTL |= 0x2 << 5;                // prescaler /4
        T3CTL |= TIMER_MODULO_MODE;

        T3CC0 = 210;                // ~38kHz
        T3CCTL0  = 0;
        T3CCTL0 |= BIT6;            // c0 IE
        T3CCTL0 |= BIT2;            // compare mode
        T3CCTL0 |= 0x3 << 3;        // 3: set compare-up, clear compare-down (up/down) or set compare, clear 0
        T3CCTL0 |= 0x7 << 3;        // init output pin

        T3CC1 = T3CC0/3;            // controls duty cycle (width of +ve pulses as % of T3CC0 period)
        T3CCTL1  = 0;
        T3CCTL1 |= BIT6;            // c0 IE
        T3CCTL1 |= BIT2;            // compare mode
        T3CCTL1 |= 0x4 << 3;        // clear compare-up, set compare-down (up/down) or clear compare, set 0
        T3CCTL1 |= 0x7 << 3;        // init output pin

        T3CTL |= BIT2;                // clear
        T3CTL |= BIT4;                // start

  • Hi Klinkenbecker,

    The RemoTI software release includes an IR driver, see hal_irgen.h/c. The driver is using RC5 and RC6  as example IR codes, but this can be changed to other IR code formats. The BasicRemote sample application provides example application code for using the driver.  This is enabled by the HAL_IRGEN compiler flag.

    The "RemoTI Basic Remote Developer's Guide" (SWRU223A) chapter 15 provides information for how to configure the IR driver. This document can be downloaded from http://focus.ti.com/docs/toolsw/folders/print/remoti-cc2530dk.html under the technical documents section.

    We are working on a more comprehensive IR application note.  Estimated completion of this is end of Oct.

    Thanks,
    Stig

     

     

  • The HAL code does not work. The code I have tries to use T4 instead of T3 and when I ran it it does nothing.

    The cc2530 user guide IR section is exceptionally badly written, being ambiguous in almost every sentance. This is confusing to soemone new to the chip family.

    It is also completely wrong in one crucial sentence (p105);

    "The duty cycle of the carrier is set using T3CC1 Channel 1 uses compare mode: “Set output on compare, clear on 0xFF” (T3CCTL1.CMP = 101). Table 9-2
    shows the frequency error calculation for a 38 kHz carrier using Timer 3"

    This can >never< happen in modulo mode, the counter will never reach 0xFF.

    Thanks,

  • Hi Klinkenbecker,

    I agree that that sentence in the user guide looks wrong. I've made it work by using mode 3:


    static void setupCarrier(uint8 prescaler, uint8 period, uint8 offPeriod) {

      T3CCTL0 = 0x10|0x04; // Compare mode 2
      T3CC0 = period;
      T3CCTL1 = 0x18|0x04; // Compare mode 3
      T3CC1 = offPeriod;

      T3CTL = prescaler<<5|0x10|0x02; // Div, Start, modulo
    }

    static void generateIRCommand(uint16 commandSize, uint16 *decompressedPeriods, uint16 *decompressedOffPeriods) {
        uint16 timer1period, timer1toggle;
        uint8 dmaDesc0[16];
        uint8 dmaDesc1[16];

        // Setup DMA
        dmaDesc0[0] = ((uint16)&decompressedOffPeriods[1]) >> 8;
        dmaDesc0[1] = (uint16)&decompressedOffPeriods[1];
        dmaDesc0[2] = ((uint16)&X_T1CC1L) >> 8;
        dmaDesc0[3] = (uint16)&X_T1CC1L;
        dmaDesc0[4] = 0x00;
        dmaDesc0[5] = commandSize-1;
        dmaDesc0[6] = 0x82;
        dmaDesc0[7] = 0x40;

        dmaDesc1[0] = ((uint16)&decompressedPeriods[1]) >> 8;
        dmaDesc1[1] = (uint16)&decompressedPeriods[1];
        dmaDesc1[2] = ((uint16)&X_T1CC0L) >> 8;
        dmaDesc1[3] = (uint16)&X_T1CC0L;
        dmaDesc1[4] = 0x00;
        dmaDesc1[5] = commandSize-1;
        dmaDesc1[6] = 0x82;
        dmaDesc1[7] = 0x40;

        DMA0CFGH = (uint16)dmaDesc0 >> 8;
        DMA0CFGL = (uint16)dmaDesc0;

        DMA1CFGH = (uint16)dmaDesc1 >> 8;
        DMA1CFGL = (uint16)dmaDesc1;

        // Timer1 setup
        timer1period = decompressedPeriods[0];
        timer1toggle = decompressedOffPeriods[0];

        T1CCTL0 = 0x10|0x04;
        T1CC0L = timer1period;
        T1CC0H = timer1period >> 8;

        T1CCTL1 = 0x18|0x04;
        T1CC1L = timer1toggle;
        T1CC1H = timer1toggle >> 8;

        // Arm DMA channels
        DMAARM = 0x03;

        // Start Timers
        T1CTL = 0x02; // Div 1, modulo
    }

    A couple of things to keep in mind with respect to the IR functionality:

    - It only works with Timer3 as carrier generator and Timer1 as modulo counter. Timer4 can not be used.

    - The IRGEN bit has to be set for Timer1 to count Timer3 ticks.

    Peder

  • Hi,

    Apologize for long post.

    Can anyone please help me on this?

    I am working on this RF to IR signal conversion module in Network processor.I used RemoTI stack as it is for this feature but it is not working as it mentoned in this thread.Since current RemoTI stack is using timer4 not timer3.

    To make use of timer3,I have done some changes in timer configurations of HalIrGenInit() function.But its not working.

    When I used timer 4, IR LED was always turned ON and when I used timer3,IR LED is not at all turned ON including key press.

    Is there any code which has correct configurations for IR signal generation which can be used in current RemoTI stack.

     

     

    While reading this thread,I am not able to understand some points.

    It will be useful if you elaborate more on the generateIRCommand().I am not able to understand its functionality completely.

    I am assuming that I have to use generateIRCommand() function in where I am getting RF keycodes

    Could you please explain me the arguments in the function generateIRCommand(), means what is decompressedPeriods & decompressedOffPeriods? and from where I will get that.

    After seeing your sentence "I agree that that sentence in the user guide looks wrong",I am confused,Is there any other document or code which is working fine.please help me to use correct configurations for RF to IR conversion.

     

    Waiting for reply.

    Thanks

    Johnson J.

     

  • The library code does NOT work for the reason you describe.

    I can confirm that both the previous posts describe code that does work for this and output IR.

    You will need to write you own library function based on these posts and the CC2530 user guide section 9.x IR generation with the caveat that one >key< sentence is wrong. You must use T3CC1 mode 3.

    It will take you about 10-50 reads of that section AND running the code of my post to understand what it says. Running my posted code, connect your scope to pins P1_6/P1_7 to see the effect of setting the timers this way - then you will comprehend the words of IR section 9.x.

    The IR section is incredibly poorly written as it is ambiguous in nearly every critical sentence. I've a mind to re-write and post it, but time is money and these posts do solve the issue for the sake of a little effort of understanding.

    Klinkenbecker

     

  • "We are working on a more comprehensive IR application note.  Estimated completion of this is end of Oct." (2009)

    Is there any update regarding the new IR application note, because I cant find anything like that on the TI site?

    Thanks

  • Hi Stan,

    Sorry for the delay.  Still working on the doc but I've uploaded the code to this thread: 8540.IrGenApp.zip

     

    The goal of the code is to show how to use the hw features of CC253x for IR generation. Example drivers and sample code (incl. IIR repeat sequence) is provided for the following IR formats

    1. NEC (pulse distance encoding)

    2. SIRC (pulse distance and pulse width encoding)

    3. RC5 (Manchester encoding)

     

    Instructions:

    1. Unzip the attached IrGenApp.zip at the top level directory of a RemoTI 1.2.1 installation.

    2. Open the IrGenApp workspace in the \Projects\RemoTI\IrGenApp\CC2533RB folder and select the IR format configuration (NEC/SIRC/RC5)

    3. Build/download to the Target Board and run the sample code.

    4. Wait until the red LED is turned off (This LED is turned on when the stack is initializing)

    5. Press the S1 key to enable discovery/pairing mode. The green LED will be blinking when in this mode.

    6. Press the pairing button on a remote controller when the green LED is blinking. The green LED will turn on solid when the pairing link is established.

    7. Press the ‘play’ key on the remote controller to start IR generation and observe the red LED is turned on when IR signal generation is in progress.Note that other keys on the remote controller have no effect since the 'play' key is the only mapped key.

    Note that the generated IR output is active high. Early versions of the Target Board had the IR polarity reversed.  More information about this can be found in chapter 6.1.7 of the CC2533 RF4CE Basic Development Kit Hardware User's Guide (www.ti.com/lit/swru266)

     

    Hope this helps.

    Stig

     

  • Hi Stig,

    I finally found couple hours to play last weekend with your code, but stuck in the middle of nowhere: I don't have the remoTI kit, but I have the cc2531dk dongle and tried instead the "Play" key to use the onboard S1 key to fire a simple  IR code generation. The point where I stuck is the so called callback function  that should handle interrupts from S1 key - IRG_KeyCback(uint8 keys, uint8 state) which is defined in irg_target_NEC.c - I cant never ever go  there :(  (I put a breakpoint there inside at the begining and  tried clicking on S1 without any result, but I can  debug /trace in hal_key.c: halProcessKeyInterrupt(void) after S1 cliking). So obviously I could insert my code in halProcessKeyInterrupt which is in hal_key.c, but the question is why   - IRG_KeyCback doesnt work as suppose to, or most probably I'm doing some mistake so could you recommend me some manuals, simple examples et where can read about S1 interrupts, flags, mask, handling function  etc whatever is involved?

    Thank you and best regards

    P.S. I tried with your original variant  for NEC, and one my modified version where just only bypass the radio / pairing functions RTI_** etc with #ifndef MYTEST /#endif

     

     

     

  • Finally, problem identified and solved : There is one update for IAR EW21912 that must be installed, else a mismatch in parameters for functions/ procedures happens. ( In my case call for osal_start_timerEx(0x02,1,25)   >>>  and the parameters that  appears in the body of the function were 0x36,1,25  :(  :(  )

    Now the IR generation works on cc2531dk (havent checked  in details yet if the code generated is correct as is little difficult to pinpoint the scope's probe on the LED1, but the graph  looks like Ok)

    Thanks again Stig

     

  • Hi Stig,

     Is it available and any example and for IR decoding on cc253x or cc2540?

  • I am not sure how close to the metal you want to get, but this is all you actually need to do learning. I don't use the TI code.

    I post this by way of illumination, not as a 'solution'.

    It basically just captures the interrupts for all the edges on the IR input port and saves the mark/space clock counts of a  timer set to 38khz.

    There are some control state variables to detect the end of learning, but it is a very simple process. Can be run as a task or a function. Pin to watch depend on which pin you have the IR input on.

    The cmTimer functions are there so it doesn't wait forever, you will need other timing mechanisms to achieve the same result.

    static void learnDone()
       {
        // terminate learning
        T1IE = 0;
        irCode.onceCount = 0;
        irLearning = false;
        irDone = true;
        irPair = 0;
    #ifdef DEBUG
        P1_6 = 0;
    #endif
        P1_3 = 1;    // IR_LRN disable

        // turn off the indicator

        _sysLedSet(LEARNING_LED, kLedOff);
        }

    static TIMER learnTimer;
    void learn(byte intCode) // interrupt handler
        {
        word count;
        (void)intCode;

        T1CNTL = 0;    // reset the clock

        if (T1STAT & CH2IF)
            {
            // IR pin transition
            T1STAT &= ~CH2IF;

            if (irLearning == false)
                {
                // start learning
                irPair = 0;
                irLearning = true;
                cmSetTimer(learnTimer, CM_TIMER_DISABLED);
                return;
                }

            // recover ch2 count
            count  =  T1CC2L;
            count |= (T1CC2H << 8);
            irCode.once[irPair++] = count;
            }

        if (T1STAT & CH0IF)
            {
            // T1 overflows T1CC0 (max quiet time - we're done)
            T1STAT &= ~CH0IF;

            if (irLearning == true)
                {
                // done learning
                T1IE = 0;
                irCode.onceCount = irPair;
                irLearning = false;
                irDone = true;
                irPair = 0;
                P1_3 = 1;    // IR_LRN disable
                return;
                }

            // still waiting for start
            }
        }

    //TaskBegin(learn, 0, (void))
    void learnCode()
        {
        irDone = false;
        irLearning = false;

        // turn on the indicator - do this before the mosfet!
        _sysLedSet(LEARNING_LED, kLedOn);

        // turn on the mosfet
         P1_3 = 0;    // IR_LRN_ENABLE

        // give it chance to turn on completely
        {unsigned i; for (i = 0; i < 500; i++);}

        T3CC0 = FREQ_38K_MODULO;    // we can only learn 38k for now

        // T1 ch0
        T1CCTL0  = BIT2;    // compare mode
        T1CCTL0 |= BIT6;    // c0 IE
        T1CC0L = irDwellTimer >> 0 & 0xff;
        T1CC0H = irDwellTimer >> 8 & 0xff;

        // T1 ch2
        T1CCTL2 = BIT0 | BIT1 | BIT6;    // capture all edges, interrupt set

        // make sure T1 ch1 & 3 are shut down
        T1CCTL1 = 0;
        T1CCTL3 = 0;

        ivecTable[0x09] = learn;// set interrupt handler
        T1CNTL = 0;        // reset
        T1STAT = 0;
        T1IF = 0;
        T1IE = 1;        // T1IE on
        EA = 1;            // EA on

        cmSetTimer(learnTimer, pLearnIrTimeout);
        while (!irDone) T_Yield();
        cmSetTimer(learnTimer, CM_TIMER_DISABLED);
        }
    //TaskEnd(learn)

  • Hi

    Could someone please help me with deveolping a code or rather modifyring the code in the TI example software (light_switch linked to CC2530 DK) so that the other 3 LEDs on the Smart RF05EB can be lit as well.

     

    Thanks!

     

  • Hi Peder,

     Can you give me your IRGEN project to me?

    Thank you!

    mei

  • Hi Peder,

    I can not understand this :

    T1CC0L = timer1period;
    T1CC0H = timer1period >> 8;

    Why T1CC0H = timer1period >> 8;?

  •  timer1period is declared as: uint16 timer1period,... (which means 16bit unsigned int ;)  )

    T1CC0L and T1CC0H are 8bit registers, so to split the 16bit number into two 8bit registers you need the above written gymnastic >>8 (shift 8bits to the right)

  • Hi Peder,

    I use the code you give: static void setupCarrier(uint8 prescaler, uint8 period, uint8 offPeriod)  and static void generateIRCommand(uint16 commandSize, uint16 *decompressedPeriods, uint16 *decompressedOffPeriods) , the result is cc2530 generate the ir code with no end, and all of the code is the same although  the values in decompressedPeriods array are different. Can you tell me the reason?

    Thank you!

    Demon

  • Have you been used CC2530 infrared decoder? I met a technical problem. I can't decode, can see reply?

  • hi Damon,

     Have you solve it out ? I met the same trouble with you . can you tell me how to do?

    thanks.

  • hi  Peder,

    Can you give me a working project file?

    thanks

  • Hi Tomas,

    Meanwhile, we have released the appnote for IR generation including a full working project. It is located here:

    http://www.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=swra323

    Regards,

     

    Peder

  • hi  Stig,

    I can't find it ,can you give me your guide?

  • hi Peder,

     

    When I was in the "3343. The RemoTI _IR CC253xDK - 1.3 - Gen - Patch" package decompression on  the RemoTI 1.3.1 protocol stack directory is compile irGENAPP engineering Error Error [Pe020] : identifier "VDD_MIN_FLASH is undefined" C: \ Texas Instruments \ RemoTI CC253xDK - 1.3.1 \ Components \ \ cc2530 \ osal_snv osal \ MCU C 339 could you tell me how to modify? Thanks a lot.

     

  •  I have got it ,i  have change VDD_MIN_FLASH to  VDD_MIN_XNV.  becase VDD_MIN_FLASH  is undefine . in addition , CC2533 project doesn't have this problem

  • Hi Tomas,

    Here's an updated project for the latest installer RemoTI-1.3.1.

    6747.RemoTI-CC253xDK-1.3.1_IR_Generation.zip

    It's the same as the old one except that I added IR functionality for the Basic Remote project. In the white remote that comes with the kit there's an IR diode. The Basic Remote project in the 1.3.1 installer has been updated to match the white remote hardware. When you press the 'Play' button an NEC IR command is generated.

  • I see infrared modulation are added RF4CE agreement, now I want to do a have infrared learning equipment, is the home of the infrared remote control to the device key, I do study it then equipment of pulse and saved through the zigbee protocol transmission to the gateway. My mobile phone can learn by gateway receives the pulse, and then to phones, mobile phone remote control software can control devices in the home, is to develop an APP on android to control the home equipment. I do terminal have infrared modulation and decoding ability, I don't want to add RF4CE agreement. Do you have this project under the excuse me? Is a project with a zigbee protocol can study (with learning impulse and the ability to launch studying to pulse), don't need the android app, I can develop their own. ?

  • hello, the project is downloaded to the target board? The Remote control or download before, Basic project of the project

  • Hi Tomas,

    The IRGen project is meant for a CC2533EM mounted on the RemoTI Target Board. The BasicRemote project, rsa_cc2533arc, is meant for the white remote that comes with the kit.

  • Do you have the target board schematic diagram? I can send a? Black and white remote control principle diagram and the principle of remote control chart is the same? Did I want to ask next use remote control to send RF4CE command to the control signal from the infrared target board? My board is yourself, so software in some places to change. Could you tell me the target board according to the two key is defined that a few pins? I see protocol stack IRGENAPP P20 is served for the little lights in the pin to pin as buttons again. Didn't understand, can you give a detailed word format of the operation? Best operating process step by step with pictures, thanks a lot.

  • Hi Tomas,

    I don't understand exactly what you want to do. However, here is the schematics for the RemoTI kit http://www.ti.com/tool/remoti-refdes. The Advanced Remote schematic is found here: 2438.RF4CE_4MOD Rev C schematic.pdf.

  • Thank you for the schematic diagram, I look at that IRGEN engineering is said in the press the S1 button to allow matching target board, I see the official protocol stack definition of S1 is P1_2 pin inside, is this? Another problem is the target board schematic diagram GLED, RLED is low level light, then why protocol stack is defined in a high level? Don't understand. Use the P11 to launch infrared target board. P10 to accept infrared? The schematic diagram can't see the figure of chip. Can explain? Thanks a lot. Do you have no more convenient way to contact? I post you are sleep, when you reply I was sleeping, the time difference is too make people hurt

  • Hi Tomas,

    Where are you located? Please try to contact your local TI support for more immediate communication.

  • hi  Torbjorn Sorby,

    I am in Beijing, China. Can you introduce a recent agency contact information of your company? I currently has been using TI chip, but I always feel not timely communication

     

  • Do you have a reference example of the infrared decoding? Protocol stack.

  • I add a infrared in the zigbee protocol stack decoding function, my approach is to an external interrupt began to use the timer 1 time, I succeeded on the bare machine, added to the protocol stack timer can't open, can't count. Could you tell me why?

  • Hi Tomas,

    I don't understand what you mean by "added to the protocol stack timer can't open, can't count", so it's hard to answer.

    For IR decoding you can do almost the same as for IR generation. For the demodulated signal change Timer 1 from Output Compare to Input Capture, bit 2 in T1CCTLn (n refers to the channel. For IR generation it's channel 1, which is mapped to P1.1, for demodulation I guess you're connected to P1.0, so channel 2.). Reverse the DMA settings; i.e. set RAM array as destionation address, this address should increment, set Timer 1 Channel 2 as source address, i.e. T1CC2H, 1 word per transfer, no increment on source address. On the first interrupt on P1.2, you can then arm the DMA, set peripheral control to the pin and start Timer 1. When the IR signal is received you stop Timer 1, stop the DMA and set back P1.2 as GPIO to trigger on next signal. The IR signal is now in RAM and can be analyzed to figure out what the message was. All the registers I refer to are found described in www.ti.com/lit/swru191.

    The same can be done to find the Carrier frequency. Just use Timer 3 instead.

  • Do you have the infrared decoding reference project? It is best to bring OS. I can be decoded without OS, but joined the zigbee protocol stack is a problem, I found the counter don't count, I doubt it because the timer 1 as it did on the OS also served for the counting of the infrared decoding. I now is to use the P1.0 to decode. Thanks a lot

  • I don't have a decoding project. Timer 1 is not used by any stack.

  • OS tick is not using the timer 1? Actually I just add your decoding program to protocol stack is out of question. That your colleague has such a project? Thanks a lot

  • These days has been trouble you, thank you for your answer. Now I may not be added under the condition of protocol stack decoding, but added to the protocol stack, the counter is a problem, don't know can you understand what I mean?

  • i  am working with cc2530

    I  am applying your drvie with bebow:

    void main(void)
    {
    uint16 IRdata[2]={0x55,0x55};
    uint16 IRdataoff[2]={0x55,0x55};
    setupCarrier(0x02,210,70);
    generateIRCommand(2,IRdata,IRdataoff);
    while(1);

    }

    but i am fail to do it !Never IR wave generated !

    so  following question i asked:

    1.Do CC2530 support  HW IR generator?

    2.Function (generateIRCommand()) :what mean do decompressedPeriods and decompressedOffPeriods reprensent?

    3. which pin  is IR OUT?(i have tested P1.1 ,but not )

    4.why  do i fail to generate IR Wave  with your drive?

  • Hi,

     
    I'm working on the IR Gen project on CC2533EM. I want to control my Sony TV by IR. I have installed RemoTI-1.3.1 and the IR Gen project in the following order:  the swra323 and the 3343.RemoTI-CC253xDK-1.3_IR-Gen-Patch.zip and the update 6747.RemoTI-CC253xDK-1.3.1_IR_Generation.zip. I'm working with IAR 8.30 version.

    I added a simple lines of code to generate IR command and launched the SIRC version on the Target Board. The red diode and the IR diode are blinking but the TV does not respond. The IR command and address is probably correct-moreover I have tested many common addresses and commands of the Sony TV.

    Colud you help me?  I do something wrong maybe. Do anyone control a TV with this project?

    The IR controller is an important part of my thesis. I will be grateful for help.

    Best regards,

    Ma Go

  • Hi Ma Go,

     

    I would recommend you to hook up a logical analyzer on the output of the IR LED, or use an IR receiver that can be used for sniffing. Then you can compare if the output signal from the remote matches the signal that you are trying to emulate.

     

    Regards,

    Jose

  • Hi Jose,


    thanks for your reply. Unfortunately I don't have any logical analyzer and IR receiver that can be used for sniffing. In addition I would avoid checking (in detail debugging) of logical output state.


    I hope the IR project is prepared for CC2533EM so it should work properly without deeply investigate in code.

    If  someone says that the project doesn't work at all it is valuable information too. Then I must start code from begining my own version of IR generation because correcting someone else's code isn't nice.


    Maybe the version of IAR workbench is the problem? But I don't think so. I use 8.30 IAR workbench.

    Best regards,

    Ma Go

  • Hello,

    I have found this code in a reply (by Peder)  to this thread.

    Anyone please explain this code.Also please write comment in front of each instruction.

    static void setupCarrier(uint8 prescaler, uint8 period, uint8 offPeriod) {

     T3CCTL0 = 0x10|0x04; // Compare mode 2

     T3CC0 = period;

     T3CCTL1 = 0x18|0x04; // Compare mode 3

     T3CC1 = offPeriod;

     T3CTL = prescaler<<5|0x10|0x02; // Div, Start, modulo

    }

    static void generateIRCommand(uint16 commandSize, uint16 *decompressedPeriods, uint16 *decompressedOffPeriods) {

       uint16 timer1period, timer1toggle;

       uint8 dmaDesc0[16];

       uint8 dmaDesc1[16];

       // Setup DMA

       dmaDesc0[0] = ((uint16)&decompressedOffPeriods[1]) >> 8;

       dmaDesc0[1] = (uint16)&decompressedOffPeriods[1];

       dmaDesc0[2] = ((uint16)&X_T1CC1L) >> 8;

       dmaDesc0[3] = (uint16)&X_T1CC1L;

       dmaDesc0[4] = 0x00;

       dmaDesc0[5] = commandSize-1;

       dmaDesc0[6] = 0x82;

       dmaDesc0[7] = 0x40;

       dmaDesc1[0] = ((uint16)&decompressedPeriods[1]) >> 8;

       dmaDesc1[1] = (uint16)&decompressedPeriods[1];

       dmaDesc1[2] = ((uint16)&X_T1CC0L) >> 8;

       dmaDesc1[3] = (uint16)&X_T1CC0L;

       dmaDesc1[4] = 0x00;

       dmaDesc1[5] = commandSize-1;

       dmaDesc1[6] = 0x82;

       dmaDesc1[7] = 0x40;

       DMA0CFGH = (uint16)dmaDesc0 >> 8;

       DMA0CFGL = (uint16)dmaDesc0;

       DMA1CFGH = (uint16)dmaDesc1 >> 8;

       DMA1CFGL = (uint16)dmaDesc1;

       // Timer1 setup

       timer1period = decompressedPeriods[0];

       timer1toggle = decompressedOffPeriods[0];

       T1CCTL0 = 0x10|0x04;

       T1CC0L = timer1period;

       T1CC0H = timer1period >> 8;

       T1CCTL1 = 0x18|0x04;

       T1CC1L = timer1toggle;

       T1CC1H = timer1toggle >> 8;

       // Arm DMA channels

       DMAARM = 0x03;

       // Start Timers

       T1CTL = 0x02; // Div 1, modulo

    }

  • Hi Dhanraj,

    The code is explained in this appnote: 

    Peder

  • Hello,
    Thanks a lot for quick response.

    I have this raw data for a Samsung Remote how can I generate the IR signal ?

    19948 usec, 4500 usec
    4400 usec, 580 usec
    1620 usec, 600 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    1620 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    1620 usec, 580 usec
    520 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 600 usec
    1600 usec, 600 usec
    1620 usec, 580 usec
    46080 usec, 4500 usec
    4400 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 600 usec
    1620 usec, 580 usec
    500 usec, 600 usec
    500 usec, 600 usec
    500 usec, 600 usec
    500 usec, 600 usec
    500 usec, 580 usec
    520 usec, 580 usec
    1640 usec, 580 usec
    520 usec, 580 usec
    520 usec, 580 usec
    500 usec, 600 usec
    500 usec, 600 usec
    500 usec, 600 usec
    500 usec, 600 usec
    1620 usec, 580 usec
    500 usec, 600 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 580 usec
    1620 usec, 600 usec

    Regards
    Dhanraj
  • Hi Dhanraj,

    Check section 4.3.2 in the provided application code. Your signal seems to be pulse width encoded. Figure out how many us each tick consumes and then figure out what the timer values need to be to match your signal. Typically you'll find that the timing values are the same for each IR signal, but they may be ordered differently. Use this knowledge to find a way to code each signal from bits to timing values.

  • I have one more confusion -
    I am using Z-stack home 1.2.1 for rest of the Home automation application (ON/OFF,LEVEL CONTROL,WINDOW COVERING,COLOR CONTROL,GROUP SCENES etc).

    but I have recently started with IR generation.I want to make IR blaster (zigbee to IR)using cc2530.

    I have one confusion -

    For IR generation - should I use RemoTI application or should I implement IR generation algorithm in Z-stack home?
    Or RemoTI can be added with z-stack home?
  • Hi Dhanri,

    The IR generation utilize features of the CC25xx MCU family, that's the only dependency. It works well with any RF protocol, as long as the RF protocol is not timing critical; such as RemoTI (RF4CE). It may work with Z-stack Home Automation, at least as long as you're an end node.