Problem receiving with stm32f769i-disco
Hi, Haven't been here in a while, about 15yrs, ha! I dug out the subject board, STM32f769i-disco that I've used a number of times years ago. I built some code using the new cubemx, compiles fine in the new IDE. I can send data, but it just doesn't want to receive over the VCP.
According to the doc, the VCP is attached to usart1 on A9 and a10. Cubemx generates PB6 and 7 that don't work at all in tx or rx. So I changed them to a9 and a10, set the GPIO as below and I can tx without issue. But sending data to it using any of a number of codes on a PC doesn't work. it's not even getting interrupted as I am transmitting back data that should be overwritten if it had any type of reception.
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init( GPIOA, &GPIO_InitStruct);
/* UART RX GPIO pin configuration */
GPIO_InitStruct.Pin = GPIO_PIN_10;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Alternate =GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
Here's the init for the usart1:
/* USER CODE END USART1_Init 1 */
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
I have usart1, GPIOA clocks enabled. What I don't get, is if the VCP is tied to usart1, shouldn't it be using PB6 and PB7 as what I think the chip sees? But the table clearly says A9 and A10 unless that is the boards connectors? Either way, I've tried both.
Simple loop in main to send any received data as well as a known message.
while (1)
{
/* USER CODE END WHILE */
HAL_UART_Receive(&huart1, rxData, 10,1000); // receive to overlay message data
HAL_UART_Transmit(&huart1,rxData,10,1000); // send it back
HAL_UART_Transmit(&huart1,data,10,1000); // send a known message
HAL_Delay(100);
/* USER CODE BEGIN 3 */
}
I'm thinking it has something to do with the peripheral clock or I saw something about and alternative function clock and I can't find that anywhere.
Thanks,
jerry
