TLA2528: TLA2528

Part Number: TLA2528

Tool/software:

Hello, 

     I am going crazy when trying to read adc values from TLA2528. 

The I2C single register read and write is fine. I set the FIX_PAT_ENABLE flag on register DATA_CFG and I expect to read 0xA5A but I get 0xFFA5.

I have set the capture in MANUAL MODE. The read of the STATUS REGISTER returns 0x80.

Moreover, if I have correctly understood the Datasheet on 7.4.2, after a 2-byte frame, the next 2 bytes will provide a new frame. In my case when I read 4 bytes, I get 0xFFA5FFFF.

The 0xFF on the frames are also well visible in the scope signal.

This is the code I use to read the channel data:

uint16_t TLA2528_read_one_channel_data(uint8_t channel_num)

{

err_t ret;

uint16_t dataread = 0;

uint32_t datareadt = 0;

i2c_cmd_handle_t cmd = i2c_cmd_link_create();

i2c_master_start(cmd);

i2c_master_write_byte(cmd, (m_TLA2528_address << 1 ) | READ_BIT, ACK_CHECK_EN);

i2c_master_read(cmd, (uint8_t*)&datareadt, 2, ACK_CHECK_EN);

i2c_master_stop(cmd);

ret = i2c_master_cmd_begin(I2C_MASTER_NUM, cmd, 100 / portTICK_PERIOD_MS);

i2c_cmd_link_delete(cmd);

 

dataread = (uint16_t)datareadt;

return dataread;

}

If I disable the FIX_PAT_ENABLE I get values which corresponds with the input voltage but always in one byte while the second byte is 0xFF.

What is wrong with my code?

Thank you

  • Finally I found the issue. 

    In the I2C read function I had to set the flag which set the NAK only for the last byte read. If I set ACK or NACK for each byte the read function does not work. I have not fully understood this (it does not seems to conform to datasheet directives) but it works.