I have a custom board with Blackfin DSP and External SDRAM 64 MB and FreeRTOS. Reading from SDRAM using task with priority 6. In a test I read about 20000 words. Each word is twice consecutively, some the of words read do not match between the first read and second read. The two reads are done immediately one after the other.

If I repeat the same test using the highest priority, I do not get any errors.

If do the same test without FreeRTOS, I do not get any errors.

For normal operations I need to keep reading the SDRAM at low priority.

Any suggestions how to solve this issue ?d Where I need to look to find the cause of this issue ?



1 Answer 1


You probably have memory corruption due to the task switch of the RTOS.

An easy fix is to use the CRITICAL section of the freeRTOS while you do your read to avoid context switch.

A correct fix is to use Queues and Mutexes to pass data around, but without seeing code it's difficult to give a more precise answer.

  • \$\begingroup\$ Using critical in FreeRTOS is not acceptable as it disables all interrupts. I tried this. Can you give a generic example on using Queues in this case? Thank you. \$\endgroup\$
    – Adam
    Nov 16, 2020 at 18:36
  • \$\begingroup\$ Could it be because I am reading large date in a low prority task. but why the reading of the data gets corrupted even if there is a context switching \$\endgroup\$
    – Adam
    Nov 16, 2020 at 18:41
  • \$\begingroup\$ You have to post the code. \$\endgroup\$
    – Damien
    Nov 17, 2020 at 4:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.