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

Fixes exceptions resulting from using SPI0Command #9140

Merged
merged 5 commits into from
Jul 25, 2024

Conversation

mhightower83
Copy link
Contributor

Resolves exceptions occurring when using experimental::SPI0Command for flash write operations such as: Write Status Register-1, Sector Eraser, etc.

Moved PRECACHE_END to ensure Wait_SPI_Idlep and xt_wsr_ps are included in the iCache.

Added SPIUCSSETUP to give more settling time for #CS.

…perations

such as: Write Status Register-1, Sector Eraser, etc.

Moved PRECACHE_END to ensure `Wait_SPI_Idlep` and `xt_wsr_ps` are included in the iCache.

Added SPIUCSSETUP to give more settling time for #CS.
and the "target opcode". They are now tightly coupled.

Update flash quirks.
@mhightower83
Copy link
Contributor Author

Let's put this on hold. I need to look closer at the sequence of calls used when doing write enabled by other examples. Some examples poll the status register until bit WEL is set before continuing.

SPI_write_enable for the special handling of the WEL bit.

Corrected zero mask for fractional byte returns where the partial
byte bits are positioned at the most significant bit position in the byte.
@mcspr
Copy link
Collaborator

mcspr commented Jun 19, 2024

Let's put this on hold. I need to look closer at the sequence of calls used when doing write enabled by other examples. Some examples poll the status register until bit WEL is set before continuing.

Still on hold?

Is this related to a specific flash chip? Or does this happen at random (or not so forced random) on any hardware?

@mhightower83
Copy link
Contributor Author

It looks ready. I haven't found any more issues.

Is this related to a specific flash chip? Or does this happen at random (or not so forced random) on any hardware?

This may be me overanalyzing and being over-cautious. The BootROM's SPI_write_enable() is consistently used to enable WEL. This appears to be the case in NONOS SDK and RTOS examples. And, that function likes to spin until the WEL bit is set. This kind of coding reminds me of some of the anomalies workarounds I have seen.

@mcspr mcspr merged commit c2f1365 into esp8266:master Jul 25, 2024
28 checks passed
@mhightower83 mhightower83 deleted the pr_fix_SPI0Command branch July 25, 2024 21:22
hasenradball pushed a commit to hasenradball/Arduino that referenced this pull request Nov 18, 2024
* Resolves exceptions occuring when using SPI0Command for flash write operations
such as: Write Status Register-1, Sector Eraser, etc.

Moved PRECACHE_END to ensure `Wait_SPI_Idlep` and `xt_wsr_ps` are included in the iCache.

Added SPIUCSSETUP to give more settling time for #CS.

* There was a risk of flash reads inserted between an "enable opcode"
and the "target opcode". They are now tightly coupled.

Update flash quirks.

* When sending instruction Write Enable 0x06, use BootROM API
SPI_write_enable for the special handling of the WEL bit.

Corrected zero mask for fractional byte returns where the partial
byte bits are positioned at the most significant bit position in the byte.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants