Tool/software: TI C/C++ Compiler
we are using ADS127L01 and raspberry pi B3 in our design for a DAQ measurement system. The ADC works is working fine but in Some reading up the device is reading constant value 7FFFFF irrespective of the input variation.This issue is causing lot of trouble in our system.Please help us on this.The powerdown pin recommendation is followed in the firmware.Please share any other fix that could solve the issue
public async Task<bool> Connect() { SpiController spiController = await SpiController.GetDefaultAsync(); var settings = new SpiConnectionSettings(0) { ClockFrequency = 16000000, // TODO! Investigate this number! Mode = SpiMode.Mode1, DataBitLength = 8 }; _ADS127L01 = spiController.GetDevice(settings); GPIO_INIT(); GPIO_Set(HRPin); //HR =1 Delay(0x1fff); Set_PGA(2);//0:gain = 2.02//1:gain = 6.6//2:gain = 13.2 Set_Filters(2);///0:64K 1:128K 2:256K 3:512K Delay(0x1fff); ADS127L01_INIT(); Delay(0x1fff); GPIO_Set(StartPin); return true; } void ADS127L01_INIT() { GPIO_Set(Cs0Pin); Delay(0x1fff); GPIO_Reset(Cs0Pin); Delay(0x1fff); GPIO_Set(ResetPin); Delay(0x1fff); GPIO_Reset(ResetPin); Delay(0x1fff); GPIO_Set(ResetPin); Delay(0x1fff); WriteRegister(_ADS127L01, 0x41); WriteRegister(_ADS127L01, 0x05);//REG NUM-1 WriteRegister(_ADS127L01, 0x02);//conf1 WriteRegister(_ADS127L01, 0x00);//OFC0 DEFAULT WriteRegister(_ADS127L01, 0x00);//OFC1 DEFAULT WriteRegister(_ADS127L01, 0x00);//OFC2 DEFAULT WriteRegister(_ADS127L01, 0x00);//FSC0 DEFAULT WriteRegister(_ADS127L01, 0x80);//FSC1 DEFAULT } public async void Start() { Task t = new Task(() => { while (true) { double Sample = readADC(); Sample = ((Sample / 8388607) * 2.5) * (3 / 6.6); Debug.WriteLine(Sample); } }); t.Start(); } private int readADC() { byte[] receiveBuffer = new byte[3]; while (DRDY.Read() == GpioPinValue.High) { } _ADS127L01.Write(new[] { Command.ReadData }); _timing.WaitMicroseconds(6); _ADS127L01.Read(receiveBuffer); uint result = ((uint)receiveBuffer[0] << 16) | ((uint)receiveBuffer[1] << 8) | receiveBuffer[2]; if ((receiveBuffer[0] & 0x80) != 0) { result |= 0xFF000000; } return unchecked((int)result); }