File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
13
13
- Replace UB code by a legitimate pointer access
14
14
- Reexport ` Direction ` from ` qei `
15
15
- Add dac
16
+ - Fix flash error flag clearing
16
17
17
18
## [ v0.10.0] - 2022-12-12
18
19
Original file line number Diff line number Diff line change @@ -166,7 +166,8 @@ impl<'a> FlashWriter<'a> {
166
166
self . lock ( ) ?;
167
167
168
168
if sr. wrprterr ( ) . bit_is_set ( ) {
169
- self . flash . sr . sr ( ) . modify ( |_, w| w. wrprterr ( ) . clear_bit ( ) ) ;
169
+ // reset by writing 1
170
+ self . flash . sr . sr ( ) . modify ( |_, w| w. wrprterr ( ) . bit ( true ) ) ;
170
171
Err ( Error :: EraseError )
171
172
} else {
172
173
if self . verify {
@@ -257,12 +258,14 @@ impl<'a> FlashWriter<'a> {
257
258
258
259
// Check for errors
259
260
if self . flash . sr . sr ( ) . read ( ) . pgerr ( ) . bit_is_set ( ) {
260
- self . flash . sr . sr ( ) . modify ( |_, w| w. pgerr ( ) . clear_bit ( ) ) ;
261
+ // reset by writing 1
262
+ self . flash . sr . sr ( ) . modify ( |_, w| w. pgerr ( ) . bit ( true ) ) ;
261
263
262
264
self . lock ( ) ?;
263
265
return Err ( Error :: ProgrammingError ) ;
264
266
} else if self . flash . sr . sr ( ) . read ( ) . wrprterr ( ) . bit_is_set ( ) {
265
- self . flash . sr . sr ( ) . modify ( |_, w| w. wrprterr ( ) . clear_bit ( ) ) ;
267
+ // reset by writing 1
268
+ self . flash . sr . sr ( ) . modify ( |_, w| w. wrprterr ( ) . bit ( true ) ) ;
266
269
267
270
self . lock ( ) ?;
268
271
return Err ( Error :: WriteError ) ;
You can’t perform that action at this time.
0 commit comments