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:
- 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.
- A static function sdspi_init() is added that initialize the SPI
- A static function sdspi_write_byte() is added to write a byte to the SPI
- A static function sdspi_read_byte() is added to read a byte from the SPI
- The static function xmit_mmc() is changed. It now uses sdspi_write_byte() to write bytes
- The static function rcvr_mmc() is changed. It now uses sdspi_read_byte() to read bytes
- 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