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.

LMP90100 delay in read register

Other Parts Discussed in Thread: LMP90100

Hello,

I am struggling to understand the process of reading the data out of the ADC_DOUT register. I am using MC9S12XET256 microcontroller to communicate with the LMP90100 using sampling rate 214 sps continuously for 4 seconds. The data that I read out seems to have a shift/delay. The first 3 read out (of 3 bytes) return '0' value. I suspect that my fourth data, which is non-zero, is actually the first data. The value just do not put on the bus until the fourth readout. Below is how I do the read:

SPI1_TxChr[0] = 0x10;    // write to addres
SPI1_TxChr[1] = 0x01;    // upper addres
SPI1_TxChr[2] = 0xCA;    // read data - 3 Byte - lower addres
SPI1_TxChr[3] = 0x00;    // 1. DummySendByte
SPI1_TxChr[4] = 0x00;    // 2. DummySendByte
SPI1_TxChr[5] = 0x00;    // 3. DummySendByte
snd = ADC_SPI1_SendBlock(SPI1_TxChr, 6, &sendbyte_SPI1);

rec = ADC_SPI1_RecvBlock(SPI1_RxChr, 6, &receivebyte_SPI1);

Because I am inheritate the code from another engineer, I am not able to explain why the 3 dummy send bytes are there, but it works 'better' this way.

I also see the same behaviour as I perform single read from the CH0_Config register (Address 0x21) to obtain the sampling rate value. In this case, I have to consecutively perform the read for 5 times before I see the register's value.

Anybody has any idea of why there is a 'delay' in my implementation? Perhaps a wrong configuration etc...?


Yours sincerely,

Huck Lim

  • Hello again,

    to make it clear what my question is, below is the ADC output that I read:

    62 0
    248 0
    434 0
    620 915
    806 926
    992 803

    column one is the counter value to indicate time scale. Column 2 is the ADC_DOUT register value that I read.

    The problem is the 3 rows of '0'.

    I am using 53.6 Hz sample per second, reading 3 bytes of data per Read.

    Thanks in advance for your helpful insight.

    sincerely,

    Huck

  • Hello everyone,

    I have found the reason. The buffer pointer was not set to the beginning of the buffer, therefore, the real data was somewhere in the buffer. We cleared the buffer before write/read the ADC value (via SPI) and it works.

    Thanks.

    Yours sincerely,

    Huck