MOSI data during HAL_SPI_Receive operation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-05 3: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.
- Labels:
-
SPI
-
STM32Cube MCU Packages
-
STM32F7 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-05 6: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-05 6: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-05 7:42 AM
Thanks, Issue got resolved ..!
