Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(spi): add transfer api with tx and rx buffer#2206

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fpistm merged 3 commits intostm32duino:mainfromfpistm:spi_transfer_buf
Nov 28, 2023

Conversation

fpistm
Copy link
Member

@fpistmfpistm commentedNov 24, 2023
edited
Loading

Fixes#2205

For ref:arduino/ArduinoCore-API#189

Tested with SdFat patched with:

index 8b7da94..296a752 100644@@ -44,9 +44,13 @@ void SdSpiArduinoDriver::end() { m_spi->end(); } uint8_t SdSpiArduinoDriver::receive() { return m_spi->transfer(0XFF); } //------------------------------------------------------------------------------ uint8_t SdSpiArduinoDriver::receive(uint8_t* buf, size_t count) {+#if defined(STM32_CORE_VERSION) && STM32_CORE_VERSION > 0x02070000+  m_spi->transfer(NULL, buf, count);+#else   // Must send 0XFF - SD looks at send data for command.   memset(buf, 0XFF, count);   m_spi->transfer(buf, count);+#endif   return 0; } //------------------------------------------------------------------------------@@ -57,9 +61,17 @@ void SdSpiArduinoDriver::send(const uint8_t* buf, size_t count) {   if (count > 512) {     return;   }+#if defined(STM32_CORE_VERSION)+#if STM32_CORE_VERSION > 0x02070000+  m_spi->transfer(buf, NULL, count);+#elif STM32_CORE_VERSION == 0x02070000+  #error "STM32 core version 2.7.0 is not compatible due to SPI API changes."+#endif+#else   // Not easy to avoid receive so use tmp RX buffer.   uint8_t rxBuf[512];   // Discard const - STM32 not const correct.   m_spi->transfer(const_cast<uint8_t*>(buf), rxBuf, count);+#endif } #endif  // defined(SD_USE_CUSTOM_SPI) && defined(STM32_CORE_VERSION)

SPI_TRANSFER_TIMEOUT is always passed as an argumentwhile it is a constant definition.So simply function call and check.Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
@fpistmfpistm added enhancementNew feature or request arduino compatibility labelsNov 24, 2023
@fpistmfpistm added this to the2.7.1 milestoneNov 24, 2023
Fixesstm32duino#2205Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
@fpistm
Copy link
MemberAuthor

PR is now ready. Thanks@greiman.

Results of bench sketch:

-### 2.6.0-Sketch uses 41400 bytes (3%) of program storage space. Maximum is 1048576 bytes.-Global variables use 3296 bytes (3%) of dynamic memory, leaving 95008 bytes for local variables. Maximum is 98304 bytes.+### 2.7.1+Sketch uses 40224 bytes (3%) of program storage space. Maximum is 1048576 bytes.+Global variables use 3248 bytes (3%) of dynamic memory, leaving 95056 bytes for local variables. Maximum is 98304 bytes.-FreeStack: 94912+FreeStack: 94960 Type is FAT16 Card size: 1.98 GB (GB = 1E9 bytes)@@ -20,15 +20,15 @@ write speed and latency speed,max,min,avg KB/Sec,usec,usec,usec-1126.13,154491,406,453-1089.56,154378,406,468+1138.69,154066,401,448+1100.11,155705,401,463  Starting read test, please wait.  read speed and latency speed,max,min,avg KB/Sec,usec,usec,usec-1143.64,458,444,445-1143.90,457,445,445+1222.79,428,416,417+1222.49,428,416,417  Done

@fpistmfpistm merged commit20339e8 intostm32duino:mainNov 28, 2023
@fpistmfpistm deleted the spi_transfer_buf branchNovember 28, 2023 13:07
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
arduino compatibilityenhancementNew feature or request
Projects
Milestone
2.7.1
Development

Successfully merging this pull request may close these issues.

Request to restore SPI.transfer(bufout, bufin, count) removed from 2.7.0.
1 participant
@fpistm

[8]ページ先頭

©2009-2025 Movatter.jp