Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SPI slave support and basic example #1612

Conversation

brainelectronics
Copy link

Summary

This PR implements SPI slave mode.

References

This is a follow up for the ticket #1600.

Motivation

Most high level possible functions to implement this feature were used. In
order to be as close as possible to other Arduino examples.

SPIClass functions have not been touched as much as possible.

Validation

Example sketches for SPI master and slave are provided with this PR.

@fpistm fpistm requested a review from ABOSTM January 3, 2022 09:55
Copy link
Contributor

@ABOSTM ABOSTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brainelectronics,
Thanks for this Pull Request.

This is a good starting point, but if we go for an implementation of SPI slave in this core, your proposal doesn't match with Arduino API spirit:

  • user application should access to SPIClass API
    but it should not access to spi_init() for example (which is more for an internal core usage)
  • user application (like the proposed example) should not use STM32 HAL API like HAL_SPI_Receive(), ...
  • ... on the contrary, all this HAL_SPI_xxx() stuff should be part of the driver itself:
    For example by reusing/extending SPIClass like begin() with an optional parameter to specify the mode (with default master).
    Also maybe adding new function to this class like a function to register slave receive call back, and another function to provide the slave response ...
  • Driver, as well as example, should be compatible with any stm32 series supported.
    This means that :
    • driver implementation should use STM32 HAL/LL API common to STM32 series (or should be implement with compilation switch depending on series).
    • Example should use the default and predefined variable SPI (default SPI instance)
      Instead of defining DEBUG_LED, you can use predefined LED_BUILTIN
      and remove reference to specific MCU pin like PA4

libraries/SPI/src/utility/spi_com.h Show resolved Hide resolved
@brainelectronics brainelectronics marked this pull request as draft January 11, 2022 09:30
@ric96
Copy link
Contributor

ric96 commented Apr 21, 2022

Hi, is this actively being worked on?
I wanted to use this functionality and am willing to test and co-auth if required.

@brainelectronics
Copy link
Author

Hi @ric96
Unfortunately I don't have much time to work on it. Another project is taking all my free time right now. Of course I'm happy with any contributions here

@mirko
Copy link

mirko commented Jan 1, 2023

I'd also really like to see this going upstream and I think it'd be worth putting some effort into once for a peace of mind later on, when using it in a project and not having to continuously level local patchsets.
How can I help?

@fpistm fpistm added the abandoned No more work on this label Nov 28, 2023
@fpistm
Copy link
Member

fpistm commented Nov 28, 2023

Superseded by #2050.

@fpistm fpistm closed this Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abandoned No more work on this
Projects
Development

Successfully merging this pull request may close these issues.

5 participants