cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f4 SPI data was broken

Sangkyu Kim
Associate II
Posted on July 27, 2017 at 13:23

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.0690X00000607dyQAA.png

0690X00000607e8QAA.png

#stm32 #spi
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on July 27, 2017 at 13:34

See erratum titled Corrupted last bit of data and/or CRC, received in Master mode with delayed SCK feedback

JW

View solution in original post

2 REPLIES 2
Posted on July 27, 2017 at 13:34

See erratum titled Corrupted last bit of data and/or CRC, received in Master mode with delayed SCK feedback

JW

Posted on July 27, 2017 at 14:51

Thank you

Waclawek.Jan

I solve the problem by you answer.