2016-09-20 11:37 PM
Hi!
I'd like to use FATFS functionalities in my code (I don't use any OS). I tried to use FATS middleware generated by the cube but it only works when I disable my watchdog. I have seen that only blocking functions such as HAL_SD_ReadBlocks or HAL_SD_WriteBlocks are used in FATFS and that is why it's not working for me. Is there a kind of FATFS that would be working like the standalone version of LWIP? #fatfs-non-blocking2016-09-21 07:11 AM
Hi Gates,
It seems like you have a speed or/and interrupt priorities configuration problem(s) . Make sure that you are selecting ''the 4 bits wide bus mode for SDIO'' on STM32cubeMx. Set the SDIO_IRQn the highest priority (value 0). I recommend, also, that you check the user Manual ''STM32CubeMx for STM32 configuration and initialization C code generation --> part ''7. Tutorial 2 - Example of FatFs on an SD card using STM32429I-EVAL evaluation board Otherwise, share with us your .ioc file to help you more. -Hannibal-2016-09-21 04:32 PM
I would tend to push the FATFS/SDIO into it's own thread, without an OS one could do this by having that in the main loop, and doing other work in IRQ Handlers to manage buffers/queues which are then consumed in the loop.
Building a non-blocking, asynchronous type, IO stack is a non-trivial exercise, and I'm not sure FATFS was built to fit well into such a system, it is a much flatter/simpler implementation.2016-09-23 12:19 AM
Thank you for replying.
The tutorial you are talking about is the one I tested. I just removed LED code lines because I am not using an eval board. The watchdog reset happen when it tries to format the SD card (with f_mkfs function). If I comment this line everything is working but I wonder if a watchdog reset could happen again if I try to read/write something bigger than a simple ''Hello world'' string in my real code. You will find attached the IOC of my board.