Commit 6313077
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 d513adc commit 6313077
1 file changed
+17
-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 | | |
| |||
160 | 158 | | |
161 | 159 | | |
162 | 160 | | |
163 | | - | |
164 | | - | |
165 | | - | |
| 161 | + | |
| 162 | + | |
166 | 163 | | |
167 | 164 | | |
168 | 165 | | |
169 | 166 | | |
170 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
171 | 176 | | |
172 | 177 | | |
173 | 178 | | |
| |||
195 | 200 | | |
196 | 201 | | |
197 | 202 | | |
| 203 | + | |
| 204 | + | |
198 | 205 | | |
199 | 206 | | |
200 | 207 | | |
201 | 208 | | |
202 | 209 | | |
203 | 210 | | |
| 211 | + | |
| 212 | + | |
204 | 213 | | |
205 | 214 | | |
206 | 215 | | |
| |||
224 | 233 | | |
225 | 234 | | |
226 | 235 | | |
| 236 | + | |
227 | 237 | | |
228 | 238 | | |
229 | 239 | | |
| |||
237 | 247 | | |
238 | 248 | | |
239 | 249 | | |
| 250 | + | |
240 | 251 | | |
241 | 252 | | |
242 | 253 | | |
| |||
0 commit comments