nimaltd / spif

W25qxx, N25Qxx and other SPI FLASH driver for stm32 HAL
GNU General Public License v3.0
605 stars 173 forks source link

Bug : SPIF_WriteAddress() #44

Closed EdouardMALOT closed 9 months ago

EdouardMALOT commented 10 months ago

Thank you for sharing your project.

I found a bug using SPIF_WriteAddress() with the address not aligned to SPIF_PAGE_SIZE.

The problem is that "remaining" is compared to SPIF_PAGE_SIZE instead of ( SPIF_PAGE_SIZE - offset).

The corrected code looks like this

image
nimaltd commented 9 months ago

hello. thanks for your correction. but as I can remember, checking the offset is in the SPIF_WriteFn function. please have look and tel me your opinion. thanks

EdouardMALOT commented 9 months ago

Yes SPIFWriteFn() limit "Size" but does it silently_ :

image

This is why I applied the same limit with the same "maximum" variable name in SPIF_WriteAddress(). (Otherwise not all data is written and there are no errors reported).

nimaltd commented 9 months ago

it has been updated. please have a look. thanks