<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=4&amp;t=11841&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2015-06-01T12:19:38+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=11841&amp;mode</id>
<entry>
<author><name><![CDATA[various]]></name></author>
<updated>2015-06-01T12:19:38+01:00</updated>
<published>2015-06-01T12:19:38+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130576#p130576</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130576#p130576"/>
<title type="html"><![CDATA[Re: Problem z akcelerometrem BMA220 (problem z I2C?)]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130576#p130576"><![CDATA[
Prostym kodem:<br /><br />[syntax=c]TWCR = (1&lt;&lt;TWEA) | (1&lt;&lt;TWEN);<br />TWBR = 72;<br /><br />TWCR = (1&lt;&lt;TWINT)|(1&lt;&lt;TWSTA)|(1&lt;&lt;TWEN);<br />while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />LCD_Home();<br />LCD_WriteText(&quot;START polecial&quot;);<br /><br />if ((TWSR &amp; 0xF8) != TW_START)<br />{<br />LCD_Home();<br />LCD_WriteText(&quot;START blad&quot;);<br />}<br /><br />TWDR = 0x0A;<br />TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);<br />LCD_Home();<br />LCD_WriteText(&quot;adres poszedl&quot;);<br /><br />while (!(TWCR &amp; (1&lt;&lt;TWINT)));<br />if ((TWSR &amp; 0xF8) != TW_MT_SLA_ACK)<br />{<br />LCD_Home();<br />LCD_WriteText(&quot;ACK nie doszedl&quot;);<br />}[/syntax]<br /><br />Zdebugowałem sobie, że ACK nie dociera do uC.. Ktoś może pomóc ? Mi już ręce opadają :/<br /><br />Układ zasilany 3.3V, ale sygnał leci z i do atmegi prosto bez konwertera. Na arduino działa to tak samo i DZIAŁA, a na atmedze 32A nie :/<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=9943">various</a> — 1 cze 2015, o 12:19</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[various]]></name></author>
<updated>2015-05-30T02:35:26+01:00</updated>
<published>2015-05-30T02:35:26+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130376#p130376</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130376#p130376"/>
<title type="html"><![CDATA[Re: Problem z akcelerometrem BMA220 (na Arduino działa, w C ]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130376#p130376"><![CDATA[
Oczywiście notę przejrzałem, ale nic mi po niej skoro nie mogę się dostać w ogóle do rejestrów. Program wisi na pętli sprawdzającej koniec transmisji. Adres modułu ten sam co podany w Arduino.. Wydaje mi się, że to raczej coś z moim kodem do obsługi I2C.. Aczkolwiek dziwne bo z RTC współpracuje.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=9943">various</a> — 30 maja 2015, o 02:35</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[eMCe2]]></name></author>
<updated>2015-05-29T20:27:25+01:00</updated>
<published>2015-05-29T20:27:25+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130361#p130361</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130361#p130361"/>
<title type="html"><![CDATA[Re: Problem z akcelerometrem BMA220 (na Arduino działa, w C ]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130361#p130361"><![CDATA[
Tak co do info o tym modelu...<br /><!-- m --><a class="postlink" href="https://ae-bst.resource.bosch.com/media/products/dokumente/bma220/bst-bma220-ds003-08.pdf" >https://ae-bst.resource.bosch.com/media ... 003-08.pdf</a><!-- m --><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1363">eMCe2</a> — 29 maja 2015, o 20:27</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[various]]></name></author>
<updated>2015-06-01T12:18:45+01:00</updated>
<published>2015-05-29T16:41:28+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130358#p130358</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130358#p130358"/>
<title type="html"><![CDATA[Problem z akcelerometrem BMA220 (problem z I2C?)]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=11841&amp;p=130358#p130358"><![CDATA[
Witam<br />Zakupiłem sobie moduł z akcelerometrm Bosch BMA220.<br /><br />Korzystając z tego kodu:<br /><a href="http://www.dfrobot.com/wiki/index.php/Triple_Axis_Accelerometer_BMA220(Tiny)_SKU:SEN0168"  class="postlink">http://www.dfrobot.com/wiki/index.php/Triple_Axis_Accelerometer_BMA220(Tiny)_SKU:SEN0168</a><br /><br />urządzenie działa na platformie arduino. Jako że programuję w C, chcę używać tego w swoim kodzie.<br /><br />Bazując na kodzie dla Arduino, stworzyłem swoje funkcje do obsługi akcelerometru:<br /><br />[syntax=c]void init_BMA220()<br />{<br />I2C_start(0x0A); // address of the accelerometer<br />// range settings<br />I2C_write(0x22); //register address<br />I2C_write(0x00); //can be set at&quot;0x00&quot;&quot;0x01&quot;&quot;0x02&quot;&quot;0x03&quot;, refer to Datashhet on wiki<br /><br />// low pass filter<br />I2C_write(0x20); //register address<br />I2C_write(0x05); //can be set at&quot;0x05&quot;&quot;0x04&quot;......&quot;0x01&quot;&quot;0x00&quot;, refer to Datashhet on wiki<br />I2C_stop();<br />}[/syntax]<br /><br />[syntax=c]void czytaj_BMA220()<br />{<br />I2C_start(0x0A); // address of the accelerometer<br />// reset the accelerometer<br />I2C_write(0x04); // X data<br />I2C_start(0x0A + 1);    // request 6 bytes from slave device #2<br />x_data=(int8_t)I2C_read_nack()&gt;&gt;2;<br />I2C_stop();<br /><br /><br /><br />I2C_start(0x0A); // address of the accelerometer<br />// reset the accelerometer<br />I2C_write(0x06); // X data<br />I2C_start(0x0A + 1);    // request 6 bytes from slave device #2<br />y_data=(int8_t)I2C_read_nack()&gt;&gt;2;<br />I2C_stop();<br /><br /><br /><br />I2C_start(0x0A); // address of the accelerometer<br />// reset the accelerometer<br />I2C_write(0x08); // X data<br />I2C_start(0x0A + 1);    // request 6 bytes from slave device #2<br />z_data=(int8_t)I2C_read_nack()&gt;&gt;2;<br />I2C_stop();<br />}[/syntax]<br /><br />Niestety program wisi już na etapie <strong>init_BMA220()</strong>, tak z minutę a tak nie powinno być. Oczywiście nie dostaję żadnych danych.<br /><br />Tutaj część funkcji I2C_Start gdzie program zwisa, a dokładnie w pętli która ma czekać na koniec transmisji. Sygnał START przechodzi.<br /><br />[syntax=c]// load slave address into data register<br />TWDR = address;<br />// start transmission of address<br />TWCR = (1&lt;&lt;TWINT) | (1&lt;&lt;TWEN);<br />// wait for end of transmission<br />while( !(TWCR &amp; (1&lt;&lt;TWINT)) );[/syntax]<br /><br /><br /><br />Korzystam z tej biblioteki do obsługi I2C:<br /><!-- m --><a class="postlink" href="https://github.com/devthrash/I2C-master-lib" >https://github.com/devthrash/I2C-master-lib</a><!-- m --><br /><br />Z modułem RTC DS1307 wszystko działa.<br /><br />Czy jest ktoś w stanie pomóc ? W internecie nie ma żadnego info dot. tego modułu.<br /><br />Dzięki i pozdrawiam<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=9943">various</a> — 29 maja 2015, o 16:41</p><hr />
]]></content>
</entry>
</feed>