2021-02-04 06:49 AM
BTW: The STwin_HelloWorld example for this board doesn't work (failed to download, wrong linker/memory map)
2021-02-04 07:41 AM
Probably not.
You'd have to construct something using things like FatFs, and map the functionality of the f_open/f_read/f_write in to more generic C library forms.
Typically they aren't using the standard C naming as the library contains placeholders or plumbing down to the read/write layer in syscalls.c with GCC/GNU.
Doing printf() to a screen requires a whole lot of painting and management, ie managing the cursor position, breaking down lines to write the text, and scroll up when the space is consumed.
I'd probably look to these are starting points
STM32Cube_FW_H7_V1.7.0\Projects\STM32H750B-DK\Applications\Display\LTDC_Paint
STM32Cube_FW_H7_V1.7.0\Projects\STM32H743I-EVAL\Applications\Display\LTDC_PicturesFromSDCard
2021-02-04 07:52 AM
Hello @CParr.1 ,
STM32Cube MCU Package for STM32H7 series comes with a rich set of examples running on STMicroelectronics boards. The examples are organized by board, and are provided with preconfigured projects for the main supported toolchains.
Unfortunately there is no Fatfs example for or the STM32H750B-DK board, you'll find a table resuming the available examples in the STM32Cube MCU Package examples for STM32H7 Serie Application Note .
Example selector allows you also to browse a large set of examples and to start a new project from a selected example:
Otherwise, you'll find linked the User Manual to develop applications on STM32Cube with FatFs.
Hope this gives some help to develop your project.
Khouloud.
2021-02-04 08:23 AM
That's disappointing. Maybe should have picked a different board? printf() is a wbni but getting a test file in and a test file out of the board is a must to validate the implementation and measure performance. I could obviously put the input test data into FLASH at load time but is there a better alternative?
2021-02-04 08:31 AM
Do ST have Cortex M7 board that has an example supporting fread/fwrite to a FATfs ?
2021-02-04 12:36 PM
Hi @CParr.1 ,
I can't get understand well your request, but here is a brief description of an example provided by ST.
As I indicated above, through the Example selector, you can browse a large set of examples and thanks to the filter panel it is possible to filter down the example list:
Taking FatFs_CopyFiles project for example: Which is an application describing how to use STM32Cube firmware with FatFs middleware component as a generic
FAT file system module. This example develops an application that exploits FatFs features to configure two microSD drives and copy files from the first instance to the second.
Opening the project folder :
In the generated app_fatfs.c file, you'll find this code snippet:
/**
* @brief File system : file operation
* @retval File operation result
*/
static int32_t FS_FileOperations(void)
{
FRESULT res; /* FatFs function common result code */
uint32_t byteswritten, bytesread = 128; /* File write/read counts */
uint8_t text[128];
/* Register the file system object to the FatFs module */
if(f_mount(&SDFatFs1, (TCHAR const*)SDPath1, 0) == FR_OK)
{
if(f_mount(&SDFatFs2, (TCHAR const*)SDPath2, 0) == FR_OK)
{
/* Open the text file object with read access */
if(f_open(&SDFile1, "0:STM32.TXT", FA_READ) == FR_OK)
{
/* Create and Open a new text file object with write access */
if(f_open(&SDFile2, "1:STM32.TXT", FA_CREATE_ALWAYS | FA_WRITE) == FR_OK)
{
while (bytesread == 128)
{
/* Read data from the text file */
res = f_read(&SDFile1, text, sizeof(text), (void *)&bytesread);
if (res == FR_OK)
{
/* Write data to the text file */
res = f_write(&SDFile2, text, bytesread, (void *)&byteswritten);
if ((bytesread != byteswritten) || (res != FR_OK))
{
return -1;
}
}
}
/* Close the open text file1 */
f_close(&SDFile1);
/* Close the open text file2 */
f_close(&SDFile2);
return 0;
}
}
}
}
/* Error */
return -1;
}
Hope this answers your question.
Khouloud.
2021-02-05 02:42 AM
Thanks for the response Khouloud,
Let me clarify what I want to do so that you can make a suggestion:
I have a audio codec application that takes a .wav and writes a compressed file. It's written and optimized for Cortex M7 (STH750B) and I want to make performance measurements on actual hardware. Testing requires the processing of a number of .wav files.
So the the most convenient board would be one that supported easy access via C code to read and write files (or a simple conversion of the files).
So my questions is:
Which board?
Which application example provides the best starting point?
Thanking you in advance
Cliff
2021-02-08 10:23 AM
Hi @CParr.1 ,
Sorry for the delay and thanks for your clarification. Actually there is not a developed example that exactly matches you request.
Backing to examples in the STM32Cube MCU Package examples for STM32H7 Serie Application Note, FatFs_USBDisk_Standalone example may be a good
start point to develop your application: This application describes how to use STM32Cube firmware with FatFs middleware component as a generic FAT file system module and STM32 USB On-The-Go (OTG) host library, in Fullspeed (FS) and High-speed (HS) modes, to develop an application exploiting FatFs offered features with USB disk drive configuration.
Starting from this project, you can modify it in order to get .wav audio data from USB Flash Disk.
The FatFs_USBDisk_Standalone example is developed on STM32H743I-EVAL board which comes with the stm32h743i_eval_audio.c file providing the Audio driver for the STM32H7B3I_EVAL.
The Audio_playback_and_record application (which describes how to use the USB device application based on the AUDIO Class implementation of an audio streaming (the output is a speaker/headset) capability on STM32H7xx devices) may also helps you on your project.
Otherwise, you'll find linked the SM32L4 hands-on workshop containing eleven Audio Player Labs (from STM32L4 workshop: 5.1 Audio Player - lab 1 to STM32L4 workshop: 5.11 Audio Player - lab 11).
Hope this helps you.
Khouloud.
2021-02-09 05:18 AM
Thanks Khouloud,
I don't need any actual audio record/playback.
Would the FatFs_uSD_Standalone example allow me to load files via uSD card port?. This runs on the cheaper STM32H735G-DK board so would be better.
Cliff
2021-02-09 05:34 AM
Hi @CParr.1 ,
The FatFs_uSD_Standalone example develops an application that exploits FatFs features to configure a microSD drive.
The application is based on writing and reading back a text file from a drive, and it's performed using FatFs APIs to access the FAT volume as described in the following steps:
You'll find more details about this application under <...\STM32Cube_FW_H7_V1.8.0\Projects\STM32H735G-DK\Applications\FatFs\FatFs_uSD_Standalone\readme.txt >
Hope this answers your question.
Khouloud.