AnsweredAssumed Answered

STM32f4 SPI data was broken

Question asked by Sangkyu Kim on Jul 27, 2017
Latest reply on Jul 27, 2017 by Sangkyu Kim

Hi,

 

I communicate with ADS1299(24bit, 8CH ADC chip) by SPI.

 

ADS1299 SPI specification is

 

CPOL=0 CPHA= 1

Max SCLK = 20MHz

 

and command flow is

 

1) send read command(0x12)

2) send dummy(x00) to make SCLK and receive 27 byte data.

 

unsigned char rdata[27];
unsigned char Dummy_buff[27]={0x00};

 HAL_SPI_TransmitReceive(&hspi1,Dummy_buff,rdata,27,5000);

 

The error is occurring # 4,7,10,13,16,19,22,25 bytes LSB bit.

 

For example,

ADS1299 send         0xC0 0x00 0x00  0x45 0x20 0xD0 0x00 0x00 0x00 ......... 0x00(27th byte)

 

STM32 SPI receive   0xC0 0x00 0x00  0x44 0x20 0xD0 0x01 0x00 0x00 ......... 0x00(27th byte)

 

The 4th and 7th byte change or not change randomly.......

 

I check ADS1299 output data using logic analyzer. MISO data is fine.

 

Do you have any idea or tip to solve this problem?

 

I attach my code and sreenshot.

 

 

 

Outcomes