I am trying to use SIM900A With STM32F1 USING UART FOR SENDING MESSAGE.I CAN SEE MY TRANSMITTING DATA THROUGH PUTTY BUT IN RECEIVE BUFFER I CANT GET ANY VALUE SOMETIMES MY TRANSMITTING DATA I CAN SEE IN MY RX.WHAT SHOULD WE DO FOR SENDING MESSAGE CAN ANYONE HELP.I ALREADY CHECKED WITH USB TTL ALL COMMANDS RUNNING OK BUT FOR SENDING MESSAGE IT SHOWS ME ERROR SOMETIMES .SOMETIMES IT GOES TO MESSAGE MODE BUT MESSAGE IS NOT SENDING BUT IN STM32 I CANT GET OK RESPONSE ATLEAST FROM GSM MODULE AFTER AT COMMQAND.
THANKS IN ADVANCE
PLEASE DON'T WRITE IN ALL CAPS IT'S HARD TO READ!
Have you first confirmed that you can communicate with the SIM900 manually using a PC and terminal app?
And confirmed that the commands you are sending are correct, and that your module gives the responses you expect?
And have you confirmed that your code works when connected to a PC and terminal app - with you manually emulating the SIM900?
In particular, pay attention to things like command terminators, and response separators: https://www.avrfreaks.net/comment/2212161#comment-2212161 - check the SIM900 AT Commands documentation carefully.
See also: https://www.avrfreaks.net/comment/2212166#comment-2212166 - and, in fact, the rest of that thread. And the links to examples.
Probably the commonest mistake people make with AT Commands is not waiting for the complete response to one command before sending the next.
See, for example: https://www.avrfreaks.net/comment/2209136#comment-2209136
See also: https://www.avrfreaks.net/comment/2336161#comment-2336161 - for some hints on debugging serial comms.
As you can see, none of this has anything specifically to do with Keil - or even STM32!
Yeah I have tried that on serial port it worked fine.I am sending data using uart tx sand rx fn in controller.I am giving delay after each AT command also.and receive through uart at the same time.i can watch in serial port that my data is transmitting but in rxbuf i am getting nothing
ANKUSH said:I am giving delay after each AT command also
No! Don't do that - that's just "blind" delays - see the link in my previous post!
Can you tell me how to do that .I am giving Controller tx to GSM Rx and vise versa should we need USb TTL also for that
AT Commands are just about sending & receiving serial data - so start by getting that working.
The easiest way to do that is with your microcontroller connected to a terminal app on the PC.
Yes, you will need a USB-to-TTL converter (or similar) to connect the microcontroller to the PC.
Most development boards these days - including ST Nucleo - have this built in, so I would strongly suggest that you start on one of those. They also give you a debugger.
thanks for replying.yes i have checked the controller uart receive and transmit in my serial port using usb ttl.its working fine for both tx and rx.
But when i am connecting UART receive from another module i am not getting anything.
ANKUSH said:when i am connecting UART receive from another module i am not getting anything
So you need to debug what's going on, then!
See the "hints on debugging serial comms" link given above.
Have you used a logic analyser or oscilloscope to see what's actually happening on the wires ?
No I don't have oscilloscope or analyser
then how did you intend to test & debug this?
But, anyhow, the "hints on debugging serial comms" link given above doesn't rely on a scope or analyser...