<?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=46&amp;t=8961&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2014-10-26T12:57:17+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=46&amp;t=8961&amp;mode</id>
<entry>
<author><name><![CDATA[Jaku_B]]></name></author>
<updated>2014-10-26T11:32:53+01:00</updated>
<published>2014-10-26T11:32:53+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8961&amp;p=100796#p100796</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8961&amp;p=100796#p100796"/>
<title type="html"><![CDATA[Re: STM32F407 Discovery Problem z LIS302]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8961&amp;p=100796#p100796"><![CDATA[
<div class="quotetitle">Jaglarz napisał(a):</div><div class="quotecontent"><br />Na razie proszę się zastosować do tego: <!-- l --><a class="postlink-local" href="http://forum.atnel.pl/topic7402.html" >topic7402.html</a><!-- l --><br /></div><br /><br />Już się zastosowałem.<br /><br />W międzyczasie odkryłem, błąd w funkcji inicjującej SPI, poprawiłęm go i spowodowało to, że rejstry SPI ustawiają się, natomiast flaga RXNE nie ustawia się, co oznacza, że rejstr odbiorczy jest pusty i nie można przejść do procedury odczytu danych wysłanych z LIS302.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=6294">Jaku_B</a> — 26 paź 2014, o 11:32</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jaglarz]]></name></author>
<updated>2014-10-26T09:59:07+01:00</updated>
<published>2014-10-26T09:59:07+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8961&amp;p=100785#p100785</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8961&amp;p=100785#p100785"/>
<title type="html"><![CDATA[Re: STM32F407 Discovery Problem z LIS302]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8961&amp;p=100785#p100785"><![CDATA[
Na razie proszę się zastosować do tego: <!-- l --><a class="postlink-local" href="http://forum.atnel.pl/topic7402.html" >topic7402.html</a><!-- l --><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=471">Jaglarz</a> — 26 paź 2014, o 09:59</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jaku_B]]></name></author>
<updated>2014-10-26T12:57:17+01:00</updated>
<published>2014-10-25T23:56:52+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8961&amp;p=100759#p100759</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8961&amp;p=100759#p100759"/>
<title type="html"><![CDATA[STM32F407 Discovery Problem z LIS302]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8961&amp;p=100759#p100759"><![CDATA[
Witam wszystkich,<br /><br />Chciałem zasięgnać waszej porady w sprawie obsługiwania zainstalowanego na płytce discovery akcelerometru LIS302. Otóz od paru dni za nic nie mogę się z nim skontkatować a próbowałem już chyba wsztkiego. <br /><br />Podrzucam kod programu. Program zakleszcza się podczas pierwszej pętli while. Czyli wychodzi na to, że flaga TXE jest ustawiona, z tego wynika  ,że coś znajduję się w tym buforze.<br /><br />Podrzucam mój kod: <br />[syntax=cpp]#include &quot;stm32f4xx.h&quot;<br />#include &quot;stm32f4xx_spi.h&quot;<br />#include &quot;stm32f4_discovery.h&quot;<br />#include &quot;stm32f4_discovery_lis302dl.h&quot;<br /><br />uint16_t txdata&#91;2&#93;,rxdata&#91;2&#93;,y;<br /><br />static void  SPI_config();<br />static void  GPIO_config();<br />int main(void)<br />{<br />GPIO_config();<br />SPI_config();<br /><br /><br />GPIO_SetBits(GPIOE, GPIO_Pin_3);<br /> <br /><br />// Sprawdzenie czy TXE=1 oznacza to, że rejestr jest pusty <br />while (SPI_I2S_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET) <br />{}<br />SPI_I2S_SendData(SPI2, 0x20C7);    //Sensor Config<br />//Sprawdzenie czy RXNE=1 oznaczza to, że bufor nie jest pusty a dane są gotowe do odczytu<br />while (SPI_I2S_GetFlagStatus(I2S2ext, SPI_FLAG_RXNE) == RESET) <br />{}<br />rxdata&#91;1&#93; = SPI_I2S_ReceiveData(I2S2ext);<br />}<br />static void  GPIO_config()<br />{<br /> //Init SPI-Pins<br />  GPIO_InitTypeDef GPIO_InitStructure;<br />  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOE , ENABLE);<br />          GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;<br />          GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;<br />          GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;<br />          GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;<br />          GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;<br />          GPIO_Init(GPIOA, &amp;GPIO_InitStructure);<br />          //Init CS-Pin<br />          GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;<br />          GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;<br />          GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;<br />          GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;<br />          GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;<br />          GPIO_Init(GPIOE, &amp;GPIO_InitStructure);<br /> <br />          GPIO_SetBits(GPIOE, GPIO_Pin_3);  //Set CS high<br /> <br /> <br />          GPIO_PinAFConfig (GPIOA, GPIO_PinSource5,GPIO_AF_SPI2);<br />          GPIO_PinAFConfig (GPIOA, GPIO_PinSource6,GPIO_AF_SPI2);<br />          GPIO_PinAFConfig (GPIOA, GPIO_PinSource7,GPIO_AF_SPI2);<br /><br />}<br />static void  SPI_config()<br />{<br />  //SPI1 clock enable<br />  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI2, ENABLE);<br />    <br />    <br />  // Configuration and init. of SPI1<br />  SPI_InitTypeDef SPI_InitStructure;<br />  I2S_InitTypeDef I2SInitStruct;<br />  //SPI_I2S_DeInit(SPI2);<br />  <br />          SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;<br />          SPI_InitStructure.SPI_Mode = SPI_Mode_Master ;<br />          SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b ;<br />          SPI_InitStructure.SPI_CPOL = SPI_CPOL_High    ;<br />          SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;<br />          SPI_InitStructure.SPI_NSS = SPI_NSS_Soft ;<br />          SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32;<br />          SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;<br />          SPI_InitStructure.SPI_CRCPolynomial = 0;<br />          SPI_Init(SPI2, &amp;SPI_InitStructure);<br /> <br />          I2S_StructInit(&amp;I2SInitStruct);<br />          I2SInitStruct.I2S_Mode = I2S_Mode_SlaveRx;  <br />          I2SInitStruct.I2S_Standard = I2S_Standard_MSB;<br />          I2SInitStruct.I2S_DataFormat = I2S_DataFormat_16b;  <br />          I2SInitStruct.I2S_CPOL = I2S_CPOL_High;                <br />           <br />          I2S_Init(SPI2, &amp;I2SInitStruct);<br />          I2S_FullDuplexConfig(I2S2ext, &amp;I2SInitStruct);<br />          I2S_Cmd(SPI2, ENABLE);<br />          I2S_Cmd(I2S2ext, ENABLE);<br /> <br />          SPI_Cmd(SPI2, ENABLE);<br />}[/syntax]<br />Bardzo proszę was o jakieś wskazówki, będę ogromnie wdzięczny.<br />Pozdrawiam !<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=6294">Jaku_B</a> — 25 paź 2014, o 23:56</p><hr />
]]></content>
</entry>
</feed>