uart
I'm trying to do uart stm23F7xx communication with a bldc controller, based on the blds controller protocol, I did communication but using an arduino and the labrarry #include <SoftwareSerial.h>,
I found it hard with stm32 the problem I have to send some data to start a communication using sendParameter()and to receive a frame in a table of size 10 (see image protocol in touche), the problem I only receive two values tab[0] and tab[1 ]the first correct value and the second value is incorrect: here is my code:
uint8_t rx_buff[10];
uint8_t tx_buff[]={0x66,0x02,0x00,0X68}; //MESSAG SENT TO BLDC CONTROLLER
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_USART1_UART_Init(void);
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
HAL_UART_Receive_IT(&huart1, rx_buff,sizeof(rx_buff)); //You need to toggle a breakpoint on this line!
}
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
HAL_UART_Receive_IT(&huart1, rx_buff, sizeof(rx_buff))
while (1)
{
HAL_UART_Transmit_IT(&huart1, tx_buff, 4);
HAL_Delay(1000);
}
/* USER CODE END 3 */
}
