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.

Cold reset vs. warm reset and IQmath

Other Parts Discussed in Thread: TMS320F2809

Hi,

I am working on TMS320F2809.  I use IQmath for processing ADC results and convert them to per unit values. I did some tests with same testing conditions except for cold reset and warm reset. There is something strange from the variables with IQ format after cold reset and nothing is wrong with ADC results from ADC result registers. 

All IQ variables have wrong values from cold reset. And these variables will have correct values after I do a warm reset.

Can anybody give me some suggestions? Thanks in advance!

Shujun

  • Sunjun,

    By cold reset, I assume you mean a power cycle, whereas a warm reset is RSTn pin or watchdog (or maybe a CCS reset, although this is actually not quite the same thing as the other two).

    Difference between cold and warm reset is that RAM contents are lost for a cold reset.  So, it sounds like you have something not being initialized correctly.  However, I'm not clear from your description of the problem what you are seeing.  You always have to start with a cold reset.  At that point, you're saying some IQ var is not correct.  You're saying it stays incorrect, but if you do a warm reset it suddenly becomes correct?  At what point after the warm reset does the var become correct?  It cannot be immediately after the reset.  It must be some code you are executing that writes the correct value to the var.  You will need to debug by stepping and/or executing chunks of code until you find out what is happening and where.  Then we can figure out why the cold vs. warm reset.

    Regards,

    David

  • Hi David,

    Yes. Cold reset means the DSP is re-powered up. Warm reset means RSTn pin or watchdog.

    After the cold reset, the IQ variables(updated at each ADC interrupt ) stay incorrect. They never become correct unless there is a warm reset. Once the DSP is powered up, I can get correct values for all IQ variables after a warm reset from RSTn pin or CCS reset. I could not do stepping since there is already a warm reset (CCS reset) before stepping. The only way to create such a symptom is to do a cold reset which CCS could not do.

    Regards,

    Shujun 

  • Shunjun,

    That is a very odd problem.  I'm afraid you're going to have to debug this and isolate the problem.  For example, is the ADC the thing that is having the problem (i.e., is the ADC result bad, so that your IQmath vars are bad)?  You can replace the ADC result with a constant var to eliminate the ADC from suspicion.  Also, debug/step the code that is supposed to write to these IQ vars.  You should be able to see what is going wrong.

    Good luck,

    David

  • Hi David,

    I found the result from the function below is incorrect.

     _iq UpdateGain(uint16_t cal_gain,uint16_t setting,_iq gain)
    {
    return _IQmpy(gain,_IQmpy(_Q14toIQ(cal_gain),_Q1toIQ(setting<<1)));
    }

    I need to call this function during initialization. If it is called once, I got incorrect IQ var. If it is called this twice during the initialiazation, everything is correct. I also update IQmath, it does not help.

    Did I make any mistakes for the function above?

    Regards,

    Shujun 

  • Shujun,

    You should be able to step through that function and determine why the result is incorrect the first time through.  For example, make sure the parameters passed correctly.  Replace one or more passed vars with a constant value.  Break apart the single C-code line in the function into several lines that produce intermediate results.  Check that the intermediate results are correct based upon the input parameters.

    None of the IQ functions in your C-code actually call functions.  Rather, the compiler directly inserts ASM code that performs the operations.  IQmpy is built in to the compiler.  Q14toIQ and Q1toIQ end up just being shifts that the compiler puts in to the ASM code.

    - David