2019-09-05 05:07 PM
I have a shiny new Samsung EVO 32GB formated as 29.8GB Fat32
will it work ?
I have a H743
tried the FatFS application
it doesn't find the card.
FATFS_LinkDriver fails
2019-09-05 06:22 PM
std RTx1 PA9/PA10 for debug port.
turned of the TRANSCEIVER option = 0...
stuck here
DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count)
{
DRESULT res = RES_ERROR;
ReadStatus = 0;
uint32_t timeout;
#if (ENABLE_SD_DMA_CACHE_MAINTENANCE == 1)
uint32_t alignedAddr;
#endif
if(BSP_SD_ReadBlocks_DMA((uint32_t*)buff,
(uint32_t) (sector),
count) == MSD_OK)
{
/* Wait that the reading process is completed or a timeout occurs */
timeout = HAL_GetTick();
while((ReadStatus == 0) && ((HAL_GetTick() - timeout) < SD_TIMEOUT)) /// <---- stuck here
{
}
/* incase of a timeout return error */
if (ReadStatus == 0)
{
res = RES_ERROR;
}
else
2019-09-05 06:53 PM
"does a 32GByte ultra SD work in FatFS ?"
I'm able to use one with a F446 running FatFS,,,, I use the mbed libs for SD and not had an issue.
2019-09-05 06:56 PM
Yeah, wouldn't do that, apt to trash the media. Get READ working 100% first
FS_FileOperations() is some LCD User Interface stuff
Do this first
{
FATFS *fs;
DWORD fre_clust, fre_sect, tot_sect;
/* Get volume information and free clusters of drive 1 */
res = f_getfree("", &fre_clust, &fs);
if (res != FR_OK)
{
printf("res = %d f_getfree\n", res);
return;
}
switch(fs->fs_type)
{
case FS_FAT12 : puts("FAT12"); break;
case FS_FAT16 : puts("FAT16"); break;
case FS_FAT32 : puts("FAT32"); break;
case FS_EXFAT : puts("EXFAT"); break;
default : puts("Unknown FAT");
}
/* Get total sectors and free sectors */
tot_sect = (fs->n_fatent - 2) * fs->csize;
fre_sect = fre_clust * fs->csize;
/* Print the free space (assuming 512 bytes/sector) */
printsize(tot_sect / 2, "total drive space");
printsize(fre_sect / 2, "available");
printsize((tot_sect - fre_sect) / 2, "used");
}
in the sd_diskio_dma
/**
* @brief Rx Transfer completed callbacks
* @param hsd: SD handle
* @retval None
*/
void BSP_SD_ReadCpltCallback(void)
{
ReadStatus = 1;
}
in the bsp
/**
* @brief Rx Transfer completed callbacks
* @param hsd: SD handle
* @retval None
*/
void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd) // <- make sure you have this
{
BSP_SD_ReadCpltCallback(); // which calls this, that flags completion
}
Or do without DMA
/**
* @brief Reads Sector(s)
* @param lun : not used
* @param *buff: Data buffer to store read data
* @param sector: Sector address (LBA)
* @param count: Number of sectors to read (1..128)
* @retval DRESULT: Operation result
*/
DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count)
{
DRESULT res = RES_ERROR;
if(BSP_SD_ReadBlocks((uint32_t*)buff,
(uint32_t) (sector),
count, SD_TIMEOUT) == MSD_OK)
{
/* wait until the read operation is finished */
while(BSP_SD_GetCardState()!= MSD_OK)
{
}
res = RES_OK;
}
return res;
}
2019-09-05 07:16 PM
This is a non-DMA test for the SR1, so same USART1
Should output stats and a directory for card, then clocks/plls
2019-09-05 07:21 PM
2019-09-05 07:25 PM
2019-09-05 07:32 PM
Yes, the .HEX should give us a go/no-go indication if we're chasing ghosts or not without fighting about the build environment.
Will share source/project with you privately. Currently porting in the DMA plumbing into the SR1 demo
2019-09-05 07:32 PM
2019-09-05 08:16 PM
DMA has to go into 0x24000000 (512KB) SRAM1
/**
* @brief Configure the MPU attributes.
* @note The Base Address 0x24000000 is the SRAM1 accessible by the SDIO internal DMA.
the configured region is 512Kb size.
* @param None
* @retval None
*/
static void MPU_Config(void)
{
MPU_Region_InitTypeDef MPU_InitStruct;
/* Disable the MPU */
HAL_MPU_Disable();
/* Configure the MPU attributes as WT for SRAM1 */
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0x24000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_512KB;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER0; // Rank
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.SubRegionDisable = 0x00;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Enable the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
}
2019-09-05 08:17 PM