Commit a9284a6
committed
fix(spi_flash): Resolve protocol errors and write verification bug
This commit improves the robustness and protocol compliance of the SPI flash
driver by resolving critical bugs and standardizing command sequences.
Key Changes:
1. **Write Verification Bug (spi_flash_write_sb):**
* Replaced the complex bitwise verification logic with a direct comparison
(`verify == buf[j]`) for robust data validation.
2. **Protocol Violations & Performance:**
* **spi_flash_probe:** Fixed silent protocol failure by adding mandatory
`WREN` before `WRSR` and adding explicit `wait_busy()` and `WRDI`.
* **spi_flash_write_page:** Removed redundant `wait_busy()` after `WREN`
to improve performance.
* **Erase Functions:** Standardized erase flow by ensuring an explicit
`wait_busy()` is performed after `WREN` before issuing the command.
These changes prevent silent failures, potential flash corruption, and
unnecessary latency.
Signed-off-by: Badr Bacem KAABIA <[email protected]>1 parent a8afa74 commit a9284a6
1 file changed
+18
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | 125 | | |
128 | 126 | | |
129 | 127 | | |
| |||
159 | 157 | | |
160 | 158 | | |
161 | 159 | | |
| 160 | + | |
162 | 161 | | |
163 | | - | |
164 | | - | |
165 | | - | |
| 162 | + | |
| 163 | + | |
166 | 164 | | |
167 | 165 | | |
168 | 166 | | |
169 | 167 | | |
170 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
| |||
195 | 201 | | |
196 | 202 | | |
197 | 203 | | |
| 204 | + | |
| 205 | + | |
198 | 206 | | |
199 | 207 | | |
200 | 208 | | |
201 | 209 | | |
202 | 210 | | |
203 | 211 | | |
| 212 | + | |
| 213 | + | |
204 | 214 | | |
205 | 215 | | |
206 | 216 | | |
| |||
224 | 234 | | |
225 | 235 | | |
226 | 236 | | |
| 237 | + | |
227 | 238 | | |
228 | 239 | | |
229 | 240 | | |
| |||
237 | 248 | | |
238 | 249 | | |
239 | 250 | | |
| 251 | + | |
240 | 252 | | |
241 | 253 | | |
242 | 254 | | |
| |||
0 commit comments