haxan7
Joined: 27 Jul 2013 Posts: 79
|
sst25vf.c Bug fixes |
Posted: Wed Aug 06, 2014 1:51 pm |
|
|
File: sst25vf.c
Location: C:\Program Files (x86)\PICC\Drivers
Compiler Version: v5.015
BUG #1
The following line
Code: | #define FLASH_ADDR_INVALID(addr) (addr > FLASH_SIZE) |
needs to be changed to:
Code: | #define FLASH_ADDR_INVALID(addr) (addr >= FLASH_SIZE) |
because addresses starts at zero, and the last byte is stored at FLASH_SIZE-1
BUG #2
At the start of the function void ext_flash_protect(FLASH_PROTECT_RANGE range), the following line should be added:
because BP0 is second bit of the Status Register.
BUG #3
In the function void ext_flash_protect(FLASH_PROTECT_RANGE range) this line
Code: | _ext_flash_send(SST25VF_WRITE_STATUS, TRUE); |
needs to be changed into:
Code: | _ext_flash_send(SST25VF_WRITE_STATUS, FALSE); |
BUG #4
Search for the following line:
Code: | static uint8_t _ext_flash_block_sizes[3] = {4096, 32768, 65536}; |
and change the uint8_t to uint32_t
Possible Compiler Bug
In function void ext_flash_protect(FLASH_PROTECT_RANGE range)
FLASH_XFER(range|FLASH_PROTECT_LOCK); was giving unpredictible results, following worked for me:
Code: |
uint8_t reg2send = range|FLASH_PROTECT_LOCK;
FLASH_XFER(reg2send);
|
More bugs incoming ...[/b] |
|