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

SPI: improvements for SPI library #912

Merged
merged 6 commits into from
Feb 12, 2020
Merged

SPI: improvements for SPI library #912

merged 6 commits into from
Feb 12, 2020

Conversation

stas2z
Copy link
Contributor

@stas2z stas2z commented Feb 3, 2020

My suggestion for #898

  • optimize spi_transfer routine to use LL instead of HAL
  • add SPISettings field for transmit only operations
  • replace spi_send with call to spi_transfer with SPI_TRANSMITONLY flag
  • allow SPI_TRANSFER_TIMEOUT redefinition

@stas2z stas2z force-pushed the master branch 2 times, most recently from bb18006 to b335b0c Compare February 3, 2020 15:49
- optimize spi_transfer routine to use LL instead of HAL
- add SPISettings field for transmit only operations
- replace spi_send with call to spi_transfer with SPI_TRANSMITONLY flag
- allow SPI_TRANSFER_TIMEOUT redefinition

Signed-off-by: Alexey Golyshin <stas2z@gmail.com>
@ABOSTM
Copy link
Contributor

ABOSTM commented Feb 7, 2020

Hi @stas2z
I review the PR
That is nice job and looks good to me.
Nevertheless I propose to factorize common code to improve readability and maintenance.
I does not impact performances. (tested on NUCLEO_L476RG with LCD/SD sadafruit shield).
See PR on your own fork stas2z#1

spi_tranfer: factorize common code to simplify maintenance
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.

LGTM waiting @fpistm feedback

@uzi18
Copy link

uzi18 commented Feb 7, 2020

such blind send should be possible with dma, but don't know if any compatibility issues will rise

@stas2z
Copy link
Contributor Author

stas2z commented Feb 7, 2020

such blind send should be possible with dma, but don't know if any compatibility issues wil rise

it's not a blind send, it checks for the state before DR register access, this is exactly what HAL_SPI_TransmitRecieve does, but shorter and much faster cuz much overhead stuff dropped.

But anyway, any compatibility tests are welcomed. Ive tested it with all my stm32 fleet available (f103/f401/f405/f051) but sure thats not enuff to be sure

Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

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

Not compatible with H7 and MP1 series due to LL API usages.

libraries/SPI/src/utility/spi_com.c Outdated Show resolved Hide resolved
libraries/SPI/src/utility/spi_com.c Outdated Show resolved Hide resolved
libraries/SPI/src/utility/spi_com.c Outdated Show resolved Hide resolved
Signed-off-by: Alexey Golyshin <stas2z@gmail.com>
@stas2z
Copy link
Contributor Author

stas2z commented Feb 10, 2020

Unfortunately i have no H7 or MP1 board to check

@ABOSTM
Copy link
Contributor

ABOSTM commented Feb 10, 2020

Thanks @stas2z I will test H7 and MP1

@ABOSTM
Copy link
Contributor

ABOSTM commented Feb 12, 2020

@stas2z,
Tests on MP1 fails.
But here is the fix:
stas2z#2

SPI: Dedicated start/stop transfer for STM32H7 and STM32MP1
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

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

LGTM

@fpistm fpistm added the enhancement New feature or request label Feb 12, 2020
@fpistm fpistm added this to the 1.9.0 milestone Feb 12, 2020
@fpistm fpistm merged commit bbb0cf1 into stm32duino:master Feb 12, 2020
@fpistm fpistm linked an issue Feb 12, 2020 that may be closed by this pull request
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this pull request Nov 21, 2023
Linked to stm32duino#912.

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this pull request Nov 23, 2023
Linked to stm32duino#912.

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this pull request Nov 24, 2023
Linked to stm32duino#912.

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this pull request Nov 24, 2023
Linked to stm32duino#912.

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slow SPI speed with SPI library
4 participants