2020-04-21 01:30 AM
Hi,
I was hoping that this will be fixed in 5.6.1, but it's still there.
In function "DRESULT SD_read" is this part of code:
#if defined(ENABLE_SCRATCH_BUFFER)
}
else
{
/* Slow path, fetch each sector a part and memcpy to destination buffer */
int i;
for (i = 0; i < count; i++)
{
ret = BSP_SD_ReadBlocks_DMA((uint32_t*)scratch, (uint32_t)sector++, 1);
if (ret == MSD_OK )
{
The problem is that variable "ret" is not defined and I have to define it manually after each code generation.
My settings are FreeRTOS, DMA and defined ENABLE_SCRATCH_BUFFER and ENABLE_SD_DMA_CACHE_MAINTENANCE
Also in addition to this, on line 78 is this code with missing USER CODE END comment.
/* USER CODE BEGIN enableSDDmaCacheMaintenance */
#define ENABLE_SD_DMA_CACHE_MAINTENANCE 1
/* USER CODE BEGIN enableSDDmaCacheMaintenance */
The last thing is that I have defined symbol in project tool settings / Preprocessor "MBEDTLS_CONFIG_FILE="mbedtls_config.h" and this symbol disappear from the project settings every time the CubeMX code is generated, does anyone have any idea why is that happening?
Thanks,
Petr
2020-04-21 01:35 AM
Hello @PHlin.1
could you please share your ioc file ?
Thanks,
Khouloud
2020-04-21 01:43 AM
2020-04-21 07:46 AM
Hi @PHlin.1 ,
For the ret declaration , it's ok on my side : uint8_t ret = BSP_SD_ReadBlocks_DMA((uint32_t*)buff, (uint32_t)(sector), count); (using the 5.6.1 MX version)
For the USER CODE END , issue will be fixed.
Best Regards,
Khouloud
2020-04-21 08:00 AM
Sorry , For the USER CODE END , I have this result using your ioc file:
/* USER CODE BEGIN enableScratchBuffer */
/* USER CODE END enableScratchBuffer */
/* USER CODE END enableScratchBuffer */
2020-04-21 08:02 AM
/* USER CODE BEGIN enableScratchBuffer */
/* #define ENABLE_SCRATCH_BUFFER */
/* USER CODE END enableScratchBuffer */
2020-04-21 08:05 AM
@PHlin.1
Please forget about the latest comment, it's related to an other issue.
Regards,
Khouloud
2020-04-21 09:05 AM
Hi @Khouloud ZEMMELI ,
Which line are you referring to? The same function is called on multiple places and I'm referring to line 333 in generated source code (it's right below "for (i = 0; i < count; i++) {" . On most places there is indeed uint8_t ret = BSP_SD_ReadBlocks_DMA.... , but on that line is only ret = BSP_SD_ReadBlocks_DMA.
If I look into CubeMX template fatfs_sd_diskio_template_c_2.1.4.ftl , this uint8_t is also missing.
Thanks,
Petr
2020-04-21 09:08 AM
@Khouloud ZEMMELI
I was referring to enableSDDmaCacheMaintenance, not enableScratchBuffer
/* USER CODE BEGIN enableSDDmaCacheMaintenance */
/* #define ENABLE_SD_DMA_CACHE_MAINTENANCE 1 */
/* USER CODE BEGIN enableSDDmaCacheMaintenance */
2020-04-22 03:43 AM
Hi @PHlin.1
The ret is declared in line 278 as indicated in your comment : uint8_t ret = BSP_SD_ReadBlocks..
If there's any problem in the declaration you will receive a compilation error on it.
Best Regards,
Khouloud