-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
stm32/qspi.c: Allow qspi_write_cmd_data to write cmd with 1 data byte. #11931
Merged
dpgeorge
merged 1 commit into
micropython:master
from
victorallume:feature/allow_single_databyte_qspi_write_cmd_data
Jul 13, 2023
Merged
stm32/qspi.c: Allow qspi_write_cmd_data to write cmd with 1 data byte. #11931
dpgeorge
merged 1 commit into
micropython:master
from
victorallume:feature/allow_single_databyte_qspi_write_cmd_data
Jul 13, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
victorallume
force-pushed
the
feature/allow_single_databyte_qspi_write_cmd_data
branch
2 times, most recently
from
July 4, 2023 05:36
6ce2eb9
to
59824a6
Compare
victorallume
changed the title
allow
stm32/qspi.c: Allow qspi_write_cmd_data to write cmd with 1 data byte.
Jul 4, 2023
qspi_write_cmd_data
to write a cmd with 1 byte of data
victorallume
added a commit
to victorallume/micropython
that referenced
this pull request
Jul 4, 2023
When initialising flash, write the second byte of SR as a separate command in addition to writing both bytes. Some flash chips require seperate write commands for the first and second bytes of the SR. In this case, we are only setting the Quad Enable bit on the second byte of the SR. If the flash chip only supports a multi-byte SR write, then the original SR write will succeed. If the flash chip only supports a single-byte SR write, only the second byte needs to be written as the first byte is unchanged for quad enable. If the flash chip supports both, then they will both be executed but still set the quad enable bit. If the chip doesn't support one of the commands, it should silently ignore the command and the other one should succeed. Depends on micropython#11931 for this to work on stm32 Signed-off-by: Victor Rajewski <victor@allumeenergy.com.au>
victorallume
force-pushed
the
feature/allow_single_databyte_qspi_write_cmd_data
branch
from
July 4, 2023 05:56
59824a6
to
62760e0
Compare
victorallume
added a commit
to victorallume/micropython
that referenced
this pull request
Jul 4, 2023
The existing spiflash driver writes both bytes of SR as a single command. Some flash chips don't support multi-byte writes such as this, and have a seperate command to write SR byte 1 and SR byte 2 (referred to in the code as CR). This used in the spiflash initialisation to enable quad mode. The quad enable bit is in the second SR byte. This change still issues the multi-byte command, then issues a single byte command for just the second SR byte. For chips that only support one of the commands, the unsupported command should be ignored silently. For chips that support both types of command, the SR will be written twice. This depends on micropython#11931 for the stm32 port to allow single-byte spi commands. Signed-off-by: Victor Rajewski <victor@allumeenergy.com.au>
victorallume
added a commit
to victorallume/micropython
that referenced
this pull request
Jul 4, 2023
The existing spiflash driver writes both bytes of SR as a single command. Some flash chips don't support multi-byte writes such as this, and have a seperate command to write SR byte 1 and SR byte 2 (referred to in the code as CR). This used in the spiflash initialisation to enable quad mode. The quad enable bit is in the second SR byte. This change still issues the multi-byte command, then issues a single byte command for just the second SR byte. For chips that only support one of the commands, the unsupported command should be ignored silently. For chips that support both types of command, the SR will be written twice. This depends on micropython#11931 for the stm32 port to allow single-byte spi commands. Signed-off-by: Victor Rajewski <victor@allumeenergy.com.au>
The existing qspi for stm32 implementation can only send a spi command with exactly 0 or 2 data bytes. Certain spiflash chips (e.g. AT25SF321B) have commands that only take a single data byte, and will ignore the command if more than that is sent. This commit allows sending a command with a single data byte. Signed-off-by: Victor Rajewski <victor@allumeenergy.com.au>
dpgeorge
force-pushed
the
feature/allow_single_databyte_qspi_write_cmd_data
branch
from
July 13, 2023 02:51
62760e0
to
730525c
Compare
Thanks for this, it looks correct. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The existing qspi for stm32 implementation can only send a spi command with exactly 0 or 2 data bytes. Certain spiflash chips (e.g. AT25SF321B) have commands that only take a single data byte, and will ignore the command if more than that is sent. This allows sending a command with a single data byte. Would be nicer to have a general function to send
n
bytes, but there probably aren't many commands that require this.