Part Number: ADS1018
Tool/software:
The sampling channel is misaligned, which is normal at first, but after a while the channel reading is confused, and the value of channel 2 is read when reading channel 1.
What needs to be checked?
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.
Part Number: ADS1018
Tool/software:
The sampling channel is misaligned, which is normal at first, but after a while the channel reading is confused, and the value of channel 2 is read when reading channel 1.
What needs to be checked?
Hi Hui,
What exactly do you mean by "The sampling channel is misaligned" and "after a while the channel reading is confused"?
Do you mean that when writing to the configuration register to select a different mux setting, when you read new data it still belongs to the previous configuration?
How are you determining that the ADC conversion result corresponds to the previous mux setting rather than the current Mux setting? Are the input signals different and this is how the ADC conversion is determined to be from the previous channel configuration?
Are you operating the device in continuous or single-shot mode?
When cycling through the mux it is better to use single-shot mode. The main reason is that when running in continuous mode the new configuration will not take place until the conversion ends if there is already an ongoing conversion. This will require that the next conversion after the mux change needs to be thrown away so that the conversion result is valid for the desired mux input.
I would recommend using single-shot mode when taking ADC reading from different channels.
In single-shot mode the mux change and read of conversion can take place at the same time. Once it is determined that the conversion has completed, the new configuration can be written and the conversion started at the same time as reading the previous conversion result as the SPI communication is full-duplex. For this use case, there is no need to throw out an invalid conversion
Best Regards,
Angel
we use singe-shot mode.
ADS1018 we use four channels, using the multiplexer Mux switching, using a single shot mode, data rate 3300sps, in the main loop each channel first write a configuration register value, delay 1ms, read again. Delay 1ms. The next main loop reads and writes the second channel. The read/write data is the HAL_SPI_TransmitReceive function provided with the HAL library.
But after some time (seconds or tens of seconds) has passed since the first channel was sampled correctly, the first channel reads incorrectly and reads the value of the second channel.
Could you give some advise, thanks.
Hi Hui,
So there are separate loops running simultaneously for the different MUX configurations?
It would be best to simply have one mux setting, then read the ADC conversion result for that setting when it is ready, then set the next mux setting, do the ADC conversion reading for that setting when it's ready, then set the next mux setting and so on, rather than having separate loops where the timings can interfere with each other, if I'm understanding correctly.
Can you provide logic analyzer captures of the SPI digital communication to the device?
This will help verify what you are actually writing to and reading from the device and in what order, to verify if the configurations are being set correctly and the ADC readings done in the correct desired order.
Best Regards,
Angel