cancel
Showing results for 
Search instead for 
Did you mean: 

USART callback not working with new library

SLava.11
Associate

Hello

I using STM32F746 Dicovery kit.

USART callback worked before!!! All communication worked normal and both callbacks worked.

I did a mistake. Installed new stm32cubeide_1.6.1and removed an old IDE.

Now callback for receiving is working and transmit callback is not.

Nothing changed in my code.

After CUBE code generation it stops to work, but if I copy "STM32F7xx_HAL_Driver" folder from old project, everything starting to work again. For me it looks like wrong way. I want normally worked project.

I know, callbacks was changed, but I still see it in a library.

__weak void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)

I see two ways to fix my problem.

1) Install old library and forced a project to use it from the CUBE.

How I can find a proper library for installation?

2) Better way is fix a problem for current library.

What ST community recomend me to do, to find a reason why USART TX callback doesn't work with new library?

Thank you.

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
	if(huart->Instance == USART6)
	{
		Receive_one_byte(recByte);
		if (recivedStage == stage_RX)
			HAL_UART_Receive_IT(&huart6, &recByte, 1);
	}
}
 
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{
	Set_Local_485_Input();		//port to input
	recivedStage = stage_RX;	//receive again
    Tx_fl_ReceiveFrame 	= 0;
 
   	HAL_UART_Receive_IT(&huart6, &recByte, 1);
}
static void MX_USART6_UART_Init(void)
{
 
  /* USER CODE BEGIN USART6_Init 0 */
 
  /* USER CODE END USART6_Init 0 */
 
  /* USER CODE BEGIN USART6_Init 1 */
 
  /* USER CODE END USART6_Init 1 */
  huart6.Instance = USART6;
  huart6.Init.BaudRate = 60000;
  huart6.Init.WordLength = UART_WORDLENGTH_8B;
  huart6.Init.StopBits = UART_STOPBITS_1;
  huart6.Init.Parity = UART_PARITY_NONE;
  huart6.Init.Mode = UART_MODE_TX_RX;
  huart6.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  huart6.Init.OverSampling = UART_OVERSAMPLING_8;
  huart6.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
  huart6.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
  if (HAL_UART_Init(&huart6) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN USART6_Init 2 */
 
  /* USER CODE END USART6_Init 2 */
 
}

0 REPLIES 0