HydraFW binary SDIO mode guide - hydrabus/hydrafw GitHub Wiki

HydraFW binary SDIO mode guide

This guide is updated towards firmware release HydraFW v0.11 and later

This mode allows to control SDIO interface, used for raw access to SD Cards or eMMC chips.

  • SDIO pins: CLK=PC12, CMD=PD2, D0=PC8

Commands

Once the SDIO mode has been selected, the following commands are available :

  • 0b00000000 Return to main mode. Returns BBIO1
  • 0b00000001 Mode identification. Returns SDI1
  • 0b000001xx Send SDIO command
  • 0b000010xx Send SDIO command and write data block
  • 0b000011xx Send SDIO command and read data block
  • 0b1000000x Configure SDIO interface

Command details

Send command (0b000001xx)

This command reads one byte as the command ID, and 4 bytes as the command argument.

Format :

Byte 1           2          3          4          5         6
|----------|----------|----------|----------|----------|----------|
 [command]      [ID]           [         Argument           ]

Depending on the two last bits, the SDIO driver will wait for different response :

  • 0b00 : No response from card
  • 0b01 : Short response
  • 0b10 : Long response

This command returns 0x01 if successful, 0x00 in case of error.

Send command and write data block (0b000010xx)

This command is used to send a SDIO command followed by a data block. The block size is 512 bytes.

This command first reads one byte as the command ID, and 4 bytes as the command argument. 512 data bytes need to be sent afterwards

Format :

Byte 1           2          3          4          5         6        ...
|----------|----------|----------|----------|----------|----------|------...
 [command]      [ID]           [         Argument           ]       [ Data 

Depending on the two last bits, the SDIO driver will wait for a different command response :

  • 0b00 : No response from card
  • 0b01 : Short response
  • 0b10 : Long response

This command returns 0x01 if successful, 0x00 in case of error.

Send command and read data block (0b000011xx)

This command is used to send a SDIO command, then read a data block. The block size is 512 bytes.

This command first reads one byte as the command ID, and 4 bytes as the command argument.

Format :

Byte 1           2          3          4          5         6
|----------|----------|----------|----------|----------|----------|
 [command]      [ID]           [         Argument           ]

Depending on the two last bits, the SDIO driver will wait for a different command response :

  • 0b00 : No response from card
  • 0b01 : Short response
  • 0b10 : Long response

This command returns 0x01 if successful followed by 512 bytes, 0x00 in case of error.

Configure SDIO interface (0b1000000x)

The x value is used to set the SDIO bus width :

  • 0 is 1-bit mode
  • 1 is 4-bit mode