Shop OBEX P1 Docs P2 Docs Learn Events
safe_spi? — Parallax Forums

safe_spi?

David BetzDavid Betz Posts: 14,516
edited 2010-09-03 12:17 in Propeller 1
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? :-)

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-03 11:39
    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.
  • David BetzDavid Betz Posts: 14,516
    edited 2010-09-03 11:47
    Thanks Mike! My microSD SPI interface doesn't seem to work at all so maybe I'd better go with the 'safe' version while trying to debug it!
  • lonesocklonesock Posts: 917
    edited 2010-09-03 12:11
    [8^)

    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
  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-03 12:17
    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.
Sign In or Register to comment.