Skip to main content
Associate
February 12, 2024
Solved

Baud rate 230400

  • February 12, 2024
  • 5 replies
  • 3852 views

Hola, presento este error al visualizarr los bytes de salida por putty ▒``x▒▒▒▒▒▒▒`▒▒ ciclicamete, ya que es para un lidar ld06, connfiguro uart 2 velocidad de baudios 230400

la configuracion es 

void SystemClock_Config(void)

{

RCC_OscInitTypeDef RCC_OscInitStruct = {0};

RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

/** Configure the main internal regulator output voltage

__HAL_RCC_PWR_CLK_ENABLE();

__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

* in the RCC_OscInitTypeDef structure.

*/

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSERCC_OscInitStruct.HSEState = RCC_HSE_BYPASSRCC_OscInitStruct.PLL.PLLState = RCC_PLL_ONRCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSERCC_OscInitStruct.PLL.PLLM = 4RCC_OscInitStruct.PLL.PLLN = 72RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV6RCC_OscInitStruct.PLL.PLLQ = 3RCC_OscInitStruct.PLL.PLLR = 2;

if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

{

Error_Handler();

}

/** Initializes the CPU, AHB and APB buses clocks

*/

RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLKRCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV16;

Best answer by Tesla DeLorean

To get readable hex from the STM32 you'd need to be outputting 3x as fast. So sprintf(str, "%02X ", byte) can off load the data.

Alternatively, use RealTerm and have it output in hex mode, and it will show you the patterns.

There should be a specific sync byte(s), or header for each scan. The number of scans in Hz will depend on the spin speed of the Lidar.

5 replies

Peter BENSCH
Technical Moderator
February 12, 2024

Welcome @kzamudioq, to the community!

I've translated your question with a web-based translation tool to increase the chances that you will get an answer from our experts and community members, as the majority communicate in English:

Hello, I get this error when displaying the output bytes by putty ▒```x▒▒▒▒▒▒▒`▒▒▒ cyclical, as it is for a lidar ld06, I set uart 2 baud rate 230400

the configuration is [...]

I would like to take this opportunity to point out that it is possible to insert formatted code more legibly by clicking </> beforehand.

Otherwise you have only posted the clock configuration, but neither the settings of UART2 nor the UART code used.

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
kzamudioqAuthor
Associate
February 12, 2024

191b5ffe-81b0-4d7a-b6c1-923003f30579.jpeg

5fd34e2a-b0ad-4aba-a54a-c11802ea4114.jpeg

45b3b8ab-abd4-4e00-a757-70827ac7e4a6.jpeg

91be5f1b-7d3e-436c-810f-5f4014b78605.jpeg

Hello, I am attaching the relevant configuration. On the other hand, I thought that maybe the error could be in the configuration of the watch, that's why I had attached it

Andrew Neil
Super User
February 12, 2024

Use this button to properly post source code:

AndrewNeil_0-1707764619877.png

 

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Guru
February 12, 2024

Does the Lidar output in binary? That's not going to be human readable unless you process it, into say angles / distance. Dump the records you are receiving into Hex, or something you can correlate with the MANUAL.

If the baud rate is wrong, check HSE_VALUE, and the clocking of the MCU

Check output rate of STM32 with a scope, sending U / 0x55 patterns.

Check the output rate of the Lidar with a scope, check bit timings, sync patterns, etc.

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

I thank you, I don't know much about the subject as you can see, so it had occurred to me to be able to see the bytes that is receiving the plate through the uart. Is the idea crazy?

Tesla DeLorean
Guru
February 12, 2024

To get readable hex from the STM32 you'd need to be outputting 3x as fast. So sprintf(str, "%02X ", byte) can off load the data.

Alternatively, use RealTerm and have it output in hex mode, and it will show you the patterns.

There should be a specific sync byte(s), or header for each scan. The number of scans in Hz will depend on the spin speed of the Lidar.

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

 

I'm looking for guidance on connecting an STM32 M4 with a LiDAR LD19. Do you provide services in this area?

Pavel A.
Super User
February 23, 2024

@kzamudioq Please check your forum mailbox, somebody could send you a message.

PavelA_0-1708650241256.png