DCRabbit_10 icon indicating copy to clipboard operation
DCRabbit_10 copied to clipboard

Added serial flash functions for RCM4200

Open neacsum opened this issue 3 years ago • 6 comments

RCB42XX.LIB contains serial flash functions optimized for the Adesto AT45DB641E used by RCM4200 modules. Both reading and writing speed have been improved with reading speed almost double from 0.8 ms/page to 0.4 ms/page. Also both reading and writing functions are no longer limited to page size. They can work on large blocks up to the available RAM.

SFLASH_INSPECT.C program has been updated to use the new functions ands fitted with additional commands.

neacsum avatar Feb 26 '21 14:02 neacsum

I'm curious if the optimizations could go into the generic SFLASH.LIB and apply to all products.

But I probably can't merge this into the official Dynamic C 10 release since I don't have an automated testing infrastructure for fully testing it. At this point I am focused on maintaining the codebase and fixing obvious bugs with minimal impact outside of the changed code.

I hope you'll keep it available to others who may be interested in improved flash performance on the RCM4200.

tomlogic avatar Mar 01 '21 00:03 tomlogic

I'm curious if the optimizations could go into the generic SFLASH.LIB and apply to all products.

Probably not. At least I couldn't do it, as I don't have the means to test them on other boards with serial flash.

I hope you'll keep it available to others who may be interested in improved flash performance on the RCM4200.

Sure. They will remain available in my fork of the repo. Feel free to close the PR if you think so.

neacsum avatar Mar 01 '21 01:03 neacsum

I'm curious as to how this compares to using the sbf_far_Read() and sbf_far_WriteFlash() APIs to read/write that flash.

tomlogic avatar Jun 16 '21 23:06 tomlogic

I'm curious as to how this compares to using the sbf_far_Read() and sbf_far_WriteFlash() APIs to read/write that flash.

I didn’t have time to run some timing tests today. Looking at the code, the read function should be only slightly slower (inner loop doesn’t seem optimized). The write function should be noticeably slower as it’s not alternating flash buffers.

Once I get some hard numbers, I’ll let you know.

neacsum avatar Jun 18 '21 01:06 neacsum

I'm curious as to how this compares to using the sbf_far_Read() and sbf_far_WriteFlash() APIs to read/write that flash.

Got some time to look into sbf... functions:

  1. BOOTDEV_SFLASH.LIB clashes with FLASHWR.LIB. Functions like _SectorToLong, getFlashID, getFlashWriteMode, getFlashSize, etc. are defined in both libraries.

  2. BOOTDEV_SFLASH was designed only for RCM4300, BL4S100 and RCM5xxx series.

Final answer is that sbf_far_Read and sbf_far_Write cannot be used for RCM4200 boards.

neacsum avatar Jun 21 '21 15:06 neacsum

Ah yes, I sometimes confuse the RCM4200 and RCM4300 because they swapped names during development.

The RCM4300 has a serial boot flash (SBF) and the RCM4200 has a serial data flash.

tomlogic avatar Jun 21 '21 19:06 tomlogic