cancel
Showing results for 
Search instead for 
Did you mean: 

b-g431b-esc1 HUART2 receive through micro-usb from RaspberryPi 4

babyface635
Associate

b-g431b-esc1 will be used to control the motor. The algorithm that dictates the speed will be ran on RaspberryPi 4. Since 3 'b-g431b-esc1' will be used, the easiest connection would be done with simple usb to micro-usb cable. 

These are the codes that have been used for communication. However, I am not able to confirm wether the correct information is being received by b-g431b-esc1.

CubeIDE code:

uint8_t rx_buff[10];

 

HAL_UART_Receive(&huart2, rx_buff, 10, 5000);

if (*rx_buff == 10){

         HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6, GPIO_PIN_SET);

}

 

Python code (a computer is being used for communication at this point):

from serial import Serial

ser = Serial("COM3", 115200)

while 1:

      ser.write(b'10)

 

"COM3" is correct, and baud rate is correct. Since using huart transmit function, all the sent information from b-g431b-esc1 is seen on Putty. 

 

All pins were checked and are chosen correctly.

 

Main question is: How to transmit an integer to the b-g431b-esc1 through the usb to micro-usb cable?

0 REPLIES 0