Shop OBEX P1 Docs P2 Docs Learn Events
Connected SD card - how to make Kye's driver run slower? — Parallax Forums

Connected SD card - how to make Kye's driver run slower?

pik33pik33 Posts: 2,366
edited 2014-08-15 22:31 in Propeller 1
... but Kye's driver can't work @ 145 MHz. Set speed to 80 MHz and I have SD card mounted. At now I don't know if the Propeller is unstable @145 MHz or if something in SD driver run too fast.

Edit: All is clear now, the SD driver is running too fast. Class 10 card can be mounted @140 MHz while class 4 card cannot mount. Now I have to find a way to slow down the driver.

Comments

  • KyeKye Posts: 2,200
    edited 2014-08-13 05:20
    Just slow down the SPI routines... See the bottom of the ASM driver. An easy way is to just force the slow SPI code to be executed vs the fast SPI code. There's a variable in the ASM driver to switch between speeds.
  • KyeKye Posts: 2,200
    edited 2014-08-13 05:22
    Comment out line 2604.
  • pik33pik33 Posts: 2,366
    edited 2014-08-13 05:53
    Now I have to stop Propeller development, will return to this tomorrow.
    There is always alternative, I have self-made low level SD circuit for DE2-115, It initializes a SD card and can read and write sector to a buffer. So, maybe it will be easer to rewrite block read and write procedures to make use of this.
  • pik33pik33 Posts: 2,366
    edited 2014-08-15 10:42
    Cannot make the SD run @ 140 MHz even when low write and read speed is set in the driver. It run stable up to 120 MHz regardless of speed setting (I have even commented out these tjnz instructions, no results).
  • KyeKye Posts: 2,200
    edited 2014-08-15 11:57
    Disabling the fast mode SPI code from running should reduce the speed. However, the driver uses the PLL as a clock... so, at 140 MHz, you may be pushing the PLL to far. You should be able to modify the slow SPI routines without worry. The code for them is very straight forwards.
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-08-15 13:51
    might be a good time to look ar running the sd card in native mode - the mode most cards run in - quad or whatever they call it.
    Are you sure class x means anything to the simple spi mode we use?
  • pik33pik33 Posts: 2,366
    edited 2014-08-15 21:51
    Maybe these fake plls and then the FPGA delays causes these problems.

    The native mode is a problem. You have to calculate crc independent for every bit, 4 of them. It can be done with tables, but we will then lost all the speed gain. Of course this can be done with an FPGA.

    The spi mode works up to 50 MHz with modern card. I have a self-made hardware controller for SDHC card which initializes the card, then it can read and write a sector to memory buffer. 50 MHz gives up to 40 Mbps which may be sufficient for the Propeller.I used this with Nios2e and reading these 512 bytes from the buffer was much more slower than reading them from sd to the buffer in spi mode. Of course the Propeller - one cog of it - is several times faster than this NIOS (working up to 80 MHz on DE2-115, 6 clocks for instruction)
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-08-15 22:31
    pik33 wrote: »
    Maybe these fake plls and then the FPGA delays causes these problems.

    The native mode is a problem. You have to calculate crc independent for every bit, 4 of them. It can be done with tables, but we will then lost all the speed gain. Of course this can be done with an FPGA.

    The spi mode works up to 50 MHz with modern card. I have a self-made hardware controller for SDHC card which initializes the card, then it can read and write a sector to memory buffer. 50 MHz gives up to 40 Mbps which may be sufficient for the Propeller.I used this with Nios2e and reading these 512 bytes from the buffer was much more slower than reading them from sd to the buffer in spi mode. Of course the Propeller - one cog of it - is several times faster than this NIOS (working up to 80 MHz on DE2-115, 6 clocks for instruction)

    Even with my Tachyon SDFS I had problems at 140MHz with different cards but it works fine at 120MHz. I will have to find a spare class 10 card to see if it works any better.
Sign In or Register to comment.