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.

emence

Member Since 15 Jun 2012
Offline Last Active Oct 05 2012 12:28 PM
-----

Posts I've Made

In Topic: specific memory access to sd - ovverride SPI

29 August 2012 - 02:00 PM

You would probably need to modify the firmware to achieve what you want as the file system (FAT) is initialised when the sd card is inserted (note the small micro switch on the socket) triggers an interrupt, which does quite a lot behind the scenes.


So that's how it works!

It may be easier for you to create a a shield which has some flash on it which you can use as you want then use that as a buffer to write to the SD card.


I used an ArduinoMega2560, with a dataflash chip over SPI. That worked really well. But addressing a Dataflash, also means that reading and writing only works in pages of 512 bytes. and that can get complicated and inefficient really easy, when you need to address one specific byte of an image..

Reading and writing single bytes is very easy thanks to the filestream... but it's too dam slow.


How would one tingle with the firmware? is there an example i could look at?

In Topic: writting to sd card - losing serialdata!

17 August 2012 - 03:18 PM

I would move the code that writes the file to the camera_DataReceived method too. Or at least call the writing of the file in that method. That way you'll keep code execution a bit more under control.


I will do that, and post any helpful results here. Maybe its of any use someday...

In Topic: writting to sd card - losing serialdata!

17 August 2012 - 01:15 PM

No you didn't

sorry. i meant, i did that now... it looks like this.

static void camera_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            int bytesReceived = serial.BytesToRead;
            if (isPicture && bytesReceived > 0)
            {
              //  incomingSerial = true;
                
                serial.Read(Buffer, 0, bytesReceived);
                System.Array.Copy(Buffer, 0, serialBuffer, bufferLength, bytesReceived);

               // serial.Read(serialBuffer, bufferLength, bytesReceived);
                bufferLength += bytesReceived;
                Debug.Print("" + bufferLength);
               // incomingSerial = false;
            }
            else
            {
                if (bytesReceived > 0)
                {
                    serial.Read(serialBuffer, 0, bytesReceived);
                    bufferLength += bytesReceived;
                }
            }
}

Your buffer doesn't sync right, that's the main issue I think.


how can i check?!!!
i tried waiting until the serialbuffer on the netduino 512byte is filled up and write to the SD card while it's filling up. but most of the time there were only ~32bytes in the buffer then it stopped.
only after reading the serial, the serialbuffer from the serial filled again up to about 32bytes.

like i said

I would need to Thread the SD-write process somehow, without interrupting the eventhandler from the serial...


You've been a great help so far helping me comprehend what's going on. Thanks a lot!

In Topic: writting to sd card - losing serialdata!

17 August 2012 - 09:38 AM

Thanks for your time!

Is there a reason Program isn't declared Static, while all methods and properties inside are static?


No reason...

I think you want to append to the buffer, not overwrite it all the time.


Did that.
this allowed me to save a smaller picture of 19200 bytes directly to the netduino.
and write it to the SD, after the picture was fully transferred.

Since I can't allocate 76800 bytes for a 320x240 picture I would need to Thread the SD-write process somehow, without interrupting the eventhandler from the serial...

There are only 60KB RAM right? I'd need 76.8KB :P

In Topic: writting to sd card - losing serialdata!

15 August 2012 - 03:46 PM

Could you maybe post the full project? It's hard to help you out with only one method available to analyse, especially when using global variables.


Sure, I can. If you really have the time :D I'm glad to.

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.