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.

ADS1263: troubles reading registers, i read all 0

Part Number: ADS1263
Other Parts Discussed in Thread: DAC8760

Hi, to all. I am new using this chip ADS1263. To avoid some troubles I use the code in the example TIDCAN1A-TIPD188 Firmware. I am working with Microchip and the SPI it is made by software. So , I only change the lower level function that made the SPI driver. Well, when I send bytes to registers we note that they works and have some in bytes read of ADC. But when we try to read at start up all the registers like the example before change them, the most of them come in 0. There are 3 that came with a value, at least. Many of them have default values and we read in 0. Other thing that we note, that it is a problem. We use the calibration command procedure and when we read the register they are in 00. 

The Electronic design it is the same that the evaluation board of ADS1263. The SPI function software it is used the same code with a DAC8760, only change the pinout. 

I add part of the code I use. Well I don´t understand were I miss something. Hope someone could help. Thank you

// offset self-calibration Command
void ADS126xSendSFOCAL1Command(void){

    uint_fast8_t INPMUX_byte,soporte_byte; // byes leo las entradas anteriores
    // read INPMUX setting 
    ADS126xReadRegister(INPMUX, 1, &INPMUX_byte);
    // open mux
    soporte_byte = 0xFF;
    ADS126xWriteRegister(INPMUX,1,&soporte_byte);
    // cs low
    IO_CS_ADS_SET_LOW();
    // write command
    ui8Read_Write_spi_ads126x(SFOCAL1);
    //set CS high
    IO_CS_ADS_SET_HIGH();
    
    // restore INPMUX value
    ADS126xWriteRegister(INPMUX,1,&INPMUX_byte);
    // read offset to store it
    ADS126xReadRegister(OFCAL0, 1, SFOCAL1_Bytes[0]);
    ADS126xReadRegister(OFCAL1, 1, SFOCAL1_Bytes[1]);
    ADS126xReadRegister(OFCAL2, 1, SFOCAL1_Bytes[2]);
    
}    

// write a number of consecutive registers from a given array pointer
void ADS126xWriteRegister(int StartAddress, int NumRegs, unsigned char * pdata)
{
	//set CS 0
    IO_CS_ADS_SET_LOW();
    ui8Read_Write_spi_ads126x(0x40+StartAddress);
    ui8Read_Write_spi_ads126x(NumRegs-1);
    for(int i=0;i<NumRegs;i++)
	ui8Read_Write_spi_ads126x(pdata[i]);
    //set CS HIGH
    IO_CS_ADS_SET_HIGH();
}

// read a number of consecutive registers to a given array pointer
void ADS126xReadRegister(int StartAddress, int NumRegs, unsigned char *pdata)
{
    //set_ CS 0
    IO_CS_ADS_SET_LOW();
    ui8Read_Write_spi_ads126x(0x20 + StartAddress);
    ui8Read_Write_spi_ads126x(NumRegs - 1);
	for(int i=0;i<NumRegs;i++)
	{
		pdata[i] = ui8Read_Write_spi_ads126x(0x00);
	}
	//set CS 1
    IO_CS_ADS_SET_HIGH();
}

// read write spi port
// the DIN and DOUT are the pines of ADS1263
uint_fast8_t ui8Read_Write_spi_ads126x(uint_fast8_t ui8Data)
{
    
uint_fast8_t uI8I=0;
uint_fast8_t ui8DataRecibido=0;

    for (uI8I=0;uI8I<8;uI8I++) 
    {
        
        ui8DataRecibido =  ui8DataRecibido <<1;
        
        if ((ui8Data << uI8I) & 0x80)
            IO_DIN_ADS_SET_HIGH();
        else
            IO_DIN_ADS_SET_LOW();
        IO_SCLK_ADS_SET_LOW();
        
        vDelay_spi(5); // 10us 
        if (IO_DOUTT_ADS_GET())
            ui8DataRecibido |= 1;
        IO_SCLK_ADS_SET_HIGH();
        vDelay_spi(5);
    }
 return ui8DataRecibido;    
}