Jump to content
43oh

Mspusblib Massstorage-Problem


Recommended Posts

Hello everybody,

 

edit: Forget it, it's not a Problem on the controller-side. Everything is working like expected, it's the Host-side: windows didn't realize the File had changed and just "reopened" the old one...

 

I have a problem using the FatFS-library coming with MSPWare and the Mass-Storage-Class Implementation delivered with TI's USB-Dev-Package. I'm using a SD-Card to log some process data, which is working well. To access the data, I'm using the Mass-Storage-Class Implementation, like it is used in the examples delivered with the Dev-Package ("M2_SDCardReader"), which is working, too.

 

My problem is, that I'm not able to access any file using FatFS-library after opening that specific file on the host-PC. Opening any other file doesn't disturb the access.

 

What is bothering me, is that The FatFS-Library still thinks everything works and every access to the specified File results in "FR_OK", and the number of written bytes equals the expected number. 

 

I tried different approaches:

 

first to keep the file open on the MSP and appending the incoming Data

    ...

    f_mount(0, &FatFs);
    fr = f_open(&file, "time_1.txt", FA_WRITE | FA_OPEN_ALWAYS);
 
    while (1)
    {
        if(flags & RTC_FLAG)
        {
           fr = f_write(&file, "Something\n\r", 11, &bw);
           flags &= ~RTC_FLAG;*/
        }

        ...
        //The USB-Stuff exactly like in the example
        switch(USB_getConnectionState())
        {
            case ST_ENUM_ACTIVE:
            	USBMSC_processMSCBuffer(); // Handle READ/WRITE cmds from the host
            ...
        }
           
    }

and second to reopen and close the File for every write.

    ...

    f_mount(0, &FatFs);
 
    while (1)
    {
        if(flags & RTC_FLAG)
        {
           fr = f_open(&file, "time_2.txt", FA_WRITE | FA_OPEN_ALWAYS);
           fr = f_write(&file, "Something else\n\r", 16, &bw);
           fr = f_close(&file);

           flags &= ~RTC_FLAG;*/
        }

        ...
        //The USB-Stuff exactly like in the example
        switch(USB_getConnectionState())
        {
            case ST_ENUM_ACTIVE:
            	USBMSC_processMSCBuffer(); // Handle READ/WRITE cmds from the host
            ...
        }
    }

As I mentioned before, both versions work well, as long as I don't access the file from my host-PC. After that I'm unable to access the File again. Files I didn't open from the PC work like before...

 

What am I doing wrong?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...