cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to setup UART communication between Arduino nano and STEVAL-ESC002V1

shashank7
Associate

Hello everyone,
I’m trying to communicate between an Arduino Nano and the STEVAL-ESC002V1 board via UART, but I’m unable to get any proper response or control signal exchange. I’ve configured both devices at 115200 baud rate, but communication doesn’t seem to work.

 Any guidance or example code would be really helpful.

 

2 REPLIES 2
GMA
ST Employee

Hello @shashank7,

Did you review chapter 27. Universal synchronous/asynchronous receiver transmitter (USART/UART), of the STM32F0 Reference manual?

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA

Hey @GMA@Fabrice LOUBEYRE 
While doing UART communication between Arduino nano and STEVAL-ESC002V1  
When i start my UART communication the control goes to function,


void USART1_IRQHandler(void)
{
#ifdef UART_COMM
uint32_t isrflags = READ_REG(huart.Instance->ISR);
uint32_t cr1its = READ_REG(huart.Instance->CR1);
/* -----------UART in mode Receiver ---------------------------------------------------*/
if(((isrflags & USART_ISR_RXNE) != RESET) && ((cr1its & USART_CR1_RXNEIE) != RESET))
{
   if ((huart.gState!=HAL_UART_STATE_TIMEOUT)&&(huart.gState!=HAL_UART_STATE_ERROR))
    {
       huart.gState = HAL_UART_STATE_READY;
       huart.RxState &= ~HAL_UART_STATE_READY;
       huart.RxState |= HAL_UART_STATE_BUSY_RX;
      if (UART_Receive_IT(&huart)==HAL_OK)
       {
         UART_Set_Value();
       }
}
/* Clear RXNE interrupt flag */
__HAL_UART_SEND_REQ(&huart, UART_RXDATA_FLUSH_REQUEST);
}
/*------- UART in mode Transmitter (transmission end) -----------------------------*/
if(((isrflags & USART_ISR_TC) != RESET) && ((cr1its & USART_CR1_TCIE) != RESET))
{
UART_EndTransmit_IT(&huart);
return;
}
#endif
}
The control goes to "UART in mode Transmitter", but i think the control should go to "Uart in mode  Receiver", the first if statement in which the ISR & SART_ISR_RXNE is not getting true. 
Please guide what should i do, 
Please guide me with the solution's so that i can eliminate my problem,and move for further development.
Below down i'm also attaching the reference Arduino nano code

#include <SoftwareSerial.h>
SoftwareSerial STM(12,11); //Rx,Tx
void setup()
{
  // put your setup code here, to run once:
  Serial.begin(9600);
  STM.begin(9600);
  // Serial.print("Arduino code step-up....");
}

void loop()
{
  // put your main code here, to run repeatedly:
  STM.print("SETSPD,");
  STM.print(2000);

}