cancel
Showing results for 
Search instead for 
Did you mean: 

Problem about creating a state machine for be able to use ESP8266 AT COMMAND

G_A.
Associate II

Hello,

I have struggled to use AT COMMANDs for communication between ESP8266 and STM32F4.

I should use ESP8266 as non blocking mode .Because my main project is FIRMWARE OVER THE AIR.

1)STM32 GETs the datas of new code via ESP8266 using 'AT COMMANDS'.

2)STM writes all data on the another sector.

3)Jumps to this sector and new code start to work.

4)Btw, when new code is working ,there is a control if there is new firmware or not. If there is new firmware, it should turn back to bootloader.(I can use Nvic software reset to turn back to bootloader.

The main problem is How I can understand if there is a new firmware in server . I thought that I can add 'a code part which always connects server and asks for new data to server with AT COMMAND' inside also user code . But to be able to make this I should write a state machine which is consisting of some AT+COMMAND and works always in nonblocking mode.)

But I can only use ESP8266 with the attached code below(file hata).

----->UART RX dma

----->UART TX interrupt

I can send all command with TX int in main.c and receive all data with rx dma in again main.c.

I can use this code inside bootloader to first acception of new code. But I can not add this code inside USER CODE to check for new firmware version. Because it can be block user code.

I tried to use USART_IRQHANDLER and HAL_UART_RxCpltCallback with tx rx uart interrupt.

But after sending first at comment and receiving first response, it did'nt work properly.

I feel really confused. 3 weeks has passed with sending and receiveng AT command for communication between STM and ESP. But still can not find how ı can send all AT command step by step(also it should control the response of all command in every step, And I guess, all of this should be in nonblocking mode. )

If you have any idea, please share with me. Thanks in advance.

10 REPLIES 10
G_A.
Associate II

2) When I get the OK response ( I check this with strstr) , I should break and pass another case to send second command. Therefore I changed the loop.