<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>Comments on: Datalog with MegaPirateNG 3.0.1 R4</title>
	<atom:link href="http://www.devfor8.com/datalog_3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devfor8.com/datalog_3/</link>
	<description>Development for Windows 8, Windows Phone 8 and HW stuff</description>
	<lastBuildDate>Sun, 07 May 2017 06:14:05 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.3</generator>
	<item>
		<title>By: admin</title>
		<link>http://www.devfor8.com/datalog_3/#comment-8090</link>
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 16 Feb 2015 07:42:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.devfor8.com/?p=55#comment-8090</guid>
		<description><![CDATA[SD as dataflash - yes, it should be possible but single memory chip is smaller and less problematic solution than SDcard in socket. Chip is available everywhere, ebay with free shipping include so I don&#039;t see it as problem. But it is open source so enjoy and use it :-D For example, now I am using PixHawk board and it have micro SD card for log

SD readable in PC - this is more bigger problem because it is different when you just store data and when you store data in FAT format. FAT writing take lot of space in processor memory/flash and is not easy implementable in mega 2560 with megapirate (no space)]]></description>
		<content:encoded><![CDATA[<p>SD as dataflash &#8211; yes, it should be possible but single memory chip is smaller and less problematic solution than SDcard in socket. Chip is available everywhere, ebay with free shipping include so I don&#8217;t see it as problem. But it is open source so enjoy and use it <img src="http://www.devfor8.com/wp-includes/images/smilies/icon_biggrin.gif" alt=":-D" class="wp-smiley" />  For example, now I am using PixHawk board and it have micro SD card for log</p>
<p>SD readable in PC &#8211; this is more bigger problem because it is different when you just store data and when you store data in FAT format. FAT writing take lot of space in processor memory/flash and is not easy implementable in mega 2560 with megapirate (no space)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: almol</title>
		<link>http://www.devfor8.com/datalog_3/#comment-8045</link>
		<dc:creator><![CDATA[almol]]></dc:creator>
		<pubDate>Fri, 13 Feb 2015 19:52:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.devfor8.com/?p=55#comment-8045</guid>
		<description><![CDATA[Hi.
If I understand, SPI protocol is used for SD cards, so it&#039;s possible to use an SD card instead of AT45DB161D?
Because old SD cards may be more accesible than SMD chip for many users and.. may be possible to read directly fom PC?]]></description>
		<content:encoded><![CDATA[<p>Hi.<br />
If I understand, SPI protocol is used for SD cards, so it&#8217;s possible to use an SD card instead of AT45DB161D?<br />
Because old SD cards may be more accesible than SMD chip for many users and.. may be possible to read directly fom PC?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: moscito</title>
		<link>http://www.devfor8.com/datalog_3/#comment-640</link>
		<dc:creator><![CDATA[moscito]]></dc:creator>
		<pubDate>Wed, 23 Jul 2014 15:45:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.devfor8.com/?p=55#comment-640</guid>
		<description><![CDATA[Hi,

thank you for the quick answer.
You were absolutely right. The &quot;SS&quot; did the trick.

test] logging
Testing dataflash logging
Manufacturer: 0x1f   Device: 0x2600
NumPages: 4096  PageSize: 528

Now that you explained it I also understood.

Excellent work - thanks for sharing this.


Greets 

Moscito]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>thank you for the quick answer.<br />
You were absolutely right. The &#8220;SS&#8221; did the trick.</p>
<p>test] logging<br />
Testing dataflash logging<br />
Manufacturer: 0x1f   Device: 0&#215;2600<br />
NumPages: 4096  PageSize: 528</p>
<p>Now that you explained it I also understood.</p>
<p>Excellent work &#8211; thanks for sharing this.</p>
<p>Greets </p>
<p>Moscito</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.devfor8.com/datalog_3/#comment-639</link>
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 23 Jul 2014 07:14:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.devfor8.com/?p=55#comment-639</guid>
		<description><![CDATA[Hi

you are almost ok :-) But there is misunderstanding in functionality of SS pin and CS pin. It is common because default SS pin is often used as default CS pin. We can&#039;t access pin 53 on board so we need to play with two pins instead of one. SS pin must be set to OUTPUT to make ATMega work in Master SPI mode. This is what you did wrong in your code.

Look on my and your code :

#define SPI0_SS_PIN SS  //here MUST BE &quot;SS&quot; even if you are using CS on different pin than 53 (as you do) because in 3.0.1 code is this not used for CS pin but we must use it for Master switch

This should be all what you need to do and then it should work. Just for sure check also this :

hal.gpio-&gt;pinMode(SPI0_SS_PIN, GPIO_OUTPUT); //and add this
_cs_pin-&gt;mode(GPIO_OUTPUT);
_cs_pin-&gt;write(1);

Here you can see switch of system &quot;SS&quot; pin to OUTPUT (and with this is ATMega switched to SPI master) and also you can see that _cs pin is set to output and 1 later. So both SS and CS pins are output, real CS (33) is also on &quot;1&quot;.]]></description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>you are almost ok <img src="http://www.devfor8.com/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley" />  But there is misunderstanding in functionality of SS pin and CS pin. It is common because default SS pin is often used as default CS pin. We can&#8217;t access pin 53 on board so we need to play with two pins instead of one. SS pin must be set to OUTPUT to make ATMega work in Master SPI mode. This is what you did wrong in your code.</p>
<p>Look on my and your code :</p>
<p>#define SPI0_SS_PIN SS  //here MUST BE &#8220;SS&#8221; even if you are using CS on different pin than 53 (as you do) because in 3.0.1 code is this not used for CS pin but we must use it for Master switch</p>
<p>This should be all what you need to do and then it should work. Just for sure check also this :</p>
<p>hal.gpio->pinMode(SPI0_SS_PIN, GPIO_OUTPUT); //and add this<br />
_cs_pin->mode(GPIO_OUTPUT);<br />
_cs_pin->write(1);</p>
<p>Here you can see switch of system &#8220;SS&#8221; pin to OUTPUT (and with this is ATMega switched to SPI master) and also you can see that _cs pin is set to output and 1 later. So both SS and CS pins are output, real CS (33) is also on &#8220;1&#8243;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: moscito</title>
		<link>http://www.devfor8.com/datalog_3/#comment-634</link>
		<dc:creator><![CDATA[moscito]]></dc:creator>
		<pubDate>Tue, 22 Jul 2014 19:19:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.devfor8.com/?p=55#comment-634</guid>
		<description><![CDATA[And ofcourse I changed the board type to RCTIMER_CRIUS_V2 in the APM_Config.h]]></description>
		<content:encoded><![CDATA[<p>And ofcourse I changed the board type to RCTIMER_CRIUS_V2 in the APM_Config.h</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: moscito</title>
		<link>http://www.devfor8.com/datalog_3/#comment-633</link>
		<dc:creator><![CDATA[moscito]]></dc:creator>
		<pubDate>Tue, 22 Jul 2014 19:16:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.devfor8.com/?p=55#comment-633</guid>
		<description><![CDATA[Greetings to Pilsen,

I tried to build the external memory mod and could not get it to work.

I am running a HK AIO V2 (Crius V1 clone) with MPNG 3.0.1R4 and wired the memory according to the primary post onto the SPI connector. CS ist connected to pin 33 on the board. I checked all wiring for three times. It&#039; all good.

So when it boots it blinks twice and locks up (stuck on SPI I guess). The O-scope shows CS pin going high once - so that seems to work.
I can see boot message on terminal but it never proceeds to CLI.

The code changes up here seem to be slightly different to mine.
The SPIDevice_SPI0.cpp is looking different.

Here is what I changed:

/libraries/AP_HAL_MPNG/SPIDeviceManager_MPNG.cpp

void MPNGSPIDeviceManager::init(void* machtnichts) {
    /* dataflow cs is on arduino pin 53, PORTB0 */
    AVRDigitalSource* df_cs = new AVRDigitalSource(_BV(4), PC);
    /* dataflash: divide clock by 2 to 8Mhz, set SPI_MODE_3
     * spcr gets 0x0C to set SPI_MODE_3
     * spsr gets bit SPI2X for clock divider */
    _dataflash = new AVRSPI0DeviceDriver(df_cs, 0x0C, _BV(SPI2X));
    _dataflash-&gt;init();
}


/libraries/AP_HAL_MPNG/SPIDevice_SPI0.cpp

#define SPI0_MISO_PIN 50
#define SPI0_MOSI_PIN 51
#define SPI0_SCK_PIN  52
#define SPI0_SS_PIN 33

AVRSemaphore AVRSPI0DeviceDriver::_semaphore;

static volatile bool spi0_transferflag = false;

void AVRSPI0DeviceDriver::init() {
    hal.gpio-&gt;pinMode(SPI0_MISO_PIN, GPIO_INPUT);
    hal.gpio-&gt;pinMode(SPI0_MOSI_PIN, GPIO_OUTPUT);
    hal.gpio-&gt;pinMode(SPI0_SCK_PIN, GPIO_OUTPUT);
    hal.gpio-&gt;pinMode(SPI0_SS_PIN, GPIO_OUTPUT);


Any suggestions?

Greetz

Moscito]]></description>
		<content:encoded><![CDATA[<p>Greetings to Pilsen,</p>
<p>I tried to build the external memory mod and could not get it to work.</p>
<p>I am running a HK AIO V2 (Crius V1 clone) with MPNG 3.0.1R4 and wired the memory according to the primary post onto the SPI connector. CS ist connected to pin 33 on the board. I checked all wiring for three times. It&#8217; all good.</p>
<p>So when it boots it blinks twice and locks up (stuck on SPI I guess). The O-scope shows CS pin going high once &#8211; so that seems to work.<br />
I can see boot message on terminal but it never proceeds to CLI.</p>
<p>The code changes up here seem to be slightly different to mine.<br />
The SPIDevice_SPI0.cpp is looking different.</p>
<p>Here is what I changed:</p>
<p>/libraries/AP_HAL_MPNG/SPIDeviceManager_MPNG.cpp</p>
<p>void MPNGSPIDeviceManager::init(void* machtnichts) {<br />
    /* dataflow cs is on arduino pin 53, PORTB0 */<br />
    AVRDigitalSource* df_cs = new AVRDigitalSource(_BV(4), PC);<br />
    /* dataflash: divide clock by 2 to 8Mhz, set SPI_MODE_3<br />
     * spcr gets 0x0C to set SPI_MODE_3<br />
     * spsr gets bit SPI2X for clock divider */<br />
    _dataflash = new AVRSPI0DeviceDriver(df_cs, 0x0C, _BV(SPI2X));<br />
    _dataflash-&gt;init();<br />
}</p>
<p>/libraries/AP_HAL_MPNG/SPIDevice_SPI0.cpp</p>
<p>#define SPI0_MISO_PIN 50<br />
#define SPI0_MOSI_PIN 51<br />
#define SPI0_SCK_PIN  52<br />
#define SPI0_SS_PIN 33</p>
<p>AVRSemaphore AVRSPI0DeviceDriver::_semaphore;</p>
<p>static volatile bool spi0_transferflag = false;</p>
<p>void AVRSPI0DeviceDriver::init() {<br />
    hal.gpio-&gt;pinMode(SPI0_MISO_PIN, GPIO_INPUT);<br />
    hal.gpio-&gt;pinMode(SPI0_MOSI_PIN, GPIO_OUTPUT);<br />
    hal.gpio-&gt;pinMode(SPI0_SCK_PIN, GPIO_OUTPUT);<br />
    hal.gpio-&gt;pinMode(SPI0_SS_PIN, GPIO_OUTPUT);</p>
<p>Any suggestions?</p>
<p>Greetz</p>
<p>Moscito</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomek</title>
		<link>http://www.devfor8.com/datalog_3/#comment-280</link>
		<dc:creator><![CDATA[Tomek]]></dc:creator>
		<pubDate>Thu, 05 Jun 2014 22:22:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.devfor8.com/?p=55#comment-280</guid>
		<description><![CDATA[I can confirm that this modification for 3.0.1 R4 and way to modify code works great.
Thank You DevFor8 for Your hard work.

Happy Datalogging, greets.]]></description>
		<content:encoded><![CDATA[<p>I can confirm that this modification for 3.0.1 R4 and way to modify code works great.<br />
Thank You DevFor8 for Your hard work.</p>
<p>Happy Datalogging, greets.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
