Communication between stm32 and raspberry pi4 through spi or i2c.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-09 4:03 AM - edited ‎2024-11-10 8:28 PM
Hello, I am doing a project with STM32F411RE NUCLEO board. I have downloaded the zip file from the web builder GRBLHAL. i have attached the file here. And I have successfully imported the zip folder onto the stm32cubeide. So for that project I want to add communication through SPI. and there is a SPI communication can be used for that project.
as in my previous query, i came to know that with UART communication, USB connector which is connected to cn1 of the board and raspberry pi USB connection - i am able to communicate. as i understood that, to communicate between raspberry pi and stm32, i don't need to connect tx of pi -> rx of board, rx of pi -> tx of board, gnd to gnd. but can able to communicate through a connector. will that be possible with spi communication also. if no, then how can be the easy way to communicate between raspberry pi 4b and stm32f411re. and i forgot to mention that, in that file i am not able to find uart communication, i can only see the header files of spi, i2c, usb_device. can you please give me clarity over this ?
Solved! Go to Solution.
- Labels:
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-11 5:21 AM - edited ‎2024-11-12 2:45 AM
@suhfi wrote:i am talking about the usb connector?
So why didn't you say that? You can see that there are (at least) 10 different connectors on the Raspberry Pi - how did you expect us to guess which one you meant?!
@suhfi wrote:i am wondering if usb connector supports i2c or spi just like uart?
There are USB-to-I2C and USB-to-SPI converters available; eg,
I2C:
https://ftdichip.com/products/umft201xb-01/
https://ftdichip.com/products/umft200xd-01/
SPI/I2C:
https://ftdichip.com/products/ft2232h-56-mini-module/
https://ftdichip.com/products/ft4232h-56-mini-module/
But, as @mÆŽALLEm said, the Nucleo board routes neither I2C nor SPI via its ST-Link.
A standalone ST-Link V3 can route UART, SPI, and I2C
https://www.st.com/en/development-tools/stlink-v3set.html
(not sure if that's all 3 at once, or just one at a time?)
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-09 4:14 AM
Hello,
Not clear: you need a communication with UART or SPI?
Related threads:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-09 4:16 AM
earlier i have done communication with uart, can i use the same connector or connections for spi also? if not how should i connect?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-09 4:57 AM
So why the title mentions UART?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-09 5:25 AM
Why SPI?
Why can't you figure out what the issues are with USB/UART and fix/address those?
You have RPi side drivers that can do SPI simply?
Is the power supply or setup adequate to support the NUCLEO and everything else hung off it?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-09 6:23 AM - edited ‎2024-11-09 6:37 AM
@suhfi wrote:as in my previous query
These:
@suhfi wrote:I have downloaded the zip file ?
What zip file?
@suhfi wrote:from the web builder GRBLHAL.
The what??
@suhfi wrote:as i understood that, to communicate between raspberry pi and stm32, i don't need to connect tx of pi -> rx of board, rx of pi -> tx of board, gnd to gnd. but can able to communicate through a connector.
What do you mean by that?
Sure, you can always use a connector to make connections - it's in the very name!
@suhfi wrote:how can be the easy way to communicate between raspberry pi 4b and stm32f411re.
You've already seen that you can do this with a UART link - either direct or via USB.
So what do you think is not "easy" about this?
What problem(s)/limitation(s) do you have that you think that SPI (or anything else) might solve?
I see no reason to believe that SPI is going to be any easier than UART. On the contrary, UART is very widely used and easy to test - so, if you're stuck with that, I can't see that you'll fare any better with anything else.
@suhfi wrote:in that file i am not able to find uart communication
What file?
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-10 8:32 PM
okay, i think there is a misunderstanding of how things are explained here. yes, i have done communication with uart between both devices and it is working fine. i have a genuine doubt that with the connector can i communicate through spi, i2c same like uart?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-11 2:35 AM
@suhfi wrote:okay, i think there is a misunderstanding of how things are explained here.
Indeed - your posts are not very clear at all!
@suhfi wrote:i have a genuine doubt that with the connector ...
What "connector" are you talking about?
This one:
Check out the Raspberry Pi documentation to see what signals are available on that connector:
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#gpio-and-the-40-pin-header
You can clearly see that UART (TXD, RXD), SPI (MOSI, MISO, SCLK), and I2C (SDA, SCL) are all available on that connector, and documented on that page:
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#alternative-functions
and 3rd-party sites; eg,
https://learn.sparkfun.com/tutorials/raspberry-pi-spi-and-i2c-tutorial/all
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-11 2:53 AM
@Andrew Neil wrote:your posts are not very clear at all!
@suhfi One thing that would help would be to provide diagrams/pictures - so that we can actually see what you're taking about, rather than just rely on text.
Especially as there seems to be a bit of a language barrier.
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-11 4:34 AM
okay, thank you for the advice. i am gonna follow that. no i am not talking about the connector over there. i am talking about the usb connector. as in my previous discussion i came to know that usart via usb is possible between raspberry pi and stm32 nucleo board. i am wondering if usb connector supports i2c or spi just like uart?
