cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L01x SPI Transmitt 32bit

FPaul.1
Associate II

Hello Guys,

I'm new here and more from the hardware side.

My problem is, I have a SPI ADC (ADS8665) and for it to work, it needs 32bit commands.

0693W00000KdT1zQAF.pngSo I tried this:

uint8_t buff[4];
buff[0] = 0xC8;
buff[1] = 0x00;
buff[2] = 0x00;
buff[3] = 0xC8;
HAL_SPI_Transmit(&hspi1, buff, sizeof(buff), 1000);

 But then the 32bit are sent in 4x 8bit with a delay in between each paket and the ADC does not recognize the command.

0693W00000KdT3WQAV.pngcan someone help me get rid of these delays?

thanks in advance.

4 REPLIES 4
TDK
Guru

Sending 8 bits 4 times is the same as sending 32 bits once. Shouldn't be an issue here.

If you feel a post has answered your question, please click "Accept as Solution".

sry the post wasnt fully completed...i edited it

TDK
Guru

Delays are allowed in SPI communication. I don't see CS pin management here. Initialize the CS pin as a GPIO and set low before the transaction and high after.

You can remove the delay by slowing down the clock rate or by using HAL_SPI_Transmit_DMA (with appropriate initialization), but unlikely that's the issue here.

If you feel a post has answered your question, please click "Accept as Solution".

The CS is handled before and aknowleged by the adc (the adc pulls a signal to high) so this should be wright the 3rd channel of the oscilloscope pic is the CS Signal it gets pulled low before the transmit…Im going to try the DMA method tomorrow…but if I understood wright, you guys say that it shouldnt be a issue if the 32bit come in one or 4 blocks?