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