-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
riscv/common/espressif: Fix spi slave driver #14642
riscv/common/espressif: Fix spi slave driver #14642
Conversation
[Experimental Bot, please feedback here] Fill In The Commit Message: This PR contains a Commit with an Empty Commit Message. Please fill in the Commit Message with the PR Summary. This PR summary mostly meets the NuttX requirements but is missing some crucial details. Here's a breakdown and suggestions for improvement: Strengths:
Weaknesses:
Recommendations for Improvement:
By addressing these points, the PR will be much clearer, easier to review, and more likely to be accepted. |
Fix defconfigs and documentation
a678368
to
9a670fc
Compare
Please @eren-terzioglu and @tmedicci, take a look. |
Hi @FelipeMdeO , thanks for submitting! I have some questions:
|
|
I updated the example to allow user choose data to send: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @FelipeMdeO :-)
Please remember that you can copy-paste the terminal output.
Use the markdown to paste code / runtime example like this :-)
Text is smaller than picture it works on text browsers etc.
Summary
In the current version, the ESP32-C6 does not behave correctly when sending data while operating in SPI Slave mode. This commit addresses the issue by ensuring proper data transmission. Additionally, Espressif's SPI controller uses a single buffer functioning as both TX and RX, which differs from other MCU manufacturers such as ST and Silicon Labs, as discussed and illustrated in the images below. With this commit, the SPI Slave behavior is expected to be appropriate on Espressif's RISC-V devices.
Impact
This change affects the operation of SPI Slave mode on Espressif's ESP32-C6 devices. Users utilizing SPI Slave configurations will be able to send data consistently and as expected, aligning with the behavior of SPI controllers from other MCU manufacturers. This improvement enhances interoperability and reliability of SPI communications in projects relying on these devices. Furthermore, the unified TX/RX buffer simplifies maintenance and ensures compatibility with future firmware and hardware updates.
For more details about compatibility, please take a look on #13855
You will see that the Espressif SPI controller has only one buffer to TX and RX data, so is necessary driver clear buffer if it have no data to be sent.
Below you can see behavior from stm32f4 mcu:
And below you can see behavior from efm32gg12 mcu:
Testing
To verify the effectiveness of this change, the spislv configuration available for the esp32c6-devkitm and esp32c6-devkitc kits was used. The tests involved sending data via SPI and observing that the master only receives the data being sent by the slave. The following environments and tools were utilized during testing:
Build and runtime logs before and after the change were analyzed to ensure that the SPI Slave behavior meets the expected outcomes.
Se results below:
Below I fixed only 2 bytes as answer:
Now only two bytes are send.