AnsweredAssumed Answered

serial com. USART6 not working

Question asked by o.ax on Sep 30, 2015
Latest reply on Oct 1, 2015 by o.ax
To start with, I know usart problems are common and I've read lots of threads and other sources trying to find whats wrong but I don't see it. Anyone here see anything to correct?
/*Enable USART6 clock*/   
 RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE);   
  
 /*GPIO stuff*/
RCC_AHB1PeriphClockCmd(RCC_GPIOC, Enable);
 
GPIO_InitTypeDef GPIO_InitStructure; //setup GPIO_InitStructure
 
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_AF_USART6;
GPIO_InitStructure.GPIO_Speed = GPIO_Fast_Speed;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
 
GPIO_Init(USART6,
          &GPIO_InitStructure);
 
 /*Connect pins to alternate function, ie USART*/
 GPIO_PinAFConfig(GPIOC, GPIO_PinSource6, GPIO_AF_USART6);
 GPIO_PinAFConfig(GPIOC, GPIO_PinSource7, GPIO_AF_USART6);
 
/*Initialization of USART */
USART_InitTypeDef USART_InitStructure; //setup UART_InitStructure
USART_ClockInitTypeDef USART_ClockInitStructure; //setup UART_ClockInitStructure
USART_ClockStructInit(&USART_ClockInitStructure);
 
USART_InitStructure.USART_BaudRate = 9600;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
 
USART_Init(USART6, &USART_InitStructure);
 
USART_ClockInit(USART6, &USART_ClockInitStructure);
 
USART_Cmd(USART6, ENABLE);

After this initialization we write with:
while (USART_GetFlagStatus(USARTx, USART_FLAG_TXE) == RESET);
USARTx->DR = value & (uint16_t)0xFF;
and read with:
while (USART_GetFlagStatus(USARTx, USART_FLAG_RXNE) == RESET);
return (uint16_t)(USARTx->DR & (uint16_t)0xFF);

But we don't get any data to our serial port, and yes the usart settings on the PC have been checked,

Any idea?
/Thanks

Outcomes