2019-12-14 11:12 PM
I am sure that the CubeMx settings are fine as the HAL_UART_Transmit works efficiently.
Here is the code I have been using.(ignore extra definitions)
#include "main.h"
#include "stm32l4xx_hal.h"
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <math.h>
#include "i2c_comms.h"
int main(void)
{
int retval = 0;
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_USART2_UART_Init();
while (1) {
char in[8];
HAL_UART_Receive(&huart2, (uint8_t *)in, 8, 1000);
HAL_UART_Transmit(&huart2, (uint8_t *)in, 8, 1);
char test[6] = "check\n";
HAL_UART_Transmit(&huart2, (uint8_t *)test, 6, 100);
}
return 0;
}
void _Error_Handler(char *file, int line)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
while (1)
{
}
}
I have uploaded the results on the console which gives weird results for whatever input I give it.