2017-12-18 09:43 PM
I am interfacing ESP8266 with my Murata LoRa board(though not using LoRa), so let us just say I am using STM32L072CZ with ESP8266 connected on UART1(Pin9,10). I am seeing a strange behavior from STM UART.
The code being used is as below,
//HEADERS
char cmd[]='AT+CWLAP\r\n';
...
int main()
{
//INIT
...
while(1)
{
HAL_UART_Transmit(&huart1,(uint8_t*)cmd,strlen(cmd),0xFFFF);
}
This works well for the first few iterations and then fails as seen in attachment. Please help and pin point the problem and solution.
#stm32l072 #stm32 #stm32l0-uart2017-12-19 05:26 AM
What is the return value from HAL_UART_Transmit()?
Try setting a breakpoint when the error occurs to inspect registers, etc.
2017-12-19 09:21 AM
char cmd[]='AT+CWLAP\r\n';
Note that you don't need the \n here.
It should be benign, but better to get rid of it and remove all doubt ...
2017-12-19 09:27 AM
Please make use of the Syntax Highlighter to properly present source code:
while(1)
{
HAL_UART_Transmit( &huart1, (uint8_t*)cmd, strlen(cmd), 0xFFFF );
}
�?�?�?�?�?�?�?�?�?
That is a great way to crash any AT Command interface!
You should never send another AT command before you have had the full response from the previous one!
2017-12-19 10:39 AM
I made the foolish mistake of using the Syntax Highlighter - so that post is now stuck in Moderation.
:(
Sending out commands in a tight 'while' loop is a sure way to crash
anyAT Command interface!
You should
neversend another AT command before you have had thefull
response from the previous one!
2017-12-20 12:57 AM
Sending out commands in a tight 'while' loop is a sure way to crash
any
AT Command interface!
Nevertheless, a great idea for testing, should you ever write an AT command interface... ;)
Jan
PS. Just yesterday 've been bitten by the 'overflow when not cleared triggers Rx interrupt infinitely' gotcha of the STM32 USART...