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

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

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=46&amp;t=8822&amp;mode</id>
<entry>
<author><name><![CDATA[gronoarona]]></name></author>
<updated>2014-10-17T10:47:00+01:00</updated>
<published>2014-10-17T10:47:00+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=99403#p99403</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=99403#p99403"/>
<title type="html"><![CDATA[Re: STM32 USART]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=99403#p99403"><![CDATA[
Dzięki wielkie<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1598">gronoarona</a> — 17 paź 2014, o 10:47</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Federerer]]></name></author>
<updated>2014-10-16T14:03:01+01:00</updated>
<published>2014-10-16T14:03:01+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=99293#p99293</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=99293#p99293"/>
<title type="html"><![CDATA[Re: STM32 USART]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=99293#p99293"><![CDATA[
To ja dorzucę przykład &quot;ręczny&quot;:<br />[syntax=c]/*<br /> * f_usart.h<br /> *<br /> *  Created on: 23 sie 2014<br /> *      Author: Federerer<br /> */<br /><br />#ifndef F_USART_H_<br />#define F_USART_H_<br /><br />#define USART_BUFFER_SIZE 100<br /><br />typedef struct {<br /><br />uint8_t buffer&#91;USART_BUFFER_SIZE&#93;;<br />uint16_t head;<br />uint16_t tail;<br /><br />} usart_buf_t;<br /><br />extern usart_buf_t buff;<br /><br />void Config_USART1(uint32_t baud);<br />void UsartPutC(char c);<br />void UsartPutS(char *string);<br /><br /><br />#endif /* F_USART_H_ */[/syntax]<br /><br />[syntax=c]/*<br /> * f_usart.c<br /> *<br /> *  Created on: 23 sie 2014<br /> *      Author: Federerer<br /> */<br /><br />#include &lt;stm32f4xx.h&gt;<br />#include &lt;f_usart.h&gt;<br /><br />usart_buf_t buff;<br /><br />int Get_APB2_Prescaler(void) {<br /><br />int psc;<br />psc = 1 &lt;&lt; (((RCC-&gt;CFGR &amp; RCC_CFGR_PPRE2) &gt;&gt; 13) - 3);<br />if(psc &lt; 1) psc = 1;<br />return psc;<br /><br />}<br /><br />int Get_AHB_Prescaler(void) {<br /><br />int psc;<br />psc = 1 &lt;&lt; (((RCC-&gt;CFGR &amp; RCC_CFGR_HPRE) &gt;&gt; 4) - 7);<br />if(psc &lt; 1) psc = 1;<br />return psc;<br /><br />}<br /><br /><br />void Config_USART1(uint32_t baud) {<br /><br />RCC-&gt;APB2ENR |= RCC_APB2ENR_USART1EN;/* clock for USART1 */<br />RCC-&gt;AHB1ENR |= RCC_AHB1ENR_GPIOBEN;/* clock for GPIOB */<br />GPIOB-&gt;MODER |= GPIO_MODER_MODER6_1 | GPIO_MODER_MODER7_1;/* GPIOB_6 &amp; GPIOB_7 alternate function */<br />GPIOB-&gt;PUPDR |= GPIO_PUPDR_PUPDR7_1;/* pull-up on TX */<br />GPIOB-&gt;AFR&#91;0&#93; = 0x77000000;/* alternate function 7 on GPIOB_6 &amp; GPIOB_7 */<br /><br />USART1-&gt;BRR |= SystemCoreClock/Get_AHB_Prescaler()/Get_APB2_Prescaler()/baud;/* set baudrate */<br />USART1-&gt;CR1 |= USART_CR1_TE | USART_CR1_RE;/* transmitter and receiver enable */<br />USART1-&gt;CR1 |= USART_CR1_UE;/* USART enable */<br /><br />NVIC_SetPriority(USART1_IRQn, 0);/* priority for usart1 interrupt */<br />NVIC_EnableIRQ(USART1_IRQn);/* enable usart1 interrupt */<br /><br />}<br /><br />void UsartPutC(char c) {<br /><br />buff.buffer&#91;buff.head++&#93; = c;<br />if(buff.head == USART_BUFFER_SIZE) buff.head=0;<br />USART1-&gt;CR1 |= USART_CR1_TCIE;/* enable usart1 interrupt */<br /><br />}<br /><br />void UsartPutS(char *string) {<br /><br />while(*string) {<br /><br />UsartPutC(*string++);<br /><br />}<br /><br />}<br /><br />void USART1_IRQHandler(void)<br />{<br />if(USART1-&gt;SR &amp; USART_SR_TC) {<br /><br />GPIOD-&gt;ODR ^= (1&lt;&lt;15);<br /><br />if(buff.tail == buff.head) {<br /><br />USART1-&gt;CR1 &amp;= ~USART_CR1_TCIE;/* disable transfer complete interrupt */<br /><br />}<br />else {<br /><br />USART1-&gt;DR = buff.buffer&#91;buff.tail++&#93;;<br />if(buff.tail == USART_BUFFER_SIZE) buff.tail=0;<br /><br />}<br /><br />}<br /><br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=4440">Federerer</a> — 16 paź 2014, o 14:03</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[gronoarona]]></name></author>
<updated>2014-10-14T19:13:04+01:00</updated>
<published>2014-10-14T19:13:04+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=98983#p98983</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=98983#p98983"/>
<title type="html"><![CDATA[Re: STM32 USART]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=98983#p98983"><![CDATA[
dzięki wielkie.<br />Naprawdę !!!!<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1598">gronoarona</a> — 14 paź 2014, o 19:13</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Anonymous]]></name></author>
<updated>2014-10-14T17:58:56+01:00</updated>
<published>2014-10-14T17:58:56+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=98956#p98956</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=98956#p98956"/>
<title type="html"><![CDATA[Re: STM32 USART]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=98956#p98956"><![CDATA[
Mówisz -&gt; masz  <img src="https://forum.atnel.pl/images/smilies/icon_e_biggrin.gif" alt=":D" title="Bardzo szczęśliwy" /> <br /><br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />RCC_<span style="color: #FF00BF">AHB2</span>PeriphClockCmd( RCC_<span style="color: #FF00BF">APB2</span>Periph_USART6, ENABLE );<br /></div><p>Statystyki: Napisane przez Gość — 14 paź 2014, o 17:58</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[gronoarona]]></name></author>
<updated>2014-10-14T16:48:27+01:00</updated>
<published>2014-10-14T16:48:27+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=98941#p98941</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=98941#p98941"/>
<title type="html"><![CDATA[STM32 USART]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=8822&amp;p=98941#p98941"><![CDATA[
Witam <br /><br />Właśnie zaczynam wojnę z STM, mam płytkę discovery disco z stm32f429. Uporałem się już z diodami i przyciskami ale mam problem z usartem.<br />a mianowicie po inicjalizacji peryferiów i odpaleniu debugera podglądam rejestry od usarta i same zera, próbowałem wpisywać bezpośrednio wartości do tych rejestrów pomijając biblioteki CMISI ale to nic nie daje.<br /><br />Poniżej zamieszczam cały projekt w keil <br /><!-- m --><a class="postlink" href="http://www55.zippyshare.com/v/73391062/file.html" >http://www55.zippyshare.com/v/73391062/file.html</a><!-- m --><br /><br />oraz kody funkcji inicjalizacyjnej <br />[syntax=c]GPIO_InitTypeDef  GPIO_InitStructure;<br />USART_InitTypeDef USART_Init_struct;<br />USART_ClockInitTypeDef USART_ClockInitStructure;<br /><br />void usart_init(void)<br />{<br />//inicjalizacja zegara<br />RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOC, ENABLE );<br />RCC_AHB2PeriphClockCmd( RCC_APB2Periph_USART6, ENABLE );<br /><br />//konfiguracja alternatywnych wunkcji pinow<br />GPIO_PinAFConfig(GPIOC, GPIO_Pin_6, GPIO_AF_USART6);//connect P6 to usart6 TX<br />GPIO_PinAFConfig(GPIOC, GPIO_Pin_7, GPIO_AF_USART6);//connect P7 to usart6 RX<br /><br />//konfiguracja pinow<br />GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;<br />GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;<br />GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;<br />GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;<br />GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;  <br />GPIO_Init(GPIOC, &amp;GPIO_InitStructure);<br /><br /><br />//konfiguracja peryferiow<br />USART_Init_struct.USART_BaudRate = 9600;<br />USART_Init_struct.USART_WordLength = USART_WordLength_8b;<br />USART_Init_struct.USART_StopBits = USART_StopBits_1;<br />USART_Init_struct.USART_Parity = USART_Parity_No;<br />USART_Init_struct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;<br />USART_Init_struct.USART_Mode= USART_Mode_Rx | USART_Mode_Tx;<br /><br />USART_Init(USART6, &amp;USART_Init_struct);<br /><br />/* clock settings  */<br />  USART_ClockInitStructure.USART_Clock   = USART_Clock_Disable ;<br />USART_ClockInitStructure.USART_CPOL    = USART_CPOL_High ;<br />USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable;<br />USART_ClockInitStructure.USART_CPHA    = USART_CPHA_1Edge;<br />USART_ClockInit(USART6, &amp;USART_ClockInitStructure);<br /><br />USART_Cmd(USART6,ENABLE);<br />}[/syntax]<br /><br />Może ktoś na to spojrzy i wpadnie mu coś do głowy bo ja już nie wiem co robić.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1598">gronoarona</a> — 14 paź 2014, o 16:48</p><hr />
]]></content>
</entry>
</feed>