Unable to Initialize Uart (HAL_UART_Init())
Hi everyone,
I want to start using the H743ZI serial communication with an hyperterminal software but i am not able to compile my project. I am using the STM32Cube_FW_H7_V1.3.0 UART POLLING example as a reference but everytime i try to compile my project i get those errors
.ARM has both ordered and unordered sections
final link failed: Bad value
make: *** [uart2.elf] Error 1
recipe for target 'uart2.elf' failed makefile /uart2/Debug
In my intent to solve this problem i delete this part of code:
if(HAL_UART_Init(&UartHandle) != HAL_OK)
{
Error_Handler();
}
and get no errors, but doing that i am not able to initialize the uart port.
Here is my main code, wish you can help me to face this problem.
int main(void)
{
/* Enable the CPU Cache */
CPU_CACHE_Enable();
/* STM32H7xx HAL library initialization:
- Systick timer is configured by default as source of time base, but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source), keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init();
/* Configure the system clock to 400 MHz */
SystemClock_Config();
/* Configure LED1, LED2 and LED3 */
BSP_LED_Init(LED1);
BSP_LED_Init(LED2);
BSP_LED_Init(LED3);
/*##-1- Configure the UART peripheral ######################################*/
/* Put the USART peripheral in the Asynchronous mode (UART Mode) */
/* UART configured as follows:
- Word Length = 8 Bits
- Stop Bit = One Stop bit
- Parity = None
- BaudRate = 115200 baud
- Hardware flow control disabled (RTS and CTS signals) */
UartHandle.Instance = USARTx;
UartHandle.Init.BaudRate = 115200;
UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
UartHandle.Init.StopBits = UART_STOPBITS_1;
UartHandle.Init.Parity = UART_PARITY_NONE;
UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
UartHandle.Init.Mode = UART_MODE_TX_RX;
//UartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
//UartHandle.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if(HAL_UART_DeInit(&UartHandle) != HAL_OK)
{
Error_Handler();
}
if(HAL_UART_Init(&UartHandle) != HAL_OK)
{
Error_Handler();
}
/* Infinite loop */
while (1)
{
HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, sizeof(aTxBuffer), HAL_MAX_DELAY);
HAL_Delay(1000);
}
}
