Getting a file with HEX values off of an SD card and dumping it serially out with an Arduino

djsfantasi

Joined Apr 11, 2010
9,163
@upand_at_them , have you ever written a device driver in assembly language? Or any other language for that matter. The view of the data by a program can be and often is vastly different than the view of the device driver from the hardware. Let's imagine the case of a storage device perhaps like an SD card shield. The hardware often presents data in block form, such as a 512 byte sector. But the program can read or write the data in smaller (or larger) increments. Such as the Arduino SD read presenting one byte at a time to be processed. However, it is NOT reading from the SD card. It is reading from an internal buffer, a byte at a time. When the read request comes in, the driver is responsible for assuring that there is data available. On the Arduino, the driver is part of the library. If necessary, the driver reads from the SD card - in 512 byte blocks. It then passes a single byte to the program, keeping track of which bytes have been read. So where does the driver put the 512 bytes it has read from the hardware? In memory, allocating 512 bytes to itself. The program allocates one byte; the driver allocates 512 bytes.
Capture.PNG
@nsaspook, so in effect you have written your own library or device driver for an SD card? What microprocessor is it for? The language doesn't look like Arduino C, nor do the functions look like standard Arduino SPI functions? Just curious.
 
Top