Hi Daniel,
MQX’s MFS library is able to mount multiple drives. I haven’t tested it with 2 SD cards, but I verified that it works with 2 USB sticks connected on a HUB, applying the following changes to the mfs_usb example:
USB_Task.c -> USB_task(uint32_t para):
uint32_t fs_mountp = 0; changed to static uint32_t fs_mountp = 0;
Here is the log of the serial terminal showing the two drives:
Hope this will be useful for you
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Daniel,
Yes, you could use two SD cards on MQX. However, as the K60F120 device just have one SDHC module, the other card should be accessed using an SPI module (configure each file pointer properly).
Hope this will be useful for you
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Carlos,
If I configure the first SD card using SDHC and second one using SPI and install the MFS on both of them, they should work without conflict, is it corrrect?
Thank you.
-Daniel
Hi Daniel,
MQX’s MFS library is able to mount multiple drives. I haven’t tested it with 2 SD cards, but I verified that it works with 2 USB sticks connected on a HUB, applying the following changes to the mfs_usb example:
USB_Task.c -> USB_task(uint32_t para):
uint32_t fs_mountp = 0; changed to static uint32_t fs_mountp = 0;
Here is the log of the serial terminal showing the two drives:
Hope this will be useful for you
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Daniel,
Yes, MQX is setup to use the SPI driver for the sdcard driver. You can refer to the SD Card Driver chapter in the MQX IO User Guide for more details, installed with MQX at \doc\mqx\MQX_IO_User_Guide.pdf
Also, the MFS sdcard example at \mfs\examples\sdcard will work with the SPI driver as well. Refer to demo.c for this example. If the BSP does not have the SDHC driver installed, the example will attempt to use the SPI driver.
Thanks
Hi Derek,
That's what I thought when I read the MQXIOUG.pdf. But when I tried to use the example under \mfs\examples\sdcard, it required to enable the BSP_SDCARD_ESDHC_CHANNEL in user_config.h. And I checked the init_sdcard.c file, it seems it only use the esdhc no spi.
And I searched the whole MQX, there is no definition for BSP_SDCARD_SPI_CHANNEL.
Thank you.
-Daniel
Hi Daniel,
The BSPs for the Kinetis devices with the SDHC peripherals do not define the macro BSP_SDCARD_SPI_CHANNEL, since they use SDHC. But if you search the MQX source code for BSP_SDCARD_SPI_CHANNEL, you will find there are Kinetis BSPs that use it. For example, the twrk20d72m BSP has this macro defined because this Kinetis device does not include the SDHC peripheral, and the BSP is setup to use the SPI driver for the SDCARD driver.
I was able to use the twrk20d72m BSP as a reference, and modified the twrk60f120m BSP to use the SPI driver instead of SDHC. And then I tested with the MFS example \mfs\examples\sdcard to test this with the TWR-K60F120M board. This was with MQX v4.1.0. Attached are the files I modified, with a brief description below:
Thanks