I'm connecting up to a high resolution ADC (TI's ADS1247) via SPI bus and am able to initialize the device and read back the configuration registers and get it to do everything I want it to using my Arduino Mega 2560 (including take an extremely precise read from a PT100 RTD).
But when I try to use a Pro Mini, it fails completely. I have no clue what's going on short of there being an underlying configuration problem with the SPI bus. Ground planes on the Pro Mini are all tied together, and the devices are being powered from the USB-FTDI board. I've also tried dropping in a 0.1uF decoupling cap between Vcc and Gnd to no avail. I have tried different delays and wait times while initializing the bus and at key points (soft reset of the ADC etc).
Here's a subset of the code that I'm using:
SPI.setClockDivider(SPI_CLOCK_DIV16);
SPI.setDataMode(SPI_MODE1);
SPI.begin();
SPI.transfer(0x06); //Reset
delay(1000);
SPI.transfer(0x14); //SDATAC
SPI.transfer(0x4B); //Set IDAC1 Register (0Bh) Write 01h - Output reference current on ANIN0,1
SPI.transfer(0x00);
SPI.transfer(0x01);
SPI.transfer(0x4A); //Set IDAC0 Register (0Ah) Write 07h - Select 1.5mA reference current for RTD
SPI.transfer(0x00);
SPI.transfer(0x07);
SPI.transfer(0x43); //Set SYS0 Register (03h) Write 52h - PGA:32, Sample at 20sps
SPI.transfer(0x00);
SPI.transfer(0x52);
SPI.transfer(0x42); //Set MUX1 Register (02h) Write 30h - Select internal reference always on, internal ref connected to REF0 pins. Use 33h if wanting an on chip temp read.
SPI.transfer(0x00);
SPI.transfer(0x30);
SPI.transfer(0x40); //Set MUX0 Register (00h) Write 01h
SPI.transfer(0x00);
SPI.transfer(0x08);
Register data is dumped via a 1s loop of:
//Register Dump
SPI.transfer(0x20);
SPI.transfer(0x0F);
for(int i=0; 16>i; i++)
{
A2DVal = 0x0;
A2DVal |= SPI.transfer(0xFF);
Serial.println(A2DVal,HEX);
}
Serial.print("\n\n");
delay(1000);
Like I said, it works flawlessly on the Mega 2560 so I don't understand why the Pro Mini is on the struggle-bus. Any ideas?!!
Cheers,
Josh.