<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=CS link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Je to tak. Dokonce to původně bylo správně, ale pak jsem to v rámci nějakého zmatkování „opravil“. Ale nepomohlo. Ale při zkoumání registrů v DS jsem provedl ještě další úpravy:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'>// moje PWM TIM3 chan<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'>#define PWM0_chan 3 // az po propojeni<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'>#define PWM1_chan 4<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'>#define PWM2_chan 2<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'>void pwmSet(char chan, uint16_t val) { // hodnota PWM -------------------------------------------------<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> switch(chan) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> //case 0: TIM3->CCR0 = val; break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 1: TIM3->CCR1 = val; break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 2: TIM3->CCR2 = val; break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 3: TIM3->CCR3 = val; break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 4: TIM3->CCR4 = val; break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> }<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'>}<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'>void pwmInit(uint8_t chan, char port, uint8_t pin, uint16_t per, uint16_t val) { // -------------------<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> RCC->AHBENR |= (1<<17) + (1<<18); // IOPAEN IOPBEN<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> RCC->APB1ENR |= 2; // APB peripheral clock enable TIM3<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> switch (port) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 'A':<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOA->MODER &= 0xffffffff-(3<<(pin<<1)); // port fn clear<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOA->MODER |= 2<<(pin<<1); // port alt fn<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOA->OTYPER &= 0xffffffff-(1<<pin); // push-pull<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOA->OSPEEDR |= 3<<(pin<<1); // port high speed<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> switch(chan) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 0:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 1:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOA->AFR[0] |= 1<<(pin<<2); // AF1<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 2:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOA->AFR[0] |= 1<<(pin<<2); // AF1<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 3:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 4:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> }<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 'B':<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOB->MODER &= 0xffffffff-(3<<(pin<<1)); // port fn clear<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOB->MODER |= 2<<(pin<<1); // port alt fn<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOB->OTYPER &= 0xffffffff-(1<<pin); // push-pull<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOB->OSPEEDR |= 3<<(pin<<1); // port high speed<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> switch(chan) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 0:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 1:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOB->AFR[0] |= 1<<(pin<<2); // AF1<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 2:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOB->AFR[0] |= 1<<(pin<<2); // AF1<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 3:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOB->AFR[0] |= 1<<(pin<<2); // AF1<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> case 4:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> GPIOB->AFR[0] |= 1<<(pin<<2); // AF1<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> }<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> break;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> }<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> TIM3->CR1 = 1; // Bit 1 UDIS: Update disable<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> TIM3->CCMR2 = 0b111<<12; // OC4M out 111 PWM mode 2, 110 PWM mode 1<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> TIM3->CCER = 0x3000; // CC4P 1: OC1 active low / CC4E 1: On - OC1 signal is output<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> TIM3->CNT = 0; // counter<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> TIM3->PSC = 0; // nedelit - 48 MHz<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> TIM3->ARR = per; // perioda<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> TIM3->CR1 = 1; // CEN 1: Counter enabled<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> pwmSet(chan, val); // hodnota PWM<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'>}<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'><o:p> </o:p></span></p><p class=MsoNormal>A v mainu:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> pwm0=10; pwm1=30; pwm2=180;<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> pwmInit(PWM0_chan, 'B', 0, CPU_freq/PWM_freq, pwm0);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> pwmInit(PWM1_chan, 'B', 1, CPU_freq/PWM_freq, pwm1);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> pwmInit(PWM2_chan, 'A', 7, CPU_freq/PWM_freq, pwm2);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> while (1) {<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, 1);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> HAL_GPIO_WritePin(LEDpwm0_GPIO_Port, LEDpwm0_Pin, 1);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> for (n=0; n<1000000; n++);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, 0);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> HAL_GPIO_WritePin(LEDpwm0_GPIO_Port, LEDpwm0_Pin, 0);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> for (n=0; n<1000000; n++);<o:p></o:p></span></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'> }<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Stav byl takový, že ty výstupy se chovaly jako vstupy. Na jednom, který končí testpinem (to je ta poznámka u definů „az po propojeni“) osciloskop ukazoval 0, na zbylých 2 byly skoro 4 V (připojeno na vstupy NCP81071A s pullupama, s napájením asi 7,5 V) a na PWM0, které vede na A9/TIM1.2 (nekonfigurován), bylo skoro 7.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Závěr ze čtení registrů: Je v nich všechno správně.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Po úpravě kódu ten nepoužitej už nemá 7, ale funguje jako výstup. Navíc na PWM1 (=B1/TIM3.4) je PWM 240 kHz. Zbylé 2 zůstaly stejné (0 a skoro 4), tedy asi stále vstupy.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Po kontrole výšeuvedeného textu jsem pojal podezření a před řádky s nastavením alternativní funkce jsem přidal:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:#843C0C;mso-style-textfill-fill-color:#843C0C;mso-style-textfill-fill-alpha:100.0%'>GPIOB->AFR[0] &= 0xffffffff - (3<<(pin<<2)); // nulovat AF<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Ale už se tím nic nezměnilo.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>PH</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b>Od: </b><a href="mailto:konfera@efton.sk">Jan Waclawek</a><br>Dobry postreh!<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>> GPIOA->MODER |= 2<<(1<<pin); <o:p></o:p></p><p class=MsoNormal>ma byt <o:p></o:p></p><p class=MsoNormal>GPIOA->MODER |= 2<<(pin<<1); <o:p></o:p></p><p class=MsoNormal>alebo mozno lepsie<o:p></o:p></p><p class=MsoNormal>GPIOA->MODER |= 0b10 << (2 * pin); <o:p></o:p></p><p class=MsoNormal>z coho je jasne vidiet, ze v MODER su 2 bity na pin.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>wek<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>----- Original Message ---------------<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Subject: Re: Zase STM32<o:p></o:p></p><p class=MsoNormal> From: Fanda Kopriva <info@elektronikavyvoj.cz><o:p></o:p></p><p class=MsoNormal> Date: Sun, 29 Nov 2020 22:39:56 +0100<o:p></o:p></p><p class=MsoNormal> To: hw-list@list.hw.cz<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>dobry vecer<o:p></o:p></p><p class=MsoNormal>tyto zapisy moc nepouzivam .takze mozna budu kecat ,ale vychazi mi to <o:p></o:p></p><p class=MsoNormal>nejak divne proto pisu "asi":<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>void pwmInit(uint8_t chan, char port, uint8_t pin, uint16_t per, <o:p></o:p></p><p class=MsoNormal>uint16_t val) parametry funkce<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>jak dopadne volani jednotlivych funkci<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> pwmInit(PWM0_chan, 'B', 0, CPU_freq/PWM_freq, pwm0); //chan = 3<o:p></o:p></p><p class=MsoNormal> GPIOB->MODER |= 2<<(1<<pin); > 2<<(1<<0) = 4 asi by melo byt <o:p></o:p></p><p class=MsoNormal>2 port.1 je asi nastaven do vystupu misto port.0 do altern.<o:p></o:p></p><p class=MsoNormal> case 3:<o:p></o:p></p><p class=MsoNormal> GPIOB->AFR[0] |= 1<<(pin<<2); // AF1 > 1<<(0<<2) = 1 to je asi spravne<o:p></o:p></p><p class=MsoNormal> break;<o:p></o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><o:p> </o:p></p></div></div></body></html>