STM32 to StM32 with SPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-16 11:37 AM
I know there are hundreds of posts about this and I've been through most of them but still can't get things to work.
The concept is simple: set up 2 Nucleo F446 boards, one as full duplex slave the other as full duplex slave.
Master pseudo code:
while 1
Zero buffers
Fill Transmit buffer with data
Pull CS pin low
use Hal_TransmitReceive(..)
Wait for a while
The Slave pseudo code is similar
While 1
Zero buffers
Fill tansmit buffer
Wait for CS to go low
use HAL TansmitReceive(..) to get data
Shorter Wait than Master
I am using a logic analyzer to monitor the data plus selected breaks in the debugger to see what is received.
The last test was with a clock frequency of 740 KHz.
Summary:
The MOSI line always has the right data according to the logic analyzer but slave never receives data. Master never receives valid data(verified using break point)
The MISO line has random data according
Slave never receives data transmitted data just random characters. (verified using breakpoints)
Reversing functionality of the two F446 yields same result.
Using a simple loop back on (MOSI & MISO) shows that each Nucleo can receive the data.
I have tried several Nucleo boards over the past week with the same result. I have use G431RE, G431K, F446RE, and F042K. All produced the same results.
I have probably missed something simple.
HELPPPP!!!!! before I pull the last hair out of my head.
- Labels:
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-16 1:21 PM
Sorry, Its Master to Slave and Yes; Master raises the CS line after TransmitReceive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-16 4:11 PM
Common ground between the boards?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-16 5:34 PM
it is usually the timing you read before the other board transmitted
see examples in CubeMX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-17 5:03 AM
The boards have a common ground wire.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-17 5:19 AM
...and that's the comma that changes everything.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-09 3:49 AM
@Greybeard I am having a similer problem my master transmits the data but slave does not recevie it and I can't found the problem. Here is my codes
