Raspberry Pi Interface with ADS1256
Show older comments
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.
1 Comment
Francis B.
on 1 Feb 2018
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Support Package for Raspberry Pi Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!