I've seen numerous references to safe_spi recently in conjunction with fsrw. Can some tell me what makes safe_spi "safe"? Is there a "dangerous spi" as well? :-)
In the FSRW 2.6 archive, there are several different low level drivers. The slowest one was called the "safe" version because it's the slowest and least affected by wiring / noise / sloppy signals / cheap SD cards. Read the README file in the archive for more information.
The "safe" version writes out each bit at clkfreq/4, but reads bits in at clkfreq/8, so half speed. There is an "unsafe" version that reads and writes bits at clkfreq/4. This setup works great most of the time, but on some hardware (and only on PLL16X, with certain pin / cog configurations), the read data is wrong. For most applications using FSRW, it's best to use the "safe" version in that 1) it always works, and 2) it doesn't really impact the speed much if you're going through FSRW (i.e. raw read speeds drop from 1.8MB/s down to ~ 0.9MB/s, but with the overhead from FSRW you're looking at ~0.9MB/s either way).
The current version of FemtoBasic from the Object Exchange uses FSRW 2.6 with my own low-level SPI driver (also an I2C driver). This driver (sdspiFemto) is designed to do overlapped I/O although the Spin interface methods don't support it. They wait for any existing operation to complete before initiating a new one.
Comments
The "safe" version writes out each bit at clkfreq/4, but reads bits in at clkfreq/8, so half speed. There is an "unsafe" version that reads and writes bits at clkfreq/4. This setup works great most of the time, but on some hardware (and only on PLL16X, with certain pin / cog configurations), the read data is wrong. For most applications using FSRW, it's best to use the "safe" version in that 1) it always works, and 2) it doesn't really impact the speed much if you're going through FSRW (i.e. raw read speeds drop from 1.8MB/s down to ~ 0.9MB/s, but with the overhead from FSRW you're looking at ~0.9MB/s either way).
Jonathan