4d systemsold. ?· turning technology into art. ... 55 (hex) or . u (ascii) : ... nak byte if...

Download 4D SYSTEMSold. ?· TURNING TECHNOLOGY INTO ART. ... 55 (hex) or . U (ascii) : ... NAK byte if unsuccessful…

Post on 28-Jun-2018

212 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • Uncontrolled Copy when printed or downloaded. Please refer to the 4D Systems website for the latest Revision of this document

    DRIVE (DRIVE-SD-G1)

    COMMAND SET

    Document Date: 23rd October 2012 Document Revision: 4.1 RE

    FERE

    NCE

    4D SYSTEMS TURNING TECHNOLOGY INTO ART

  • DRI

    VE

    COM

    MAN

    D SE

    T

    Contents

    1. Host Interface ......................................................................................................................... 3

    Command Protocol : Flow Control ......................................................................................................... 3 1.1.

    Serial Set-up : Auto-Baud ....................................................................................................................... 3 1.2.

    SD/SDHC Card support ........................................................................................................................... 3 1.3.

    Power-up and Reset ............................................................................................................................... 4 1.4.

    2. Memory Cards FAT16 Format ............................................................................................... 5

    3. Command Set ......................................................................................................................... 6

    General Commands ................................................................................................................................ 7 3.1.

    Low-Level (RAW) Disk Drive Commands ................................................................................................ 9 3.2.

    FAT-Level (DOS) Disk Drive Commands ................................................................................................ 12 3.3.

    4. Legal Notice .......................................................................................................................... 18

    5. Contact Information ............................................................................................................. 18

  • 4D SYSTEMS DRIVE COMMAND SET

    2012 4D SYSTEMS Page 3 of 18 www.4dsystems.com.au

    DRI

    VE

    COM

    MAN

    D SE

    T

    1. Host Interface

    The DRIVE is a slave peripheral device and it provides a bidirectional serial interface to a host controller via its UART. All communications between the host and the device occur over this serial interface. The protocol is simple and easy to implement, without the overhead of complicated packet-based protocols.

    Serial Data Format: 8 Bits, No Parity, 1 Stop Bit. Serial data is true and not inverted.

    Command Protocol : Flow Control 1.1.The DRIVE is a slave device and all communication and events must be initiated by the host. Each command is made up of a sequence of data bytes. When a command is sent to the device and the operation is completed, it will always return a response. For a command that has no specific response the device will send back a single acknowledge byte called the ACK (06hex), in the case of success, or NAK (15hex), in the case of failure.

    Commands having specific responses may send back varying numbers of bytes, depending upon the command and response. It will take the device a certain amount of time to respond, depending on the command type and the operation that has to be performed. If the DRIVE receives a command that it does not understand it will reply back with a negative acknowledge called the NAK (15hex). Since a command is only identified by its position in the sequence of data bytes sending incorrect data can result in wildly incorrect operation.

    Serial Set-up : Auto-Baud 1.2.The DRIVE has an auto-baud feature which can automatically detect the host speed and can set its internal baud rate to operate from 300 to 256K baud. Prior to any commands being sent to the module, it must first be initialised by sending the auto-baud character U (55hex) after any power-up or reset. This will allow the module to determine and lock on to the baud rate of the host automatically without needing any further set up. Once the device has locked onto the host baud rate it will respond with an ACK byte (06hex).

    Auto-Bauding must be performed each time the device is powered up or reset. If the host needs to change the baud rate, the DRIVE must be power/reset cycled. The U command cannot be used to change the baud rate during the middle of normal usage.

    SD/SDHC Card support 1.3.

    The DRIVE supports SD, micro-SD and MMC memory cards via its hardware SPI interface. The Device also supports High Capacity HC memory cards (4GB and above).

  • 4D SYSTEMS DRIVE COMMAND SET

    2012 4D SYSTEMS Page 4 of 18 www.4dsystems.com.au

    DRI

    VE

    COM

    MAN

    D SE

    T

    Power-up and Reset 1.4.

    When the DRIVE device comes out of a power up or external reset, a sequence of events must be observed before attempting to communicate with the module:

    Allow up to 500ms delay after power-up or reset for the DRIVE to settle. Do not attempt to communicate with the device during this period. The device may send garbage on its TX Data line during this period, the host should disable its Rx Data reception.

    The host transmits the auto-baud character (capital U, 55hex) as the first command so the device can lock onto the hosts baud rate.

    Once the host receives the ACK, the DRIVE is now ready to accept Disk Drive commands from the host.

  • 4D SYSTEMS DRIVE COMMAND SET

    2012 4D SYSTEMS Page 5 of 18 www.4dsystems.com.au

    DRI

    VE

    COM

    MAN

    D SE

    T

    2. Memory Cards FAT16 Format

    The DRIVE can communicate with off the shelf standard SDHC/SD/microSD cards. For any FAT file related operations, before the memory card can be used it must first be formatted with FAT16 option. The formatting of the card can be done on any PC system with a card reader. Select the appropriate drive and choose the FAT16 (or just FAT in some systems) option when formatting. The card is now ready to be used in the DRIVE based application.

    The DRIVE also supports high capacity HC memory cards (4Gb and above). The available capacity of SD-HC cards varies according to the way the card is partitioned and the commands used to access it. The FAT partition is always first (if it exists) and can be up to the maximum size permitted by FAT16. Windows will format FAT16 up to 2Gb and the Windows command prompt will format FAT16 up to 4Gb. For the RAW partition, byte reads and writes can access 2^32 (i.e. 4gb) of the card, Sector reads and writes can access 2^24 sectors (of 512 bytes, i.e. 8gb). The total amount of the card usable is the sum of the FAT and RAW partitions.

  • 4D SYSTEMS DRIVE COMMAND SET

    2012 4D SYSTEMS Page 6 of 18 www.4dsystems.com.au

    DRI

    VE

    COM

    MAN

    D SE

    T

    3. Command Set

    The data storage and retrieval takes place via the serial interface. A handful of easy to learn commands provide complete access to the memory card for data reads and writes. The simplified command set also means that very low overheads are imposed on the host controller. Commands and responses can be either single bytes or many bytes. All commands return a response, either an acknowledge or data.

    The command set is grouped into 3 sections: General Commands Low-Level (RAW) Disk Drive Commands FAT-Level Disk Drive Commands

    Each Command set is described in detail in the following sections.

    Separation characters such as commas ',' or spaces ' ' or brackets'(' ')' between bytes that are shown in the command/response syntax descriptors are purely for legibility purposes and must not be considered as part of any transmitted/received data unless specifically stated.

  • 4D SYSTEMS DRIVE COMMAND SET

    2012 4D SYSTEMS Page 7 of 18 www.4dsystems.com.au

    DRI

    VE

    COM

    MAN

    D SE

    T

    General Commands 3.1. Summary of Commands in this section:

    AutoBaud 55hex Version-Device Info Request 56hex FAT Protect - 59hex

    3.1.1. Autobaud - 55hex Command cmd cmd 55(hex) or U(ascii) : Command header byte Response acknowledge acknowledge 06(hex) : ACK byte Description This must be the very first command sent to the DRIVE after powerup or reset. This will

    enable the device to lock on to the host baud rate.

    3.1.2. Version-Device Info Request - 56hex Command cmd cmd 56(hex) or V(ascii) : Command header byte Response device_type, silicon_rev, pmmc_rev, reserved1, reserved2 device_type 03(hex) : This byte indicates the device type is DRIVE

    silicon_rev This byte indicates the GOLDELOX silicon revision pmmc_rev This byte indicates the PmmC firmware revision reserved1 This byte is reserved for future support. If the value is 0 then ignore it reserved2 This byte is reserved for future support. If the value is 0 then ignore it

    Description This command requests all the necessary information from the device about its characteristics and capability.