cancel
Showing results for 
Search instead for 
Did you mean: 

Error while sending data on UART continuously

SARTHAK KELAPURE
Associate II
Posted on December 19, 2017 at 06:43

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-uart
This discussion is locked. Please start a new topic to ask your question.
5 REPLIES 5
Doug Kehn
Senior
Posted on December 19, 2017 at 14:26

What is the return value from HAL_UART_Transmit()?

Try setting a breakpoint when the error occurs to inspect registers, etc.

Posted on December 19, 2017 at 18:21

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 ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Posted on December 19, 2017 at 18:27

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!

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Posted on December 19, 2017 at 18:39

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

any

 

AT Command interface!

 You should

never

 

send another AT command before you have had the

full

 

response from the previous one!
A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Posted on December 20, 2017 at 08:57

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...