2021-08-05 03:44 AM
I'm using Nucleo-F767 with IAR IDE. I have created project using STM32CubeMx v6.3.0.
I want to send one byte over MOSI and receive 27 bytes of data from SPI slave device on MISO. I noticed that random data is seen on MOSI line from 2nd byte. How to make MOSI data as 0x00 for 27 bytes i.e., during SPI Read operation.
Scope capture attached.
Code:
HAL_SPI_Transmit(&hspi3, spiTxBuf, 1, 50);
HAL_SPI_Receive(&hspi3, spiRxBuf3, 27, 50);
Note: MOSI data is required to make 0x00 in order to make slave device functionality working fine as expected.
Solved! Go to Solution.
2021-08-05 06:40 AM
> How to make MOSI data as 0x00 for 27 bytes i.e., during SPI Read operation.
Use HAL_SPI_TransmitReceive and set the outgoing buffer bytes to 0x00.
Move both calls into a single call to HAL_SPI_TransmitReceive with length 28 and discard the data you don't want.
2021-08-05 06:40 AM
> How to make MOSI data as 0x00 for 27 bytes i.e., during SPI Read operation.
Use HAL_SPI_TransmitReceive and set the outgoing buffer bytes to 0x00.
Move both calls into a single call to HAL_SPI_TransmitReceive with length 28 and discard the data you don't want.
2021-08-05 07:42 AM
Thanks, Issue got resolved ..!