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
4 次查看(过去 30 天)
显示 更早的评论
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.
采纳的回答
Francis B.
2018-2-4
编辑:Francis B.
2018-2-5
2 个评论
Walter Roberson
2018-2-5
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);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Support Package for Raspberry Pi Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!