2023-01-30 10:33 AM
Hi, I'm trying to control a BLDC motor via a B-G431B-ESC1 and an Arduino Mega. The Mega will be the master and send commands to the board. For ease of use, I'd like if it these were strings. I have found examples of how to use UART in an STM32 application, except here the DMA UART initialization is done by ST MotorControl and ST MX, so I don't know if there are implications. The initialization has all of the below in it, so it seems DMA is disabled.
MX_USART2_UART_Init();
...
sConfig.DAC_DMADoubleDataMode = DISABLE;
...
hadc1.Init.DMAContinuousRequests = DISABLE;
...
hadc2.Init.DMAContinuousRequests = DISABLE;
Furthermore, I don't see an interrupt being declared anywhere for UART, there's just this:
/* Initialize interrupts */
MX_NVIC_Init();
/* USER CODE BEGIN 2 */
Very frustrating. Would greatly appreciate some help, I feel like this is something that is done in 10 lines of code.
Thank you in advance, kind soul.
2023-01-30 04:28 PM
If the strings are variable length then you're better off with UART DMA with idle bit using HAL_UARTEx_ReceiveToIdle_DMA and HAL_UARTEx_RxEventCallback
2023-01-31 04:19 AM
In a generic application, I'm sure this would work, but I'm dubious about writing over code generated by ST MotorControl. I guess I won't know if I don't try.