Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Transfer file PC to NetDuino SD Card


  • Please log in to reply
4 replies to this topic

#1 dottorduino

dottorduino

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationCatania, Italy

Posted 17 May 2012 - 09:04 AM

Hi,
it is possible transfer file from PC Application (WPF) to Netduino SD card reader?

If so, can I use code like this?
System.IO.File.Copy(_sourceFile, _destFile, true);
where _destFile is
_destFile = System.IO.Path.Combine(@"SD:\", "myfile.foo");

thank you
bye

#2 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 17 May 2012 - 11:20 AM

it is possible transfer file from PC Application (WPF) to Netduino SD card reader?

If so, can I use code like this?

System.IO.File.Copy(_sourceFile, _destFile, true);
where _destFile is
_destFile = System.IO.Path.Combine(@"SD:\", "myfile.foo");

I would have thought this was possible but not as simply as you would like. You do not get a direct connection between the PC and the SD card in the Netduino Plus. This leaves you with a coule of immediate options:

- Serial
- Network

As you are using a Netduino Plus then you could take advantage of some of the web servers which are present in the Projects forum. There is at least one web server project there which has implemented a method for uploading files to a web server running on the Netduino Plus. You could modify this code to meet your requirements.

Another method would be to send the file in chunks over a serial connection.

Hope this helps,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#3 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 17 May 2012 - 01:00 PM

Mark pretty much covered it. I have a data logging application that writes to several text files on the SD Card. I am working on doing it in reverse, where I am using a Windows Application to connect to the ND+ over serial port. So far I've written some code to enumerate the folders and return them to the windows app. The folders in this case represent each logging session. The user would then pick the folder they want to download and it would chunk up the files and send them over to the windows application (in theory). There are a couple serial communication classes floating around on here, but they would need to be modified to handle this type of scenario.

#4 dottorduino

dottorduino

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationCatania, Italy

Posted 24 May 2012 - 07:54 AM

ok! Thank you all.

#5 Arbiter

Arbiter

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationBrisbane, Australia

Posted 01 June 2012 - 05:31 AM

I originally used Nevyn's webserver idea but that uses so much space you can't do much else. I ended up creating a conceptually similar arrangement with a custom binary protocol over a socket. In my case there is a periodic uploading of log data and a periodic downloading of config data and the config data may trigger a downloading of new assemblies. Assuming you just want to send a predetermined file, all you need to do is write a TCP listener service that reacts to the establishment of a socket by writing the bytes from your file. If you can guarantee a fixed file size you can do the whole thing in two lines of code. My implementation supports variable numbers of variable length files including filenames, up and down, but it's still pretty simple. I can help if you need.The key to keeping it simple was to eliminate the exceptions - I always send files up, but sometimes there are zero of them, I always receive a config file down (it's cheaper and quicker than negotiating an optional send) and I always receive firmware files but sometimes there are zero of them. This very consistent back and forth has very little chatter and allows me to run a fast burst exchange and drop the socket (which is important to me because it lowers the duty cycle of the wireless broadband router - I cut the power when it's not in use, using a relay).
One day, all this too shall parse.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.