FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2016 Threads] Readinf file from sdcard while in taskPosted by bruce4243 on August 16, 2016 I'm able to open and read files from an sdcard during an initialization section of code before starting the scheduler. I try to open and read a file from the same sdcard within a task after the scheduler is started and am not able to perform the read.
I don't get an error opening the file; however, when attempting a read I get an error:
FRDISKERR, /* (1) A hard error occured in the low level disk I/O layer */
I tried suspending the scheduler before the read, using critical sections etc, but am not able to perform a read. Any suggestions on how to proceed?
Readinf file from sdcard while in taskPosted by rtel on August 16, 2016 Which file system are you using?
Where did the integration come from?
How is the driver written - polling or interrupt driven?
Readinf file from sdcard while in taskPosted by bruce4243 on August 16, 2016 I'm using the FAT file system. The integration came from FreeRTOS. I'm not sure how the driver is written.
The versions are:
FATFS 8255 / Revision ID /
tskKERNELVERSIONNUMBER "V8.0.0"
To open the file:
FRESULT Res = fopen(&fil, path, flags);
To read the file:
FRESULT = fread((FIL)fh, dst, sizenum, &nRead);
I have no error opening it, just readig it. As a test I was able to open and read that same file before starting the scheduler.
Readinf file from sdcard while in taskPosted by rtel on August 17, 2016
I'm using the FAT file system
That doesn't narrow it down much....
FATFS
...but that does.
I'm not sure how the driver is written
Hmm. I think you are going to have to look at that as, without knowing what it is doing, you will not know if it is safe to use in a mult-threaded application.
FATFS itself has a configuration parameter that, with the provision of a small FreeRTOS port layer, wraps its API functions with macros that take and then give a semaphore to make the API functions thread safe, but the driver needs to be thread safe too (and compatible with FreeRTOS if it is using interrupts).
Readinf file from sdcard while in taskPosted by bruce4243 on August 17, 2016 I checked more about the FATFS integration and found it is from Xilinx for the zynq chip, not FreeRTOS. The driver that it reads the sdcard in ADMA2 polled mode.
This is not a perminate piece of code, it's a stop-gap until other functionality is ready. If it's a threading issue I'm fine with pausing the scheduler, but when I tried that it still did not work. Shouldn't it be enough to halt the scheduler when doing the read from sdcard?
Readinf file from sdcard while in taskPosted by bruce4243 on August 17, 2016 The problem was, in addition to pausing the scheduler, I had not disabled the D cache, it's working now in the task. Thanks for the support.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|