Community
cancel
Showing results for 
Search instead for 
Did you mean: 
JB2
Beginner
1,905 Views

SPI Mode 1 is not working Properly

Hi all,

I have developed AFE using TI- ADS 1294

I am working on SPI Interfacing of developed AFE board with Intel Edison.

When I set SPI Mode -1, the device is not working properly. Here is the SPI Configuration

And we have also tried the CS as a GPIO

mraa_init();

spi = mraa_spi_init(0);

mraa_spi_frequency(spi,1200000);

mraa_spi_lsbmode(spi, 0);

mraa_spi_mode(spi,MRAA_SPI_MODE1);

cs = mraa_gpio_init(8);

mraa_gpio_dir(cs, MRAA_GPIO_OUT);

The same SPI Configuration of Developed AFE works well with Arduino Uno. But When i am interfacing with Edison, the device is not working properly

Thanks & Regards,

Jags

0 Kudos
5 Replies
idata
Community Manager
53 Views

Hi Jags,

 

 

Thank you for contacting us.

 

 

That's a weird issue, we need more information about your issue to help you. So, can you tell us exactly the error that you are getting when you set the SPI mode 1? Did you try it with another mode? Do you get issues with it?

 

 

We will be waiting for your answer.

 

 

Have a nice day.

 

 

Regards,

 

Leonardo R.
JB2
Beginner
53 Views

HI Leonardo,

Thanks for your quick response, We tried the other SPI modes also.

Initially, we have to send the opcodes to have device communication.The register configuration can be like this:

To get device communication firstly we are sending SDATAC (0x11) and STOP (0x0A) then we send the opcode byte RREG (0X20) (Device ID address is 0h) and followed by the opcode 0x00. Because we are reading one only register value.

We have to get the device ID as 144(0x90) for ADS1294 to have device detection.Later we set the channel configuration and applied the test signals and captured the data.

The above program configuration works well with irrespective of SPI Mode. From the datasheet, the suggested configuration for ADS 1294 SPI Mode 1.

For SPI mode 0, We are able to get device detection but we are not getting data when we applied the test signals.

For SPI Mode 1, the device detected successfully.Sometimes we are able to read valid data.But we are not able to capture valid data all the times.

And the important thing is when we enter below command before the start of device communication only we are abe to detect the device.We are not getting device communication if we don't use this command. Other than this command any commands are to be used for capturing valid data.Please help me in this to capture valid data all the times

echo on > /sys/devices/pci0000:00/0000:00:07.1/power/control

Program :

int deviceInit() {

usleep(500000);

spiSend(0x11); //SDATAC :Stop Read Data Continuosly mode

usleep(50000);

spiSend(0x0A); //STOP Conversion

usleep(50000);

spiSend(0x20); //RREG (001r rrrr) r rrrr = Staritng Register address

usleep(50000);

spiSend(0x00); //Number of Registers to read -1

int recv = readReg(0x00);

if(recv == 144)

printf("Device Detected Successfully\n");

else

printf("Device Not Detected - %d\n",recv);

return recv;

}

int spiSend(uint8_t cmd){

mraa_gpio_write(cs, 0);

int recv = 1;

usleep(5000);

recv = mraa_spi_write(spi, cmd);

usleep(5000);

mraa_gpio_write(cs, 1);

usleep(2000);

}

Thanks & Regards,

Jags

idata
Community Manager
53 Views

Hi Jags,

 

 

Thanks for all the information provided, we'll try to help you with this. We don't have the ADS1294 to test it and the behavior you are mentioning is strange, however, we would like to know if you have any logic analyzer to test the SPI interface with the Arduino UNO and with the Edison in order to compare both signals and take a look at them to know what could be happening.

 

 

Please, let us know if test that is possible, we'll be waiting for your reply.

 

 

Regards,

 

-Yermi A.

 

idata
Community Manager
53 Views

Hi Jags,

 

 

We would like to know if you have tried to use a logic analyzer to check the SPI interface with the Arduino UNO and the Edison board.

 

 

Regards,

 

-Yermi A.

 

idata
Community Manager
53 Views

Hi Jags,

 

 

We would like to know if you have any updates. Also, could you please provide us the information requested above?

 

 

Regards,

 

-Yermi A.

 

Reply