-
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
Spi flash fix #5948
Spi flash fix #5948
Conversation
SPI should be configured while chip select pin is disabled. Tested with external flash on STM32 F4VE board.
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.
I don't think you want to do this. Removing this configures will break cases where the flash is on a shared SPI bus with a device that has different settings. This is rare but possible.
Instead, the port should guard against repeated calls and exit early. https://github.com/adafruit/circuitpython/blob/main/ports/atmel-samd/common-hal/busio/SPI.c#L216-L222 This protects the SPI from similar issues when used by SPIDevice which also calls configure
before each transaction.
…/write_data Removing this configures will break cases where the flash is on a shared SPI bus with a device that has different settings. This is rare but possible.
I see. I also was not sure about this change. But I was not aware that shared SPI bus use cases are possible with circuitpython.
Actually STM port does check the SPI configuration change before altering SPI state. I have added |
We're careful with the starting baudrate due to picky SD cards. That's where the 250k (IIRC) comes from.
That sounds perfect! |
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.
Looks good to me! Thank you!
Tested with STM32 F4VE board
https://stm32-base.org/boards/STM32F407VET6-STM32-F4VE-V2.0.html
Re-configuration the SPI on STM32F407 causes SCK signal to toggle.
This leads to Fast ReaD (0x0B) command failure in
check_fs
: 0x0B is treated as 0x85