How to display data in the console from the array? Console returns strange signs
Hello :)
I was trying to send some data to the console using USART1 (STM32F7508-DK).
With the following simple data there was no problem:
uint8_t data[] = "HELLO! \r\n";
HAL_UART_Transmit(&huart1, data, sizeof(data), 1000);
But when I try to display values using that code:
uint8_t pData = 0x80;
uint16_t tempData[64];
uint8_t convtempData[128];
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_StatusTypeDef ret = HAL_ERROR;
uint8_t ACCEL_ADDR;
ACCEL_ADDR = 0xD0;
ret = HAL_I2C_IsDeviceReady(&hi2c1, ACCEL_ADDR, 1, 100);
ret = HAL_I2C_Master_Transmit(&hi2c1, ACCEL_ADDR, &pData, 2, 50);
ret = HAL_I2C_Master_Receive(&hi2c1, ACCEL_ADDR | 0x01, convtempData, 128, 150);
print_to_console(convtempData);
}And print _to_console() function look in that way:
void print_to_console(uint8_t* convtempData)
{
uint8_t space[] = " ";
for(int i = 0; i < sizeof(convtempData); i++)
{
HAL_UART_Transmit(&huart1, convtempData[i], sizeof(convtempData[i]), 1000);
HAL_UART_Transmit(&huart1, space, sizeof(space), 1000);
}
}From console:
Also, it looks like program exits print _to_console() after 4th iteration (i=3) and goes to the int main () to while(1).
Does anyone knows how to solve it?
USART1 configuration (same configuration in the console):

