Спаял плату для stm32f405RG. Программирование через плату discovery.
stm32f405RG передают данные с usart3 через ft232 в компьютер.
Данные передаю в цикле.
USB превращается в виртуальный com-порт.
В терминалку поступает только байт 10-13 и всё. Смотрю осциллографом ногу 29 (PB10, Tx Usart3). Данных нет.
Пробовал гнать данные с discovery через ft232 с usart3. Там всё нормально.
Вот код:
CODE
void USART3_Configuration(void)
{
USART_InitTypeDef USART_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
/* Connect USART pins to AF7 */
GPIO_PinAFConfig(GPIOB, GPIO_PinSource10,GPIO_AF_USART3);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource11, GPIO_AF_USART3);
/* Configure USART Tx and Rx as alternate function push-pull */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Enable the USART OverSampling by 8 */
USART_OverSampling8Cmd(USART3, ENABLE);
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART3, &USART_InitStructure);
/* Enable USART */
USART_Cmd(USART3, ENABLE);
}
void Putchar(int8_t x)
{
uint16_t Data;
USART_SendData(USART3,(uint16_t)x);
while (USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET) {};
}
//-----------------------------------------------------------------------
int main(void)
{
RCC_Configuration();
GPIO_Configuration();
USART2_Configuration();
USART3_Configuration();
while (1)
{
volatile int x_i = 0;
Putchar(0x34);
for(x_i=0;x_i<1000;x_i++);
}
}
{
USART_InitTypeDef USART_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
/* Connect USART pins to AF7 */
GPIO_PinAFConfig(GPIOB, GPIO_PinSource10,GPIO_AF_USART3);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource11, GPIO_AF_USART3);
/* Configure USART Tx and Rx as alternate function push-pull */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Enable the USART OverSampling by 8 */
USART_OverSampling8Cmd(USART3, ENABLE);
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART3, &USART_InitStructure);
/* Enable USART */
USART_Cmd(USART3, ENABLE);
}
void Putchar(int8_t x)
{
uint16_t Data;
USART_SendData(USART3,(uint16_t)x);
while (USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET) {};
}
//-----------------------------------------------------------------------
int main(void)
{
RCC_Configuration();
GPIO_Configuration();
USART2_Configuration();
USART3_Configuration();
while (1)
{
volatile int x_i = 0;
Putchar(0x34);
for(x_i=0;x_i<1000;x_i++);
}
}
Кто-нибудь сталкивался с подобным?