After a hardware reset, is the ADS1259 in Read Data Continuous mode or not?
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.
I see that the ADS1299 data sheet (with similar interface) in the Command Definitions table says:
Enable Read Data Continuous mode. RDATAC 0001 0000 (10h) This mode is the default mode at power-up.(1)
(1) When in RDATAC mode, the RREG command is ignored.
Are these things also true of the ADS1259?
If so, does that mean I can do a WREG transfer while in Read Data Continuous mode?
Or do I need to issue a SDATAC command first?
Hi Emmett,
I would assume RDATAC is the default mode. Every code example for the ADS1259 that I've seen begins with the "SDATAC" command before sending any additional commands.
Regards,
Chris
Chris,
Thanks for your post.
The empirical evidence bears that out to be true.
The only command I send in RDATAC mode is the SDATAC command and everything works now.
Thanks,
Emmett
Hi David,
We are communicating through custom IP in our FPGA, so our code wouldn't apply to other platforms.
Here is the flow we are using:
Hi David,
Those are SPI commands sent to the ADC to write to the CONFIG1 and CONFIG2 resigsters. See table 19 and table 20 in the data sheet.
Regards,
Chris
Hi Christopher,
Thank you.
I want to start single conversion in pulse mode, and when I started the OPCODE for START I preform task like in datasheet Figure 52. Pulse Control Mode,
and DRDY goes low when data is rdy and triggers an interrupt on pin P1.2 and in the interrupt routine is sending RDATA OPCODE to read data MSB MID LSB and i get for inputs tied low MSB=FF MID=FF LSB=9F i thin it should be all MSB=0x00 MID=0x00 LSB= something small what is the problem?
MY code:
// Description: Toggle P1.0 by xor'ing P1.0 inside of a software loop.
// ACLK = 32.768kHz, MCLK = SMCLK = default DCO~1MHz
//******************************************************************************
#include <msp430.h>
#include "gpio.h"
#include "inc/hw_memmap.h"
#include "usci_a_spi.h"
#include "ucs.h"
#include "wdt_a.h"
uint8_t transmitData = 0x00, receiveData1 = 0x00, receiveData2 = 0x00, receiveData3 = 0x00, junk = 0x00, DMSB = 0x00, DMID = 0x00, DLSB =0x00;
int main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop WDT
GPIO_setAsOutputPin(
GPIO_PORT_P1,
GPIO_PIN3
); // START as output
P4DIR |= 0x08; // Set P4.3 to output direction
P4SEL |= BIT0+BIT4+BIT5; // P4.0,4,5 option select
GPIO_setAsInputPin(GPIO_PORT_P1, //DRDY inpit for interupt
GPIO_PIN2);
// interuprt DRDY on pin P1.2
P1IES |= BIT2; // high -> low is selected with IES.x = 1.
P1IFG &= ~BIT2; // To prevent an immediate interrupt, clear the flag for
// P1.2 before enabling the interrupt.
P1IE |= BIT2; // Enable interrupts for P1.2
_enable_interrupt();
GPIO_setOutputHighOnPin( //CS high
GPIO_PORT_P4,
GPIO_PIN3
);
GPIO_setOutputLowOnPin( //START low
GPIO_PORT_P1,
GPIO_PIN3
);
UCA1CTL1 |= UCSWRST; // **Put state machine in reset**
UCA1CTL0 |= UCMST+UCSYNC+UCMSB; // 3-pin, 8-bit SPI master,Clock polarity low, MSB
UCA1CTL1 |= UCSSEL_2; // SMCLK
UCA1BR0 = 0x02; // /2
UCA1BR1 = 0; //
UCA1MCTL = 0; // No modulation
UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
//UCA1IE |= UCRXIE; // Enable USCI_A0 RX interrupt
P4OUT &= ~0x08; //CS low
for(i=50000;i>0;i--);
// Reset to power-up values RESET
transmitData = 0x06;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
//TransmitData
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
for(i=50000;i>0;i--);
GPIO_setOutputHighOnPin(GPIO_PORT_P4,
GPIO_PIN3);
P4OUT &= ~0x08;
for(i=50000;i>0;i--);
// Stop Read Data Continuous mode SDATAC
transmitData = 0x11;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
//TransmitData
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
for(i=50000;i>0;i--);
GPIO_setOutputHighOnPin(GPIO_PORT_P4,
GPIO_PIN3);
P4OUT &= ~0x08;
for(i=50000;i>0;i--);
// Write register CONFIG0,1,2 at address 0h,1h,2h
transmitData = 0x40;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
transmitData = 0x02;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
transmitData = 0x01;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
transmitData = 0x08;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
transmitData = 0x10;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
for(i=50000;i>0;i--);
GPIO_setOutputHighOnPin(GPIO_PORT_P4,
GPIO_PIN3);
P4OUT &= ~0x08;
for(i=50000;i>0;i--);
//Read register CONFIG0,1,2 at address 0h,1h,2h
transmitData = 0x20;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
transmitData = 0x02;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
transmitData = 0xFF; //dummy for clk
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
junk = USCI_A_SPI_receiveData(USCI_A1_BASE);
receiveData1 = USCI_A_SPI_receiveData(USCI_A1_BASE);
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
junk = USCI_A_SPI_receiveData(USCI_A1_BASE);
receiveData2 = USCI_A_SPI_receiveData(USCI_A1_BASE);
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
junk = USCI_A_SPI_receiveData(USCI_A1_BASE);
receiveData3 = USCI_A_SPI_receiveData(USCI_A1_BASE);
for(i=50000;i>0;i--);
GPIO_setOutputHighOnPin(GPIO_PORT_P4,
GPIO_PIN3);
P4OUT &= ~0x08;
for(i=50000;i>0;i--);
// Read data
// START conversion
transmitData = 0x08;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
//TransmitData
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
while(1){};
}
#pragma vector = PORT1_VECTOR
__interrupt void P1_ISR(void) {
switch(P1IFG & BIT2) {
case BIT2:
P1IFG &= ~BIT2; // clear the interrupt flag
//Read data by opcode RDATA
transmitData = 0x12;
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
//TransmitData
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
transmitData = 0x00; //dummy for clk
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
junk = USCI_A_SPI_receiveData(USCI_A1_BASE);
DMSB = USCI_A_SPI_receiveData(USCI_A1_BASE);
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
junk = USCI_A_SPI_receiveData(USCI_A1_BASE);
DMID = USCI_A_SPI_receiveData(USCI_A1_BASE);
//USCI_A0 TX buffer ready?
while (!USCI_A_SPI_getInterruptStatus(USCI_A1_BASE,
USCI_A_SPI_TRANSMIT_INTERRUPT)) ;
USCI_A_SPI_transmitData(USCI_A1_BASE, transmitData);
junk = USCI_A_SPI_receiveData(USCI_A1_BASE);
DLSB = USCI_A_SPI_receiveData(USCI_A1_BASE);
return;
default:
P1IFG = 0; // probably unnecessary, but if another flag occurs
// in P1, this will clear it. No error handling is
// provided this way, though.
return;
}
} // P1_ISR
Regards David.
Hi David,
If you're observing the correct SPI operations on the oscilloscope, you're probably reading the correct value.
0xFFFF9F is a small negative number. This would correspond to -28.9uV (using the 2.5V reference).
Regards,
Chris