2015-01-10 01:14 AM
Dear All,
I would be grate if any one could advice me that in which page the SPI pin configuration is showing in the ''RM0091Reference manual'' STM32F0I mean, What are the proper Configure GPIO for MOSI, MISO and SCK pins.What is the exact pin configuration in which page is showing above configurationThanks in advance2015-01-25 09:02 AM
Dear Sir,
Following sentence is saying that the proper operation for SD card, the SCK signal must between 100KHz and 400KHzTo ensure the proper operation of the SD card, the SD CLK signal should have a frequency in the range of 100 to 400 kHz
Does following code do it, if the processor is running at 8MHz which is STM32F05 discover board default internal clock is ( 8MHz)SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_64;
Please advice
2015-01-25 10:16 AM
Well the APB rather than the CPU clock. But if that's at 8 MHz, the SPI is 125 KHz.
The cards want something at or below 400 KHz during initial start up, before switching to a speed suited to the specific card. They should all work at 400 KHz, though frankly most of the current ones will operate significantly faster.2015-01-26 08:21 AM
Dear Sir,
Thanks for the reply As per the SD driver manual, it saysTo communicate with the SD card, your program has to place the SD card into the SPI mode. To do this, set the MOSI and CS lines to logic value 1 and toggle SD CLK for at least 74 cycles. After the 74 cycles (or more) have occurred
Please advice that the, Isfollowing program correct for the above sentence#define SD_CS_HIGH() GPIO_SetBits(GPIOA, GPIO_Pin_4)
int SD_Init(){
uint32_t i = 0;
SD_CS_HIGH(); /*!< SD chip select high */
/*!< Send dummy byte 0xFF, 10 times with CS high */
/*!< Rise CS and MOSI for 80 clocks cycles */
for (i = 0; i <= 9; i++){
SD_WriteByte(SD_DUMMY_BYTE); /*!< Send dummy byte 0xFF */
}
}
After executing above program. Is there any Technic to check that the SD card in now in the SPI mode?
2015-01-26 09:56 AM
Is there any technique to check that the SD card in now in the SPI mode?
Sending it commands, and requesting status?2015-01-28 08:49 AM
Dear Sir,
I further modified the program inserting one more functionsint SD_GoIdleState(void)
{
SD_CS_LOW(); /*!< SD chip select low */
SD_SendCmd(CMD0, 0, 0x95);
}
This is the function I used to send the command, So in my case CMD0
void SD_SendCmd(uint8_t Cmd, uint32_t Arg, uint8_t Crc){
uint32_t i = 0x00;
uint8_t Frame[6];
Frame[0] = (Cmd | 0x40); /*!<
Construct
byte 1 */
Frame[1] = (uint8_t)(Arg >> 24); /*!<
Construct
byte 2 */
Frame[2] = (uint8_t)(Arg >> 16); /*!<
Construct
byte 3 */
Frame[3] = (uint8_t)(Arg >> 8); /*!< Construct byte 4 */
Frame[4] = (uint8_t)(Arg); /*!< Construct byte 5 */
Frame[5] = (Crc); /*!< Construct CRC: byte 6 */
for (i = 0; i < 6; i++)
{
SD_WriteByte(Frame[i]); /*!< Send the Cmd bytes */
}
}
Please advice that,Am I on correct track up to now?
Please note.SD_WriteByte() function is not showing hare
Please advice how can I check the SD card response Can I used 16GB micro SD card for this experiment? My only requirement on this stage is to identify that the SD card is in the idle state (#define SD_IN_IDLE_STATE 0x01)