UART communication between Arduino nano and STEVAL-ESC002V1
Hey,
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 solutions 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);
}Edited to apply source code formatting - please see How to insert source code for future reference.
