I am trying to get SIM800l to send text messages and make calls with STM32F103. Problem is, I only receive echoes of my commands, if I send "AT" using uart, I get A, T as an echo. But not OK, as it should respond. My power supply is good and I am pretty sure my UART code is good too.
Does anybody had the same issue? Thank you!
void uart_init2(){
UART1_Init_Advanced(115200, _UART_8_BIT_DATA, _UART_NOPARITY, _UART_ONE_STOPBIT, &_GPIO_MODULE_USART1_PA9_10);
USART1_CR1.B5 = 1;
NVIC_IntEnable(IVT_INT_USART1);
}
char UART1_Read2(){
while (!(USART1_SR & USART1_SR.B5)); // Wait until RXNE (RX not empty) bit is set
// USART resets the RXNE flag automatically after reading DR
return ((char)USART1_DR); // & 0xFF));
}
void InterruptModule_1() iv IVT_INT_USART1 ics ICS_AUTO {
receive = UART1_Read();
buffer[buffernum++]=receive;
}
And in main:
buffernum=0;
UART1_Write_Text("ATE0");
UART1_Write_Text("AT");
delay_ms(1000);
delay_ms(1000);
//UART1_Write_Text("AT+IPR=9600");
buffernum=0;
UART1_Write_Text("ATDXXXXXX;");
delay_ms(1000);
delay_ms(1000);
I have found the solution. Not sure why, but everything works as expected when I add \r with the command. Example:
Hope this helps somebody, I did not find anything similar online.