I have the ADS1259 working in my system pretty much in it's default mode (10SPS). I'm able to turn the A/D sampling on/off (apparently), but I'm not setting the configuration registers correctly to increase the data rate. I've included my code (for an Atmel ARM SAM3X8C processor. I'd appreciate any pointers. I know this has to be something obvious.
I have one more issue, but I need to get over this as I may be able to resolve it in the configuration (data value appears to be rolling over well below max rate).
I've included my initialization source code below:
SPI Bus initialization:
// Clock polarity.
#define SPI_CLK_POLARITY 0 // Clock idles low
// Clock phase.
#define SPI_CLK_PHASE 0
// Delay before SPCK.
#define SPI_DLYBS 0x40
// Delay between consecutive transfers.
#define SPI_DLYBCT 0x10
spi_set_peripheral_chip_select_value(SPI0, SPI_CHIP_PCS);
spi_set_clock_polarity(SPI0, SPI_CHIP_SEL, SPI_CLK_POLARITY);
spi_set_clock_phase(SPI0, SPI_CHIP_SEL, SPI_CLK_PHASE);
spi_configure_cs_behavior(SPI0, SPI_CHIP_PCS, SPI_CSR_CSNAAT);
spi_set_bits_per_transfer(SPI0, SPI_CHIP_SEL, SPI_CSR_BITS_8_BIT);
spi_set_baudrate_div(SPI0, SPI_CHIP_SEL,(sysclk_get_cpu_hz() / gs_ul_spi_clock));
spi_set_transfer_delay(SPI0, SPI_CHIP_SEL, SPI_DLYBS, SPI_DLYBCT);
struct spi_device spi_device_conf = {.id = SPI_CHIP_PCS};
spi_master_setup_device(SPI0, &spi_device_conf, SPI_MODE_0, 9500000, 0); // <SC> bit rate to be determined
// ADS1259 Initialization
uint32_t ADS1259_Init(uint32_t config0, uint32_t config1, uint32_t config2) { printf("\r\nADS1259_Init"); Scale_Value = 0x00; Scale_Temperature = 0x00; // Configure ADS1259 /DRDY interrupt pio_set_input(PIOB, PIO_PB6, PIO_PULLUP); pio_handler_set(PIOB, ID_PIOB, PIO_PB6, PIO_IT_FALL_EDGE, ADS1259_Drdy_Handler); NVIC_SetPriority(PIOB_IRQn, 0); // Configure the AD7714 Chip Select and Reset Pins ioport_set_pin_dir(ADS1259_RST, IOPORT_DIR_OUTPUT); // Configure the reset pin // Reset the ADS1259 ioport_set_pin_level(ADS1259_RST, false); // reset the chip tdelay_ms(50); ioport_set_pin_level(ADS1259_RST, true); // clear reset tdelay_ms(400); spi_set_peripheral_chip_select_value(SPI0, SPI_CHIP_PCS); spi_write_single(SPI0, 0x11); // turn continuous mode off tdelay_ms(20); spi_write_single(SPI0, (ADS1259_COM_WREG | ADS1259_CONFIG0)); // Write Config0 address (0x40 | 0x00) spi_write_single(SPI0, 0x02); // write 3 bytes spi_write_single(SPI0, config0); // Bit Mask 1, 0, x, x, 0, bias enabled(1), 0, SPI timeout enabled // (config0 = 0x04) spi_write_single(SPI0, config1); // Bit Mask 0, 0, 0, filter mode(0), Ref external(1), START conversion delay // (config1 = 0x08) spi_write_single(SPI0, config2); // Bit Mask DRDY (read only), int/ext clock (read only), syncout(0), Gate/Pulse control mode (0-gate), 0, Sample rate(000 - 10SPS) // (config2 = 0x04) spi_write_single(SPI0, ADS1259_COM_RDATAC); // Start conversions (continuous mode) pio_enable_interrupt(PIOB, PIO_PB6); // Enable DReady interrupt NVIC_EnableIRQ(PIOB_IRQn); return 0; }