Hello!
I learning the basics of MQX system on KWIKSTIK K40. Now I trying to communicate with ESP8266 wifi module over UART5 in interrupt mode.
My program send AT commands to the module, then I waiting for response in form of interrupt, finally I print it to the console.
This is going well on BAUD RATE 9600.
Here is the response:
AT+CIOBAUD=9600
OK
AT+GMR
0018000902-AI03
OK
But when I change BAUD RATE to 115200 I lost some of characters:
AAUD=115200
OK
<a whole of line is missing
0018000902-AI03
OK
Or at BAUD RATE 921600:
AT
OK
A
0018000902-AI03
OK
This function is called by the interrupt:
void uart5_isr(pointer user_isr_ptr) { MY_ISR_STRUCT_PTR isr_ptr = (MY_ISR_STRUCT_PTR)user_isr_ptr; isr_ptr->TICK_COUNT++; UART_MemMapPtr sci_ptr = _bsp_get_serial_base_address (5); if((sci_ptr->S1 & UART_S1_RDRF_MASK) == UART_S1_RDRF_MASK) { received_char = sci_ptr->D; strcat(received_string,&received_char); } (*isr_ptr->OLD_ISR)(isr_ptr->OLD_ISR_DATA); }
My first question is: why the characters are missing and how to prevent it?
The second: Is this a correct form of handling an interrupt or can It do better?
Iam just learning of MQX... I attach the source code.
Thank You!
Original Attachment has been moved to: main.c.txt.zip
Hi, Norbert!
Do you get the desired result with ESP8266?
I try to do the same as you, with ESP8266 and FRDM-K64.
Can You send me final source code for communication with ESP?
Regards, Oleg
Hi Oleg,
Update the ESP8266 firmware verstion to the latest (1.4) I did and the communication is more stable.
Regards,
Garabo
Hello, no I think there is a problem in ESP8266 firmware, when I switch to another FW this solved my problem.
Try ESP8266 on arduino it is much more better than AT+ commands.
Hi Norbert,
I strongly suggest to follow the same way the appnote AN4022 is reading and changing UART to read from an external device. The link to the appnote is this:
http://cache.freescale.com/files/32bit/doc/app_note/AN4022.pdf
The link to the source code is here:
http://cache.freescale.com/files/32bit/doc/app_note/AN4022SW.zip
This should resolve your issue.
Have a great day,
Garabo
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------