Simultaneous File I/O access to SD Drive using FAT and USB Msc device

Hello

I have the following setup 1)Hardware - a STM32F4xx Keil dev board type circuit 2)Middleware RL-USB with a composite configuration - Msc and Cdc connected to a Windows computer and 3:) RL-FLash FS (using a SD card running in native mode). It all running under RL RTX.

Everthing just about works... but when i use File I/O routines such as fcheck, ffind etc - (via the Usb Cdc interface) - it does not work. I tried fcheck - it comes back with a 1 - an error.

I did have this all working - I patched the ST USB device firmware together to make a composite driver, reworked the various ST routines and using the RL-Flash FS and got it all to work. When I say it worked - I don't mean having simultaneous access to files. The idea was to copy a file across using windows and then using a hyperterminal CLI interface to (with the Cdc interface) re-program the STM32Fxx flash. Ok so if was working why did I change it - well I was really hopping to use the Keil middleware in the project and then there is a very good chance there wont be any funny stuff. I had "funny stuff" on my ST code - sometimes - when hooked up to certain HP laptops.

I have tried variation on this theme - but it's not working.

....


FAT_VI      *mc0;
Media_INFO  info;


__task void init (void)
{
        CreateMailboxes();

        t_TerminalTask          = os_tsk_create (TerminalTask,5);
        t_LedTickTask           = os_tsk_create (LedTickTask,5);
        os_evt_set(EVENT_BOOTUP_COMPLETE,t_LedTickTask);

        t_I2C1Task              = os_tsk_create (I2C1Task,5);
        t_PowerManagmentTask    = os_tsk_create (PowerManagmentTask,2);
        t_ADCTask               = os_tsk_create (ADCTask, 2);
        os_evt_set(EVENT_BOOTUP_COMPLETE,t_PowerManagmentTask);


        usbd_init  ();

        mc0 = ioc_getcb (NULL);
        if (ioc_init (mc0) == 0)
                {
                ioc_read_info (&info, mc0);
                usbd_msc_init ();
                }
        usbd_connect(__TRUE);
        while (!usbd_configured ());


        os_tsk_delete_self ();
}

Any ideas? Does the RL-FS work with either the USB Msc or using the File I/O routines like fopen, fclose etc - but not both. There is a polling mechanism in the the Usb Msc to check if the drive is ready/available so it would seem to me that this is a viable possibility?

Many Thanks
Peter

Parents
  • Funny stuff, like coherency?

    True simultaneous access is going to be impossible to achieve, you have to be able to arbitrate access between one or the other. You might want to look at how you can block access to the microl-controller side, and recognize and emulate the SCSI commands/status so that Windows can successfully "Eject" your volume, and see when it returns.

Reply
  • Funny stuff, like coherency?

    True simultaneous access is going to be impossible to achieve, you have to be able to arbitrate access between one or the other. You might want to look at how you can block access to the microl-controller side, and recognize and emulate the SCSI commands/status so that Windows can successfully "Eject" your volume, and see when it returns.

Children
More questions in this forum