use stm32 with odrive

hi I wanted to use or drive with stm32 hal library:
serial_ << “p” << motor_number << “” << position << “” << velocity_feedforward << “” << current_feedforward << “\ n”;
char tx = “p”;
char tx1 = “”;
int position = 200
HAL_UART_Transmit (& s_UARTHandle, tx, 1, 100);
HAL_UART_Transmit (& s_UARTHandle, m0, 1, 100);
HAL_UART_Transmit (& s_UARTHandle, tx1, 1, 100);
thank you

Hi Simone,

The HAL libraries just help you interface with the low level peripherals.

What are you trying to achieve?

If you know the pattern of data you need to send beforehand just not the values, you could always use snprintf in a function and pass in the values during run time so you’d have something like the code below (note: this has not been tested and is only here as an example):

void sendData (s_UARTHandle, float motor_number, float pos_setpoint, float vel_feed_forward, float current_feed_forward)
char txData[100]; // data to send

// populates txData with variables handed in as args
snprintf(txData, 100, 
"p %u %f %f %f", // formatted string
motor_number, pos_setpoint, vel_feed_forward, current_feed_forward);

// only need to call this once for the whole string
HAL_UART_Transmit (& s_UARTHandle, txData, strlen(txData), 100);