You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm testing flash sector erase on a STM32U5G and it doesn't work properly in all conditions.
I have tried to analyze the issue and here are my findings. If you want, I'm more than happy to work on a patch 😄
I think that this could be a summary of all the concurrent causes.
First, all U5 are dual bank but there is no selection of bank register (BKER) in blocking_erase_sector
According to ST specs PNB should be 8 bit, so I think the masking is wrong. It should probably 0xFF instead of 0x7F
This is not a problem for devices which has 2MB of flash or less since the maximum page index is 127, but it is a problem for devices with 4MB of flash which have a maximum page index of 255
The text was updated successfully, but these errors were encountered:
I'm testing flash sector erase on a STM32U5G and it doesn't work properly in all conditions.
I have tried to analyze the issue and here are my findings. If you want, I'm more than happy to work on a patch 😄
I think that this could be a summary of all the concurrent causes.
First, all U5 are dual bank but there is no selection of bank register (BKER) in
blocking_erase_sector
embassy/embassy-stm32/src/flash/u5.rs
Lines 69 to 79 in fb8e40b
Then there is a problem with page size. According to ST specs
But the
erase_size
in the metapac is set to 16384, while I think it should be 8192 to match the size of the pagehttps://github.com/embassy-rs/stm32-data-generated/blob/5373e57121b8300a3c2f03fb0408d857f6622607/stm32-metapac/src/chips/stm32u5g9zj/metadata.rs#L8-L18
This has been fixed for some variants of the U5 family but not for all
https://github.com/embassy-rs/stm32-data/blob/55b491ee982e52f80a21276a0ccbde4907982b5d/stm32-data-gen/src/memory.rs#L352-L353
Finally there is also another problem in the function for setting the PNB (page number) register here
https://github.com/embassy-rs/stm32-data-generated/blob/5373e57121b8300a3c2f03fb0408d857f6622607/stm32-metapac/src/peripherals/flash_u5.rs#L506-L516
According to ST specs PNB should be 8 bit, so I think the masking is wrong. It should probably 0xFF instead of 0x7F
This is not a problem for devices which has 2MB of flash or less since the maximum page index is 127, but it is a problem for devices with 4MB of flash which have a maximum page index of 255
The text was updated successfully, but these errors were encountered: