I have been working with a SAM3X-ek and the new SD card driver that was just released in asf 3.5. The included demo works fine but I am receiving “CMD55 Fail” errors when I try to use the sd card in Free RTOS.(timing error, my thought) None of the Atmel guys have done any testing with FreeRTOS and the sd card driver so I was just wondering if anyone in the FreeRTOS community had tried this?
I have done some testing with getting creating a sd card program from scratch similar to the demo. I figured out all of the various sd/fatfs compiler flags then I moved on to importing FreeRTOS. Once the FreeRTOS_used flag is enabled, f_open fails and throws a 3(FR_NOT_READY) error. If the SD card debug flag is turned on then you can see that CMD 55 is failing. I think this has to do with the Freertos timers that get enabled in the sd card driver once the flag is used but that is the extent of my knowledge/troubleshooting.
On the SAM4X-EK I have been able to use the ASF wizard inside Atmel Studio 6 to create the FreeRTOS peripheral control demo, then use the ASF Wizard to bring in the MMC driver and file system server. I had to uncomment a couple of items in the generated conf_example.h header file (generated by the ASF wizard) to enable the MMC if I recall correctly. After that I was able to successfully read and write to an SD card from a task.
The project will get released eventually, but I am adding a few other things to it first. I think all you need is in the ASF already though. If you are using Atmel Studio 6 then you can use the wizards in the IDE if you have the latest ASF version (the latest version can be downloaded from http://gallery.atmel.com).
I think I figured out the issue at least academically. I haven’t verified it yet. In the FreeRTOS PC demo, the FREERTOS_USED flag is not defined. So my guess is that is why it works. I am trying to integrate the sd card functionality into the lwip demo and it does have the flag defined. I am going to try to create a demo and modifiy the flag in the sdcard files and see if it works. That might be a temporary solution but at least it will allow me to move on to the next step.
So I have made positive progress over the weekend. I was able to create a project from scratch with the asf wizard. I added FreeRTOS 7.3 and ported a simplified version of the basic example. I added the sd card/fatfs drivers with the wizard and set the correct flags in the configuration files.
I created a task that detects the sd card, writes a string to the card then reads it back out. I think this is solid progress The next big task I think will be adding ethernet functionality. Is there a plan to add this to the asf wizard in the future?