Problem exchanging data using onboard flash memory

19 Feb 2011

To comunicate a few bytes (7) of data to a program running on mbed I save a txt file to the flash memory while the mbed is plugged into my USB port. It appears on my PC as drive Q. The mbed program reads this file every two seconds, but if that read takes place when my PC checks the USB ports then drive Q appears unavailable so when mbed has finished reading the file it becomes available again and activates windows explorer as if it had just been plugged in. This is tollerable but if I save the text file to drive Q while mbed is trying to read it the interaction can corrupt the file to the extent I have had to reformat the mbed flash memory. Also I have had a BSOD which I attribute to this clash.

Is there a way to save to the flash memory on mbed in a way which doesn't clash with the mbed trying to read the same file?

20 Feb 2011

What type of program is creating the txt file on the PC? Is it possible for this program to write bytes out the serial port instead?

20 Feb 2011

Reply to Adam Green.

To test my mbed program I can compose the seven digit text string in Notepad and save it to the mbed flash memory. I have gone a step further now and written a Visual Basic program using MS Visual Studio which saves an identically composed string as a txt file in the same way as notepad.

Yes it is possible to send from a serial port I'm sure. That I hadn't thought of. I had thought I should try ethernet so I am ready to get a suitable breakout board. I take it you think I should use an alternative method to send my data as the easiest solution rather than continue with USB.

Except for this problem the testing has gone well with USB. I have even extended it over WiFi both through my local broadband router from my main PC and adhoc using a Wireless Access Point connected to my laptop and a wireless print server, with a USB port capable of feeding a mass storage device, connected to the mbed.

20 Feb 2011

Is there a way to save to the flash memory on mbed in a way which doesn't clash with the mbed trying to read the same file?

look at http://mbed.org/handbook/LocalFileSystem
The answer to your question is negative

20 Feb 2011

Reply to Robert Spilleboudt.

I have looked up your reference and I can see I need to communicate by another method.

I have had my mbed application read from the flash memory so often that I couldn't update the application once running. I reasoned that I should send it a new application with the reset button permanently pressed so I had sole access to the flash memory. I believe I got an application corrupted this way and ended up with a couple of BSODs as a result, although I don't know how a signal coming in through a USB port can do that.

22 Feb 2011

Quote:

Yes it is possible to send from a serial port I'm sure. That I hadn't thought of. I had thought I should try ethernet so I am ready to get a suitable breakout board. I take it you think I should use an alternative method to send my data as the easiest solution rather than continue with USB.

You can communicate serially with the device over the same USB connection if you install the virtual serial port drivers for Windows. This link talks about the mbed side coding that will be required and points to another page in the handbook which discusses the driver that needs to be installed for Windows to recognize the virtual serial port.