CMSIS-Driver  
Peripheral Interface for Middleware and Application Code
 
Loading...
Searching...
No Matches
MCI UHS-I Tuning

Host-controller tuning operations and results. More...

Macros

#define ARM_MCI_UHS_TUNING_ABORT   (0x00UL)
 Abort or reset the sampling-clock tuning operation.
 
#define ARM_MCI_UHS_TUNING_START   (0x01UL)
 Start initial sampling-clock tuning operation.
 
#define ARM_MCI_UHS_RETUNING_START   (0x02UL)
 Start sampling-clock re-tuning during normal operation.
 
#define ARM_MCI_UHS_TUNING_DONE   (0)
 Tuning completed successfully.
 
#define ARM_MCI_UHS_TUNING_CONTINUE   (1)
 Another tuning-block is required.
 
#define ARM_MCI_UHS_TUNING_ERROR   (-1)
 Tuning failed.
 

Description

Host-controller tuning operations and results.

Call ARM_MCI_Control with control = ARM_MCI_UHS_TUNING_OPERATION. Set arg to one of the phase codes ARM_MCI_UHS_TUNING_ABORT, ARM_MCI_UHS_TUNING_START, or ARM_MCI_UHS_RETUNING_START.

These operations return an execution status, call ARM_MCI_Control with control = ARM_MCI_UHS_TUNING_RESULT and check returned value against ARM_MCI_UHS_TUNING_DONE, ARM_MCI_UHS_TUNING_CONTINUE, or ARM_MCI_UHS_TUNING_ERROR.

UHS-I tuning is performed iteratively until a valid sampling point is found or an error occurs.

Use this order of commands:

  1. Start tuning operation using ARM_MCI_UHS_TUNING_OPERATION with ARM_MCI_UHS_TUNING_START
  2. Transfer tuning block
  3. Inspect the result using ARM_MCI_UHS_TUNING_RESULT

Repeat steps 2 and 3 until the tuning result is ARM_MCI_UHS_TUNING_DONE or an error occurs.

Note
A data CRC error may identify an invalid sampling point and shall not be reported through the ordinary transfer-error event.

Example:

volatile uint32_t MCI_Events;
void MCI_SignalEvent_Callback (uint32_t event) {
// Save current event
MCI_Events |= event;
}
// Tune Sampling Clock
void mci_tune_sampling_clock(void) {
int32_t status;
uint8_t buf[64U];
uint32_t step = 40U;
uint32_t r1 = 0U;
// Start tuning operation
return;
}
while(step--) {
// Setup transfer
status = MCIdrv->SetupTransfer(buf, 1U, 64U, ARM_MCI_TRANSFER_READ|ARM_MCI_TRANSFER_BLOCK);
if (status != ARM_DRIVER_OK) {
break;
}
// Clear previous events
MCI_Events = 0;
// Transfer tuning block
status = MCIdrv->SendCommand(19, 0U, ARM_MCI_RESPONSE_SHORT|ARM_MCI_RESPONSE_CRC|ARM_MCI_TRANSFER_DATA, &r1);
if (status == ARM_DRIVER_OK) {
// Wait for event
while ((MCI_Events & ARM_MCI_EVENT_TRANSFER_COMPLETE) == 0U);
// Check the tuning result
status = MCIdrv->Control(ARM_MCI_UHS_TUNING_RESULT, 0U);
if (status == ARM_MCI_UHS_TUNING_DONE) {
// Tuning completed successfully
return;
}
if (status == ARM_MCI_UHS_TUNING_ERROR) {
// Tuning error occurred
break;
}
}
}
// Tuning failed
}
#define ARM_DRIVER_OK
Operation succeeded.
#define ARM_MCI_EVENT_TRANSFER_COMPLETE
Data transfer completed.
#define ARM_MCI_UHS_TUNING_OPERATION
Sampling clock tuning operation (SD UHS-I); arg specifies ARM_MCI_UHS_TUNING_* operation.
#define ARM_MCI_UHS_TUNING_RESULT
Sampling clock tuning result (SD UHS-I); returns ARM_MCI_UHS_TUNING_* result.
#define ARM_MCI_RESPONSE_CRC
Check CRC in response.
#define ARM_MCI_TRANSFER_DATA
Activate Data transfer.
#define ARM_MCI_RESPONSE_SHORT
Short response (48-bit)
#define ARM_MCI_TRANSFER_BLOCK
Block Data transfer (default)
#define ARM_MCI_TRANSFER_READ
Data Read Transfer (from MCI)
#define ARM_MCI_UHS_TUNING_DONE
Tuning completed successfully.
#define ARM_MCI_UHS_TUNING_ERROR
Tuning failed.
#define ARM_MCI_UHS_TUNING_ABORT
Abort or reset the sampling-clock tuning operation.
#define ARM_MCI_UHS_TUNING_START
Start initial sampling-clock tuning operation.

Macro Definition Documentation

◆ ARM_MCI_UHS_TUNING_ABORT

#define ARM_MCI_UHS_TUNING_ABORT   (0x00UL)

Abort or reset the sampling-clock tuning operation.

Stop any active data transfer and reset the tuning configuration.

◆ ARM_MCI_UHS_TUNING_START

#define ARM_MCI_UHS_TUNING_START   (0x01UL)

Start initial sampling-clock tuning operation.

This operation initializes a new sampling-clock search.

◆ ARM_MCI_UHS_RETUNING_START

#define ARM_MCI_UHS_RETUNING_START   (0x02UL)

Start sampling-clock re-tuning during normal operation.

After initial tuning, re-tuning may be required during normal operation, after ARM_MCI_EVENT_RETUNING_REQUEST. Re-tuning ensures that the sampling point remains optimal.

◆ ARM_MCI_UHS_TUNING_DONE

#define ARM_MCI_UHS_TUNING_DONE   (0)

Tuning completed successfully.

A valid sampling setting has been selected and applied. No further tuning block is required for this search.

◆ ARM_MCI_UHS_TUNING_CONTINUE

#define ARM_MCI_UHS_TUNING_CONTINUE   (1)

Another tuning-block is required.

The search has not completed, and another iteration is required.

◆ ARM_MCI_UHS_TUNING_ERROR

#define ARM_MCI_UHS_TUNING_ERROR   (-1)

Tuning failed.

No usable result is available from this search. Stop the tuning loop and perform abort/recovery.

This return value differs from ARM_MCI_EVENT_TUNING_ERROR. That event reports a sampling-circuit failure during normal operation.