2023-02-03 03:17 AM
I am using STM32F103C8 MCU and Trying to communicate with Quectel EC200U-CN 4G module and i am not getting data through UART2 Receive pin.
Please go through my code and suggest me
void USART2_IRQHandler(void){
if ((USART2->SR & USART_SR_RXNE) != RESET){
GSM_buf[GSM_indx] = USART2->DR;
GSM_indx++;
while(!(USART2->SR & USART_SR_TC));
}
if(GSM_indx >= (BUF_SIZE-1))
GSM_indx = 0;
}
Solved! Go to Solution.
2023-02-03 05:08 AM
No. You shouldn't wait for TC flag in the ISR. It has nothing to do with UART reception.
And this:
for(int i = 0;i<500000;i++);
may be optimized to nothing, so no delay will be provided.
2023-02-03 03:56 AM
>> go through my code
Thats the equivalent to going to your baker and demanding free bread.
did you checked uart pins TX and RX are properly swapped with your quectel module?
2023-02-03 04:03 AM
All connections are fine, please check below function. will it works?
Thanks for reply Javier.
2023-02-03 05:08 AM
No. You shouldn't wait for TC flag in the ISR. It has nothing to do with UART reception.
And this:
for(int i = 0;i<500000;i++);
may be optimized to nothing, so no delay will be provided.
2023-02-05 11:49 PM
Thank you gbm
2023-09-29 01:06 AM
Could you send me the overall code for sending and receiving the msg from EC200U-cn I have tried with At commands sending through the UART,which one is the crt way?