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.

Static variable initial data fault

Other Parts Discussed in Thread: TVP5154

Hello All,

We make a DM648 borad. (modified from EVM)

We have a problem now.  In _tvp5154.h, there are some declarations

#define _TVP5154_1_IIC_ADDR             (0x5E)    /**< TVP5154 #1 I2C address */
#define _TVP5154_2_IIC_ADDR             (0x5F)    /**< TVP5154 #2 I2C address */

...

typedef struct _TVP5154_decObj_t
{
    Uint8                addrI2C;
    /**< i2c address of the decoder */

    PAL_OsSemHandle      decChanSem;
    /**< decoder semaphore handle */

    Uint8                chanOpenCnt;
    /**< count for opened channel */

    _TVP5154_chanObj     chanObj[NUM_CHANNELS];
    /**< decoder channel objects */
}_TVP5154_decObj;   /**< Typedef for struct _TVP5154_decObj_t */

...

When we start to load the preview program, the variable's initial values delclared in tvp5154.c will be changed when started to run.

static _TVP5154_decObj decObj[NUM_DECODERS] =
{
{_TVP5154_1_IIC_ADDR, NULL, 0, {{0, 1}, {0, 2}, {0, 4}, {0, 8}}},
{_TVP5154_2_IIC_ADDR, NULL, 0, {{1, 1}, {1, 2}, {1, 4}, {1, 8}}}
};

These initial values will be changed to another one. The _TVP5154_1_IIC_ADDR is not 0x5E, it changed to 0x0E.

But we can assign the correct value(0x5E) in program as follow.

static Int32 TVP5154_powerdown(_TVP5154_chanObj *chan, Bool powerDownEnable)
{
    Uint8 powerdownSettings = TVP5154_OP_MODE_POWER_OFF_VAL; /* off default */
    Uint8 addrI2C = 0;
    Uint8 numBytes = 1;
    Uint8 enableDecoder = TVP5154_RESERVED_POWER_ON_VAL;
    Int32 retVal = EDC_SUCCESS;
    Uint8 readVal = 0x00;
    Uint8 decoderChan = 0;

    EDC_DEBUG("Entered ---> TVP5154_powerdown\n");
    EDC_DEBUG2("_TVP5154_chanObj = 0x%0.8X, powerDownEnable = %d \n",
               chan,
               powerDownEnable);

    decoderChan = chan->chanMask;
    //addrI2C = decObj[chan->decNum].addrI2C;
 addrI2C=0x5e;
    /* Check for Power Up */
    if (!powerDownEnable)
    {

...

The preview program work well. We check the bootmode & pinmux, the values is meet our settings.

Would anyone give some advices?

Thanks!