After looking at the specification sheet for the ADS1256, the bus speed needs to be set to 500000 or 1000000 Hz. This based on being fclkin = 7.68 MHz and SCLK must be less than fclkin/4. It is still unknown why I am only receiving intermittent responses to requesting status and data rate.
Raspberry Pi Interface with ADS1256
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Francis B.
am 27 Jan. 2018
Kommentiert: Francis B.
am 5 Feb. 2018
I am attempting to integrate an ADS1256 (link to TI: ADS1256 ) with my Raspberry Pi. I purchased this board to do the hardware interfacing and would like to use MATLAB to do the rest. I am executing the following code:
mypi = raspi;
enableSPI(mypi);
myADS1256 = spidev(mypi,'CE0',1,2000000);
to read/write to some registers, however I am having a difficult time read/writing to registers successfully every time. I believe is because I am not 100% certain of the SPI Bus speed (fCLKIN = 7.68MHz is the clock of the ADS1256). I have tried multiple bus speed with some not working at all and others working only half the time. Any help would be appreciated.
The following command I am using to read the status:
status = writeRead(myADS1256,[bin2dec('00010000'), bin2dec('00000000')]); %read status
The following command I am using to read the data rate:
dataRate = writeRead(myADS1256,[bin2dec('00010011'),bin2dec('00000000')]); % read data rate
The following command I am using to write a new data rate:
setDataRate = writeRead(myADS1256,[bin2dec('01010011'), bin2dec('00000000'), bin2dec('00100011')]); % setting data rate to 10SPS ('00100011')
and I re-read the data rate to confirm the register was written to.
Akzeptierte Antwort
Francis B.
am 4 Feb. 2018
Bearbeitet: Francis B.
am 5 Feb. 2018
2 Kommentare
Walter Roberson
am 5 Feb. 2018
By the way, your sections such as
while length(binReadDataOnce_2) < 8
binReadDataOnce_2 = ['0', binReadDataOnce_2]; % padding with zeros
end
can be avoided by changing
binReadDataOnce_1 = dec2bin(readDataOnce(1));
to
binReadDataOnce_1 = dec2bin(readDataOnce(1), 8);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Support Package for Raspberry Pi Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!