Main Site Documentation

USB Mass Storage Device 4gb corrupted on write & XML write very slow


#1

Hi, this is my first post so apologies if I’ve made any faux pas’. I have been having serious issue writting to a 4gb USB flash drive using the code found in the beginners guide to NETMF, I then switched to a 2gb sd card in a usb reader adaptor, i.e. it should appear to any device as a usb flash drive, the read speed was significantly faster and it solved the file corruption issues I was experiencing. I know the cobra can do more than 2gb of sd,however is there a limit for USB mass storage and will i see further increases in speed the smaller the drive is?

On a seperate note, when I was trying to convert several (approx 10) arrays into xml to write to a file I found it painfully slow, i.e. 5 minutes for arrays of size 30. If i used the debug.print method it was as fast as I’d hope, i then tried to build my own serialiser and found that joining the strings seemed to be where i was loosing so much time, does anyone have any guidance to offer? is this actually the case or am i just approaching things in the wrong way?

Thanks in advance for your help.


#2

Try to keep your questions separate topics to we can help better.

Your flash issues is related to the flash itself, not the size. Maybe power is not sufficient for your stick.

About speed, sometimes it is necessary to write some methods naively, in RLP. You should only do this when absolutely necessary but the processing intensive code (like parsing or decoding arrays) will run about 100 times faster in RLP.

Welcome to the community.


#3

Thanks for the swift response, I’m currently powering the cobra just of USB, if I were to use an external power supply might this provide enough power for my flash drive?

I’m currently looking at creating a byte array of all my combined arrays that I can then directly write to file as opposed to converting to a string, if this still proves too slow I’ll move to Native code after developing the rest of the product, thanks for the advice.


#4

Yes try external power and see if it is any different. Perhaps try another large USB memory.