AnsweredAssumed Answered

Generating a frequency

Question asked by Jairo Javier Sanchez on Oct 31, 2009
Latest reply on Nov 11, 2009 by Carl Norman

Hi i want to know if there's somebody who can help me with this, i need to generate a pulse signal in one pin (20 MHz). First of all i was able to do so but at very low frequencies compared with this, to achieve it i modified the timer example program to toggle the state of a pin. Another attempt i made was to copy the configuration made from Processor Expert and adapt it to MQX but with unsatisfactory results.


/************************** 20MHz USING GPT**************************************/ //*********************************************************************************************    printf("Inicializando frecuencia...");    clrReg8Bits(reg_ptr->GPT.GPTIE, 0x02);  //Disable interrupts    setReg8(reg_ptr->GPT.GPTSCR1, 0x00);    //Stop Timer    setReg8Bits(reg_ptr->GPT.GPTIOS, 0x0A);     clrSetReg8Bits(reg_ptr->GPT.GPTCTL1, 0xC8, 0x04);        clrReg8Bits(reg_ptr->GPT.GPTCTL2, 0xCC);               setReg8(reg_ptr->GPT.GPTSCR2,0x08);    setReg16(reg_ptr->GPT.GPTC1, 0x01U);    //Store the given number in the compare registry    setReg16(reg_ptr->GPT.GPTC3, 0x01U);    //                    setReg8Bit(reg_ptr->GPT.GPTSCR1 , 0x80U); //Run the timer

Regarding all my attempts i got some doubts with MQX

1. In time what is a tick?

2. Is there another way to toggle on/off a pin, or i got to use the ioctl functions?

3. Which is the minimum intervalusing the lwtimer instead the timer?


Thanks in advance.