2024-02-11 07:42 PM - last edited on 2024-02-12 12:22 AM by Peter BENSCH
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_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 4; RCC_OscInitStruct.PLL.PLLN = 72; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV6; RCC_OscInitStruct.PLL.PLLQ = 3; RCC_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_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV16;
Solved! Go to Solution.
2024-02-12 12:14 PM
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.
2024-02-12 10:29 AM
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
2024-02-12 11:03 AM
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
2024-02-12 11:03 AM
Use this button to properly post source code:
2024-02-12 11:03 AM
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.
2024-02-12 12:08 PM
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?
2024-02-12 12:14 PM
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.
2024-02-22 04:01 PM
I'm looking for guidance on connecting an STM32 M4 with a LiDAR LD19. Do you provide services in this area?
2024-02-22 05:04 PM