Skip to main content
wjian.2
Associate III
August 21, 2023
Solved

uart8 get only get noise in stm32h747i-disco

  • August 21, 2023
  • 4 replies
  • 2363 views
if in the osciloscopio only get noise in the HAL_UART_Transmit(&huart8,(uint8_t*)msg,strlen(msg),100); which part of code should be bad
static void MX_GPIO_Init(void)
 
{
 
 GPIO_InitTypeDef GPIO_InitStruct;
 
 /* GPIO Ports Clock Enable */
 
 __HAL_RCC_GPIOJ_CLK_ENABLE();
 __HAL_RCC_UART8_CLK_ENABLE();
 /*Configure GPIO pin: PJ8   For D1 pin for TX */
 GPIO_InitStruct.Pin = GPIO_PIN_8;
// GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
 
 //GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 
 //GPIO_InitStruct.Pull = GPIO_NOPULL; //pullup
 GPIO_InitStruct.Pull = GPIO_PULLUP; //pullup
 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
 
 GPIO_InitStruct.Alternate = GPIO_AF8_UART8;
 
  HAL_GPIO_Init(GPIOJ, &GPIO_InitStruct);
 
 
 
 /*Configure GPIO pin: PJ9   For D0 pin for RX */
 
 GPIO_InitStruct.Pin = GPIO_PIN_9;
 
 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; //MODE_ALTERNATE?
 
 //GPIO_InitStruct.Pull = GPIO_NOPULL; //or NOPULL?
 GPIO_InitStruct.Pull = GPIO_PULLUP;
 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
 
 GPIO_InitStruct.Alternate = GPIO_AF8_UART8;
 
 
HAL_GPIO_Init(GPIOJ, &GPIO_InitStruct);
 
 
}

static void MX_UART8_Init(void)
{
__HAL_RCC_UART8_CLK_ENABLE();

//__HAL_UART_CLEAR_IDLEFLAG(&huart8);
/* USER CODE BEGIN USART1_Init 0 */

/* USER CODE END USART1_Init 0 */

/* USER CODE BEGIN USART1_Init 1 */

/* USER CODE END USART1_Init 1 */
huart8.Instance = UART8;
huart8.Init.BaudRate = 9600;
huart8.Init.WordLength = UART_WORDLENGTH_8B;
huart8.Init.StopBits = UART_STOPBITS_1;
huart8.Init.Parity = UART_PARITY_NONE;
huart8.Init.Mode = UART_MODE_TX_RX;
huart8.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart8.Init.OverSampling = UART_OVERSAMPLING_16;
huart8.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart8.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart8.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;

if (HAL_UART_Init(&huart8) != HAL_OK)
{
Error_Handler();
}


}

This topic has been closed for replies.
Best answer by Tesla DeLorean

This is generating UART8 output on Pin D1 (PJ8), also blink LED1 to show it's alive and running. Should see roughly 4.8 KHz square wave

Use the .HEX, the .c file reflect's the project's primary main.c file

4 replies

Tesla DeLorean
Guru
August 21, 2023

Doesn't show how the code is called, or what the signal looks like.

Probes properly grounded?

Perhaps configure PJ8 as a GPIO and drive that high/low in a manner you can review / inspect ?

Should be the only connection for PJ8, not really understanding how it go this complicated / difficult.

Are there different versions of the H747I-DISCO board? What version are you using?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
August 21, 2023

Watch that msg has usable content. Perhaps send "UUUUU" strings?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
August 23, 2023

What version of the MB1248 board?

The static state of the UART TX pin should be HIGH

I mean HAL_GPIO_WritePin() or interaction with GPIOJ->ODR and readback via GPIOJ->IDR

Check the settings in RCC, GPIO and UART8 peripherals, inspect the registers.

Anything running in the M4 core that might interfere with what the M7 core is doing?

You're checking the right pins? The code is running and not crashing or faulting?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
wjian.2
wjian.2Author
Associate III
August 23, 2023

MB1248-D03

After HAL_GPIO_Init(GPIOJ, &GPIO_InitStruct); I think should not add  HAL_GPIO_WritePin(GPIOJ,GPIO_PIN_8,1) ?

In my debug gpioj run as

wjian2_0-1692810798081.png

In my register D0/D1 as(i dont know its same thing o no)

wjian2_1-1692810865495.png

which part of rcc should i check

wjian2_4-1692811588246.png

 

uart 8

wjian2_3-1692811476203.png

 

 

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
August 24, 2023

This is generating UART8 output on Pin D1 (PJ8), also blink LED1 to show it's alive and running. Should see roughly 4.8 KHz square wave

Use the .HEX, the .c file reflect's the project's primary main.c file

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
wjian.2
wjian.2Author
Associate III
August 24, 2023

Thanks a lot i have find my problem

Tesla DeLorean
Guru
August 25, 2023

What did the problem turn out to be? Might help others in similar situations

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..