ulibSD a library for use SD cards in SPI mode with uControllers.

ulibSD

It’s a library for use SD cards in SPI mode with uControllers, entirely written
in C. This library can work with SD cards and also has the possibility to
emulate the behavior in a PC file (GNU/Linux) using the macro _M_IX86. It’s for
debugging purposes. The data transfer is oriented to 512 byte size,
remember this.

ulibSD a library for use SD cards in SPI mode with uControllers.

Public methods

ulibSD has four public methods:

  • SD_Init: Initialization the SD card.
  • SD_Read: Read a single block of data.
  • SD_Write: Write a single block of data.
  • SD_Status: Allows know status of SD card.

Those methods require a device descriptor.

How is possible port the code to my platform?

This library uses a spi_io.h header. Here are defined the low-level methods
associated with the hardware. Those methods are:

  • SPI_Init: Initialize SPI hardware.
  • SPI_RW: Read/Write a single byte. Returns the byte that arrived.
  • SPI_Release: Flush of SPI buffer.
  • SPI_CS_Low: Selecting function in SPI terms, associated with SPI module.
  • SPI_CS_High: Deselecting function in SPI terms, associated with SPI module.
  • SPI_Freq_High: Setting frequency of SPI’s clock to maximun possible.
  • SPI_Freq_Low: Setting frequency of SPI’s clock equal or lower than 400kHz.
  • SPI_Timer_On: Start a non-blocking timer in milliseconds.
  • SPI_Timer_Status: Check the status of non-blocking timer.
  • SPI_Timer_Off: Stop of non-blocking timer.

You need write the proper code for this methods. I leave a spi_io.c.example
file for use as guideline. I hope this helps to you understand how is the logic
of portability. This example is for KL25Z board using my OpenKL25Z framework.

Also you need verify and adapt the integer types in the integer.h file.

For more detail: ulibSD a library for use SD cards in SPI mode with uControllers

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter