Showing results for 
Search instead for 
Did you mean: 

Controlling B-G431-ESC1 brushless motor controller via a master microcontroller (ATmega2560) over UART. Can't find resources.

Associate III

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.

  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 */

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.

Karl Yamashita
Lead II

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

If you find my answers useful, click the accept button so that way others can see the solution.
Associate III

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.