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
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Francis B.
el 27 de En. de 2018
Comentada: Francis B.
el 5 de Feb. de 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.
Respuesta aceptada
Francis B.
el 4 de Feb. de 2018
Editada: Francis B.
el 5 de Feb. de 2018
2 comentarios
Walter Roberson
el 5 de Feb. de 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);
Más respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Support Package for Raspberry Pi Hardware en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!