Witam. Mam problem z prawidłową komunikacją pomiędzy portem szeregowym w komputerze i programem Realterm a płytką Nucleo połączoną z modułem bluetooth HC-06. Po ustawieniu w Realterm odpowiednich wartości i otwarciu portu dioda w module zaczyna sygnalizować połączenie, w Realterm zapalają się CTS i DSR, niestety program nie otrzymuje żadnych danych.
Kod źródłowy:
#include "stm32f10x.h"
void sendchar(char c)
{
while(!USART_GetFlagStatus(USART3,USART_FLAG_TXE));
USART_SendData(USART3,c);
}
int main(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC|RCC_APB2Periph_AFIO,ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3,ENABLE);
GPIO_InitTypeDef gpio;
GPIO_StructInit(&gpio);
gpio.GPIO_Mode=GPIO_Mode_AF_PP;
gpio.GPIO_Pin=1<<10;
GPIO_Init(GPIOC,&gpio);
gpio.GPIO_Mode=GPIO_Mode_IN_FLOATING;
gpio.GPIO_Pin=1<<11;
GPIO_Init(GPIOC,&gpio);
GPIO_PinRemapConfig(GPIO_PartialRemap_USART3,ENABLE);
USART_InitTypeDef uart;
USART_StructInit(&uart);
uart.USART_HardwareFlowControl=USART_HardwareFlowControl_None;
uart.USART_Parity=USART_Parity_No;
uart.USART_StopBits=USART_StopBits_1;
uart.USART_WordLength=USART_WordLength_8b;
uart.USART_BaudRate=9600;
USART_Init(USART3,&uart);
USART_Cmd(USART3,ENABLE);
char x='x';
for(;;)
{
sendchar(x);
}
}