sdcard  1.5
Customations for HvA-Xmegaboard to SD-card library FatFs of Chan
sdmm.c File Reference

This is customized version of sdmm.c The original version is from sample generic release R0.11a. More...

Detailed Description

This is customized version of sdmm.c The original version is from sample generic release R0.11a.

Date
11 march 2020 (previous released 2016)

It is modified by Wim Dolman (w.e.dolman@hva.nl) for the HvA-Xmegaboard version 2 The most important global changes are:

  • It is suitable for the ATxmega256a3u.
  • It uses the Xmega style (DIRSET, OUTSET, ...).
  • It uses SPIC with a remap of (SCK and MOSI) in stead of bit banging.

The most important detailed changes are:

  1. The static function dly_us() is changed. It uses the normal delay functions. The delays are a little longer (about 1.5% at 32Hz) due to the fact that the for loop introduces extra clock cycles.
  2. A static function sdspi_init() is added that initialize the SPI
  3. A static function sdspi_write_byte() is added to write a byte to the SPI
  4. A static function sdspi_read_byte() is added to read a byte from the SPI
  5. The static function xmit_mmc() is changed. It now uses sdspi_write_byte() to write bytes
  6. The static function rcvr_mmc() is changed. It now uses sdspi_read_byte() to read bytes
  7. The function disk_initialize() is changed. It now uses the function sdspi_init() to initialize the SPI.
Note
It is beter to use a 32 MHz clock. The error in the delays will be relatively large at a low frequency