cancel
Showing results for 
Search instead for 
Did you mean: 

Probelm to send data to arduino from stmh747i-disco

wjian.2
Associate II

if i use

sprintf(msg, "%s %.0f%%", NN_OUTPUT_CLASS_LIST[App_Context_Ptr->ranking[i]], *((float*)(App_Context_Ptr->Ai_ContextPtr->nn_output_buffer)+i) * 100);

HAL_UART_Transmit(&huart8,(uint8_t*)msg,10,1000);

To transmit “Beer 50 %” to arduino But the arduino no receive why?

 

SoftwareSerial SUART(1011);
void setup() {
 
  DEBUG=true;           // habilitar debug serial
     
 
 
  SUART.begin(115200);
 
  espSerial.begin(9600);  // Habilita el software serial
                       
   if (DEBUG)  Serial.println("Setup completado");
}
void loop() {
    SUART.print("Received:");
  while(SUART.available()){
    SUART.write(SUART.read());
  }
  SUART.println();
  delay(1000);
}
GPIO Setting:
static void MX_GPIO_Init(void)
 
{
 
 GPIO_InitTypeDef GPIO_InitStruct;
 
 /* GPIO Ports Clock Enable */
 
 __HAL_RCC_GPIOJ_CLK_ENABLE();
 
 /*Configure GPIO pin: PJ8   For D1 pin for TX */
 
 GPIO_InitStruct.Pin = GPIO_PIN_8;
 
 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 
 //GPIO_InitStruct.Pull = GPIO_NOPULL; //pullup
 
 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
 
 GPIO_InitStruct.Alternate = GPIO_AF8_UART8;
 
 HAL_GPIO_Init(GPIOJ, &GPIO_InitStruct);
 
 /*Configure GPIO pin: PJ9   For D0 pin for RX */
 
 GPIO_InitStruct.Pin = GPIO_PIN_9;
 
 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; //MODE_ALTERNATE?
 
 //GPIO_InitStruct.Pull = GPIO_NOPULL; //or NOPULL?
 
 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
 
 GPIO_InitStruct.Alternate = GPIO_AF8_UART8;
 
 if(contadorgpio=0){
HAL_GPIO_Init(GPIOJ, &GPIO_InitStruct);
contadorgpio=contadorgpio+1;
  }
 
 
}
2 REPLIES 2
Peter BENSCH
ST Employee

You need to flush the USART pipe to get the string sent,,e.g. by using a CRLF.

Regards /Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.