Part Number: ADS1220
Hello,
I am using ADS1220 in my application. I use 2pair of differencial inputs to read analog signal. My assumption is to optimize the current as much as possible, so I go through the power down as fast as possible. The assumption is also to measure two channels one above the other and then put it to sleep for a specific time. I chose the continuous mode and full duplex as decribed in datasheet ( Figure 66. Example of Reading Data while Simultaneously Sending a WREG Command ).
I am using CS PIN (it is not tied low permanently). On SPI is only ADS1220 device. Below SPI configuration on uC:
#define NRF_DRV_SPI_DEFAULT_CONFIG \
{ \
.frequency = NRF_DRV_SPI_FREQ_2M, \
.mode = NRF_DRV_SPI_MODE_1, \
.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST, \
}
I have prepared two configurations for ADS1220:
static uint8_t m_tx_buf_CONF_1[] = {(WREG | CONF0 | 0x02), (MUX_P_AIN1_N_AIN0 | GAIN_128 | PGA_ON), (DR_G | NORMAL_MODE | CONTINOUS), (AVDD_REFIN | FIR_50_60 | PSW_OPEN | IDAC_OFF)};
static uint8_t m_tx_buf_CONF_2[] = {(WREG | CONF0 | 0x02), (MUX_P_AIN3_N_AIN2 | GAIN_128 | PGA_ON), (DR_G | NORMAL_MODE | CONTINOUS), (AVDD_REFIN | FIR_50_60 | PSW_OPEN | IDAC_OFF)};
Below I present pseudocode:
SEND_INIT_CONFIG (m_tx_buf_CONF_2)(CH2)
loop:
p.1 SEND_START (0x08)
p.2 WAIT_FOR_DRDY_IRQ
p.3 SEND_CONFIG ((m_tx_buf_CONF_1)(CH1)
p.3.1 GET_CONVERSION_RESULT_DUPLEX(CH2)
p.4 WAIT_FOR_DRDY_IRQ
p.5 SEND_CONFIG ((m_tx_buf_CONF_2)(CH2)
p.3.1 GET_CONVERSION_RESULT_DUPLEX(CH1)
p.6 SEND_POWERDOWN (0x02)
p.7 .... generic timer delay
p.8. go to p.1
The code works very well, but for undefined reasons, SPI dies after some undefined communication time. Is my idea correct? Or should I do it differently? Could this be a timimg problem? Unfortunately, this is a difficult situation to debug. It is hard for me to wait half a day for this situation to occur.
I will be grateful for any help.