hello :
I have an OMAP3530 development board.the use of power management chip TPS65930.
I need to use the AD functionality of the TPS65930.
But when I programmed encountered a problem:
I use SW1 request to begin the channel 2 AD converter.
CTRL_SW1 [0] BUSY is always 1, CTRL_SW1 [1] EOC_SW1 always 0. GPCH2_LSB and GPCH2_HSB always 0.
If I do not turn off the power and restart the chip, the value cannot be changed.
this error may be what problem.
Thanks a million.
My code is as follows:
void adcTest(void)
{
u8 valBuf;
u8 reg;
u8 readBuf;
// 1.Close interrupt MADC_IMR1[1] SW1_IMR1set 1: Interrupt is masked
valBuf = 0xff;
reg = MADC_IMR1;
twl_i2c_write_u8(TWL4030_MODULE_MADC, valBuf, reg);
// 2.Before starting a GP conversion, the host processor powers on the MADC by setting the CTRL1[0]MADCON bit to 1.
// MADC software power on. When set to 1, MADC is powered.
valBuf = 0X01;
reg = CTRL1;
twl_i2c_write_u8(TWL4030_MODULE_MADC, valBuf, reg);
// 3.The host processor also enables averaging on the selected channel by setting the corresponding bits
// of the SW1AVERAGE_LSB and SW1AVERAGE_MSB registers to 1.
valBuf = (0X01 << 2);
reg = SW1SELECT_LSB;
twl_i2c_write_u8(TWL4030_MODULE_MADC, valBuf, reg);
valBuf = 0X0;
reg = SW1SELECT_MSB;
twl_i2c_write_u8(TWL4030_MODULE_MADC, valBuf, reg);
// 4. The host processor then requests the start of the conversion by setting the CTRL_SW1[5] SW1 bit to 1.
valBuf = 0X0;
reg = SW1AVERAGE_LSB;
twl_i2c_write_u8(TWL4030_MODULE_MADC, valBuf, reg);
valBuf = 0X0;
reg = SW1AVERAGE_MSB;
twl_i2c_write_u8(TWL4030_MODULE_MADC, valBuf, reg);
// 5.The host processor then requests the start of the conversion by setting the CTRL_SW1[5] SW1 bit to 1.
valBuf = (0X1 << 5);
reg = CTRL_SW1;
twl_i2c_write_u8(TWL4030_MODULE_MADC, valBuf, reg);
// 6.While conversion is in progress, the CTRL_SW1 EOC_SW1 bit is set to 0.
// When the selected channel conversion sequence completes, the CTL_SW1 EOC_SW1 bit is automatically set to 1.
mdelay(1000);
readBuf = 0x00;
reg = CTRL_SW1;
twl_i2c_read_u8(TWL4030_MODULE_MADC, &readBuf, reg);
printk(KERN_ERR "CTRL_SW1 = 0x%x\r\n", readBuf);
// 7. After the end of each channel conversion, the results are written into the corresponding GPCH2_LSB and GPCH2_MSB registers
reg = GPCH2_LSB;
twl_i2c_read_u8(TWL4030_MODULE_MADC, &readBuf, reg);
printk(KERN_ERR "GPCH2_LSB = 0x%x\r\n", readBuf);
reg = GPCH2_MSB;
twl_i2c_read_u8(TWL4030_MODULE_MADC, &readBuf, reg);
printk(KERN_ERR "GPCH2_MSB = 0x%x\r\n", readBuf);
}