ADS1256 troubleshooting

Hi All,

Has anyone successfully used an AS1526 ADC with a particle device before.

We are having some trouble getting started with this ADC. We are attempting to use the following library:

Some considerations, our device connects to the ADC (CS pin and DRDY pin) through an I2C so I have updated the ADS library code that toggles the CS select and reads the DRDY pin. The MISO, MOSI and SLK pins connect to D11, D12, and D13 on our BSOM.

We are trying to use the simple_begin_status example from the above repo. We are having trouble getting the ADC status to read 1.

We are using a Vref of 4.5 rather than 2.5 and a crystal of 8MHz.

Can anyone give me some pointers on how to troubleshoot this? Or had anyone successfully used this ADC?

MISO, MOSI, and SCK sound correct.

I presume you're using a I2C to GPIO converter like a MCP23008 for the CS line. Assuming it's implemented correctly, that's fine. We do that on the Tracker, though we use an SPI version of the chip. Make sure you clear the CS pin after SPI.beginTransaction() and set it back to 1 before SPI.endTransaction().

Are you able to read any registers? Try reading the MUX register (0x01). If you get back 0xff you're not successfully communicating by SPI so look there first.

Also just to be sure:

  • DVDD (digital VDD) is 3V3 (3.3V)
  • VREFP is 4.4V as you said
  • VREFN is GND, presumably
  • What's AVDD connected to? That must be in the range of 4.75 to 5.25V. Does your B SoM base board have a 5VDC power supply, or if battery powered, a boost converter?

What are you passing to SPI.begin() since you're not using a hardware GPIO for CS? It must be set to PIN_INVALID in order to function properly.

The best way to troubleshoot this is a logic analyzer that does SPI decoding. I use the Saleae Logic 8 for things like this.

2 Likes

Hi Rick,

Thanks for the great information. For the CS line we are using a PCF8574 I2C, which is working correctly when tested.

We were just using SPI.begin(), so I will update to SPI.begin(PIN_INVALID); and try again.

Wiring:

  • DVDD connected to 3.3V VCC. I will confirm with multimeter.
  • VREFP connected to 4.5V. I will confirm if this stable.
  • VREFN connected to GND. I will confirm it is GND and stable.
  • AVDD connected to 5V.

Trying to get a Hantek B6022BE working here as a logic analyser, it's cheap but hopefully will shed some light on the situation.

Hi Rick,

I am attempting to read the MUX register (0x01) with the below code. I don't have serial access to the device until later today. The response from the particle publish below is readRegister: 0x00

void readRegister(){
	SPI.begin(PIN_INVALID);
	I2C_2.digitalWrite(P2, LOW);
	SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE1));

	// Attempt to Read MUX register (0x01)
	unsigned char readValue;
	SPI.transfer(0x10 | 0x01); // 0x10 - read register command, 0x01 - Mux register
	SPI.transfer(0);
	delayMicroseconds(7);              //  t6 delay (4*tCLKIN 50*0.125 = 6.25 us)    
  	readValue = SPI.transfer(0);       // read registers, if 0xff then comms not successful
  	delayMicroseconds(1);              //  t11 delay (4*tCLKIN 4*0.125 = 0.5 us)  
	Serial.print("Read MUX register: ");
	Serial.println(readValue,HEX);
	
	// Set cs to low
	I2C_2.digitalWrite(P2, HIGH);
	SPI.endTransaction();

	// Particle Function 
	char s[50];
  	snprintf(s, sizeof(s),"readRegister: 0x%02x", readValue);
  	Particle.publish("readRegister", s, PRIVATE);
}

EDIT (for the benefit of anyone else that may have trouble with this ADC): So there was a wiring issue regarding the SYNC pin on the ADC. I think this pin could have been held low for too long as a result of the issue, which causes the ADC to power down.

Since fixing we have moved back to the library from my first post and are able to successfully read from the status and MUX registry. Still having some trouble getting readings from the channels, but I believe this may be a timing issue.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.