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.

MADC operation

I am trying to use the MADC driver under the CE6 A8 35XX BSP as part of an improved battery driver.

My board uses the same 65950 part.

I can enable the MADC driver from the catalog and from debug everything seems to initialize and load correctly.

When I call the MADCReadValue function it return with data = 0 no matter what channel I use.

Tracing into I see the ReadGeneralPurposeLines function in madc.cpp (~line 314)  never get the conversion complete flag and just falls through with a zero reading.

Any ideas? Has the MADC driver been tested?

  • Some more info:

    In the wait for conversion complete loop the CTRL_SW1 register always seems to be returning 0xdd no matter how long I wait.

    The busy bit never seems to clear and the SW_EOC_SW1 is never set.

  • after reading this post in the PMU forum:

    http://e2e.ti.com/support/power_management/pmu/f/43/t/30817.aspx#107398

    I see I have the exact same problem. Most likely the power domain or the clock are not turned on.

    I believe the correct place to set these would be in the bsp_tps659xx.c InitTwlPower routine.

    It tried adding:

    TWLWriteByteReg(hTwl, TWL_VINTANA1_DEV_GRP, TWL_DEV_GROUP_P1);
    TWLWriteByteReg(hTwl, TWL_VINTANA2_DEV_GRP, TWL_DEV_GROUP_P1);
    TWLWriteByteReg(hTwl, TWL_VINTDIG_DEV_GRP, TWL_DEV_GROUP_P1);

    val = TwlTargetMessage(TWL_PROCESSOR_GRP1, TWL_VINTANA1_RES_ID, TWL_RES_ACTIVE);
    TWLWriteByteReg(hTwl, TWL_PB_WORD_MSB, (UINT8)(val >> 8));
    TWLWriteByteReg(hTwl, TWL_PB_WORD_LSB, (UINT8)val);
    val = TwlTargetMessage(TWL_PROCESSOR_GRP1, TWL_VINTANA2_RES_ID, TWL_RES_ACTIVE);
    TWLWriteByteReg(hTwl, TWL_PB_WORD_MSB, (UINT8)(val >> 8));
    TWLWriteByteReg(hTwl, TWL_PB_WORD_LSB, (UINT8)val);
    val = TwlTargetMessage(TWL_PROCESSOR_GRP1, TWL_VINTDIG_RES_ID, TWL_RES_ACTIVE);
    TWLWriteByteReg(hTwl, TWL_PB_WORD_MSB, (UINT8)(val >> 8));
    TWLWriteByteReg(hTwl, TWL_PB_WORD_LSB, (UINT8)val);

     

    but it did not seem to have any effect. I am not exactly sure just how this works or the correct sequence.

    Any suggestions?

     

  • It is working now. Was indeed a clock issue.

    PMU data manual states MADC_HFCLK_EN and DEFAULT_MADC_CLK_EN are set by default but it does not seem to be the case.