SPI issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-11-27 3:33 AM - last edited on 2024-11-27 3:41 AM by mƎALLEm
Hi ,
i am using STM32H753z, implementing the SPI.
when i using HAL_SPI_TransmitReceive() data is transfer and receive happening but data is mismatching.
when i using HAL_SPI_Transmit(), HAL_SPI_Transmit_IT() is showing busy when i debug same wave to HAL_SPI_Receive(), HAL_SPI_Receive_IT().
Thank you,
Naresh
if (hspi->State != HAL_SPI_STATE_READY)
{
return HAL_BUSY;
}
- Labels:
-
SPI
-
STM32H7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-11-27 3:39 AM
Please see the Posting Tips for how to properly post source code, and other details required - including your hardware setup:
@Naresh_ wrote:transfer and receive happening but data is mismatching.
What, exactly, do you mean by that?
Have you used an oscilloscope or logic analyser to see what's happening on the wires?
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-11-27 4:27 AM
Hi Andrew,
thank you for quick response.
i am not use any oscilloscope or logic analyzer.
i doing SPI loopback now i facing issue in receive buffer,
uint8_t Tx_buffer[]="hello_SPI_"; in Tx side
by using HAL_SPI_TransmitReceive(&hspi1, (uint8_t*)Tx_buffer, (uint8_t*)rx_buffer, size,100); in re_buffer date is incorrect i getting data is08 05 0C 0C 0F 0F 03 00 09 0F (in hex ) or <\b><5><\f><\f><15><15><3><\0><9><15>(in ASCII).
when i use HAL_SPI_Transmit() & HAL_SPI_Receive() then data in not receive in rx_buffer (both polling and interrupt).
Thanks,
Naresh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-11-27 4:52 AM - edited 2024-11-27 4:58 AM
Start by reading this topic:
To get SPI working, use TransmiReceive only. For SPI Master you usually don't need anything else. What's the SPI configuration? What's the SPI clock frequency? I suspect the SCLK if too fast - start by setting it to no more than 1 MHz, verify the correct operation, then try to increase it.
To use _IT functions, SPI interrupt must be enabled in SPI settings, NVIC tab. Still, after you get basic TransmitReceive working, try to use TransmitReceive_IT. Separate Transmit and Receive will not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-11-27 5:00 AM
@Naresh_ wrote:i am not use any oscilloscope or logic analyzer.
You should do - how else will you be able to see what's happening on the wires?
A complex system designed from scratch never works and cannot be patched up to make it work.
