2022-05-21 03:06 PM
Hello, I have a design with an STM32F446RCT6 where I use the FatFS file system and the USB HS as USB Host in Mass Storage Host Class.
The design is made with STM32CubeIDE 1.8.0 and the firmware package is V1.26.2 / 16-july-2021.
The configuration parameters for both FatFS and USB HS are essentially the defaults.
When I open and read a file from a pendrive, all work without problems while the file size is under about 100Kbyte. If I open and read a bigger file, say 200 Kbyte, the program hangs up into an infinite loop in startup_stm32f446rctx.s. This happens when it is executed a function named USBH_LL_GetURBState().
I have no idea about the reason that makes a difference in reading files of different size. The high level function that starts the reading of a block of data from the file is
ff_result = f_read(&source_file, p_buffer, 8192, &byte_read);
Every time this function reads the file takes only 8192 bytes putting them in a buffer. Then the buffer is processed and the software calls again f_read() for the next block of data. There is not any accumulation of data other than the 8192 bytes buffer.
Notice that I have another similar application on a similar processor (STM32L476RCT6) where I read files from a pendrive whose size is some hundred of Mbytes and the software works well without any problem.
I strongly need an idea or a suggestion about the supposed cause of this problem.
Thank you.
2022-05-21 04:13 PM
>>the program hangs up into an infinite loop in startup_stm32f446rctx.s
Like the HardFault_Handler() or Default_Handler() ?
The latter could occur if you're missing an IRQ Handler, the former can output information.
2022-05-22 10:08 AM
the code of the infinite loop (in startup_stm32f446rctx.s) is this:
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
* @param None
* @retval None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
2022-05-22 10:24 AM
It is related to some missing handler, but: