RS422 STM32发不出数据

F091的板子想RS422给上位机发数据,但是始终发送不了,debug程序可以运行,是不是配置的问题?
keil软件

USART5的配置如下:
void USART5_Config(u32 BaudRate)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOD,ENABLE); 
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC,ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART5,ENABLE);

GPIO_PinAFConfig(GPIOD,GPIO_PinSource2,GPIO_AF_2); 
GPIO_PinAFConfig(GPIOC,GPIO_PinSource12,GPIO_AF_2); 

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; // TX
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOC,&GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;            //RX
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;        
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; 
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; 
 GPIO_Init(GPIOD, &GPIO_InitStructure);

USART_InitStructure.USART_BaudRate = BaudRate;
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(USART5, &USART_InitStructure);
USART_ITConfig(USART5, USART_IT_RXNE, ENABLE);
USART_ITConfig(USART5, USART_IT_PE, ENABLE);

USART_ITConfig(USART5, USART_IT_ERR, ENABLE);

USART_Cmd(USART5, ENABLE);

NVIC_InitStructure.NVIC_IRQChannel = USART3_8_IRQn ;
NVIC_InitStructure.NVIC_IRQChannelPriority=0X00;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}

尝试过的解决方法 :之前中断函数用的USART5_IRQHandler,后来改成USART3_8_IRQHandler也还是不行,keil的一些配置也该过,现在主函数就想直接USART_SendData,到底是什么原因。。

用的USB-RS422的UT-891转换器,驱动使用的CSDN内下载的,串口调试助手可以读取到串口。

就想能接发数据就行!现在完全不知道是什么原因,到底是配置问题还是其他?。。另如果还需要什么提供的内容请尽管提!

单片机有一个集成开发工具,只要你选择STM的型号连一连线就会自动生成代码的。不需要手写。

你这个是USB转422 你单片机是TTL 能正常收发数据就怪了,你还需要一个TTL转422才行