Skip to main content
Explorer II
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;

    This topic has been closed for replies.
    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

    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

    kzamudioqAuthor
    Explorer II
    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

    Super User
    February 12, 2024

    Use this button to properly post source code:

    AndrewNeil_0-1707764619877.png

     

     

    Graduate II
    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.

    kzamudioqAuthor
    Explorer II
    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?

    Graduate II
    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.

    kzamudioqAuthor
    Explorer II
    February 23, 2024

     

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

    Super User
    February 23, 2024

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

    PavelA_0-1708650241256.png