cancel
Showing results for 
Search instead for 
Did you mean: 

Seeking Guidance: Establishing SPI Communication Between SPC58EC80E7QMC0Y and ESP32WROVEREN8R8

Ali5
Associate III

Hello All,

I hope you're doing well. I'm Ali, a newcomer diving into the embedded world and soaking up knowledge from all of you experienced folks.

I've got a new challenge on my plate: I need to establish communication between two platforms—SPC58EC80E7QMC0Y and ESP32WROVEREN8R8—via SPI.

Could any seasoned professionals who have tackled a similar task offer guidance on how to approach this? Any tips, advice, or starting points would be greatly appreciated.

Best,
Ali

1 ACCEPTED SOLUTION

Accepted Solutions

First off, are you familiar with how SPI works?

If not, it's a very well-established & widely used - there is lots of documentation available on how it works; eg,

https://en.wikipedia.org/wiki/Serial_Peripheral_Interface

https://www.analog.com/en/resources/analog-dialogue/articles/introduction-to-spi-interface.html

https://learn.sparkfun.com/tutorials/serial-peripheral-interface-spi/all

 


@Ali5 wrote:

I need to establish communication between two platforms—SPC58EC80E7QMC0Y and ESP32WROVEREN8R8—via SPI.


So two microcontrollers?

Then you're first going to have to decide which one is Master, and which is Slave.


@Ali5 wrote:

Could any seasoned professionals who have tackled a similar task offer guidance on how to approach this?


The key thing is not to try to tackle both ends at once. Otherwise, when things go wrong, you won't know if the problem is in the Master, or the Slave - or both!

 

Since by far the commonest use-case is for a microntroller to be the Master, I would suggest that you start with examples of using the chosen microcontroller as Master with a well-known and widely-supported slave.

As well as just getting the code to work, you should practice using debug & test tools - you should know what "good " signals look like on the line.

And don't just concentrate on the "working " case - investigate what happens in common failure cases; eg,

  • No slave connected;
  • clock line disconnected;
  • either/btoh data lines disconnected;
  • etc, etc, ...

 

Think about how you can detect these conditions in your code, and give useful & meaningful error indications.

 

Then, when you have a good, fully debugged & working Master implementation, try making a slave for it to talk to...

 

View solution in original post

11 REPLIES 11

First off, are you familiar with how SPI works?

If not, it's a very well-established & widely used - there is lots of documentation available on how it works; eg,

https://en.wikipedia.org/wiki/Serial_Peripheral_Interface

https://www.analog.com/en/resources/analog-dialogue/articles/introduction-to-spi-interface.html

https://learn.sparkfun.com/tutorials/serial-peripheral-interface-spi/all

 


@Ali5 wrote:

I need to establish communication between two platforms—SPC58EC80E7QMC0Y and ESP32WROVEREN8R8—via SPI.


So two microcontrollers?

Then you're first going to have to decide which one is Master, and which is Slave.


@Ali5 wrote:

Could any seasoned professionals who have tackled a similar task offer guidance on how to approach this?


The key thing is not to try to tackle both ends at once. Otherwise, when things go wrong, you won't know if the problem is in the Master, or the Slave - or both!

 

Since by far the commonest use-case is for a microntroller to be the Master, I would suggest that you start with examples of using the chosen microcontroller as Master with a well-known and widely-supported slave.

As well as just getting the code to work, you should practice using debug & test tools - you should know what "good " signals look like on the line.

And don't just concentrate on the "working " case - investigate what happens in common failure cases; eg,

  • No slave connected;
  • clock line disconnected;
  • either/btoh data lines disconnected;
  • etc, etc, ...

 

Think about how you can detect these conditions in your code, and give useful & meaningful error indications.

 

Then, when you have a good, fully debugged & working Master implementation, try making a slave for it to talk to...

 

Ali5
Associate III

Dear Andrew,

I hope this message finds you well. I wanted to express my gratitude to Andrew for providing such a detailed explanation that greatly aided me in expanding my understanding.

Currently, I am facing a challenge with configuring the SPC584B70E7 microcontroller as a master in an SPI setup, with the ESP32-WROVER-N8R8 serving as the slave. While I have successfully configured the necessary pins for SPI communication using SPC5 Studio, I find myself struggling to locate relevant code examples or documentation to guide me further.

Being relatively new to SPC5 Studio, I am uncertain about which SPI functions are available within the generated application code. Unlike platforms such as Arduino or Espressif, where comprehensive documentation and examples are readily available, I am finding it difficult to proceed without a basic understanding or example code to reference.

If anyone within the community could provide documentation or a basic SPI master code snippet for the SPC584B70E7 microcontroller, it would be immensely helpful for me to kickstart my project. Your assistance and insights would be greatly appreciated.

Once again, thank you to Andrew for your invaluable assistance, and I look forward to any guidance or support from fellow community members.

Best regards,
Ali

For a novice, the SPC5 seems an odd choice - it's ST's specialist Automotive range.

What drives this choice? Why not an STM32?

I think you will find much wider community support for STM32 ...

Ali5
Associate III

Hi Andrew,

Thanks for your feedback. You're absolutely right, SPC5 being a more specialized automotive range means less community support compared to STM32.

To be honest, using SPC5 is a project requirement. Ideally, I would have opted for STM32 with its larger community for easier learning and troubleshooting.

This lack of community support is a bit worrying, so I'm trying to gather as much information as possible to overcome any hurdles during development.

Do you have any suggestions on resources or alternative approaches I could consider using SPC5 given the project constraints? Any advice would be highly appreciated!

Best,

Ali


@Ali5 wrote:

using SPC5 is a project requirement.


Is this a school project?

If so, you should really be seeking support from your teachers - that's their job.

Ali5
Associate III

Yes it's my university project, but sadly nobody is here to guide us left us all alone. really depressed!!

So why the insistence that it has to be SPC5 ?

Ali5
Associate III

Because they provided us with a custom board where the SPC5 chip is connected to the ESP32-WOVER-E-N8R8 via SPI, and they also provided us with the schematic. I have some knowledge about Arduino and I'm adept at learning various codes. If I were given just one example with the SPC5 as a Master, it would greatly facilitate my understanding.

Who is "they" ?

Surely, "they" should be able to help you with that - especially as it's a custom board