Hello, I have started working on ac30m1x64 micro-controller. I have successfully interfaced GSM/GPRS module serially(I2C) and getting acknowledgements for all the AT Commands. I have migrated the same code on CMSIS-RTX(RTOS),but, I cannot see any acknowledgements from the GSM/GPRS(slave) module. I have used RTOS TIMER, osDELAY()function and many more for trial and error. Though failed to get reply from the slave. I cannot even see the "AT= OK" from the slave, I am completely stuck. Please can anyone help me through this?
Thanks,
Well, that makes more sense.
But, still, what testing / debugging / investigation have you done?
The basic approach to debugging remains the same:
* Are you sure that the command is being correctly sent from your microcontroller?
* Are you sure that the response is being sent from your GSM module?
Nobody else has your hardware or your software, so nobody else can do this for you - this is basic stuff that you need to do yourself.
See: www.avrfreaks.net/.../2418156 - about debugging in general, and a lot about debugging serial comms in particular.
OK, let me explain in more detail. I have developed a software for GSM/GPRS using state machine to control the functioning of the module in the way I need. So, first three states are for powering on the module and next follows the GSM AT Commands.
"Are you sure that the command is being correctly sent from your microcontroller?"
Yes, I think so. Because, as I mentioned before that first three states are for powering up the module and then fourth.. fifth.. and so on follows the GSM AT Commands. Module is accepting first three states and getting powered up successfully. Then comes fourth state which is "AT" command, where i need a response as "OK" from the module. As I was not getting "OK" response from the module, I tried to implement delay function, TIMER3, RTOS Timer, Interrupt function and SVC function keeping in mind that RTOS is time constraint. Unluckily, can't make it work. Also tried to do the silly thing, giving delay between the UART send and UART receive function, so that quectel need some millisec to respond to the command. I stuck badly with this module. Reminding you that, this problem I am facing when I migrated the working software on RTOS platform. Individually it's working as expected. I am new to RTOS. Can't find a way to overcome this issue.
Thanks for your co-operation.
Q: "Are you sure that the command is being correctly sent from your microcontroller?"
A: "Yes, I think so"
So that's actually a NO - you are not sure.
You need to be completely sure.
You need to prove that all the commands are actually reaching the module in the correct order, uncorrupted.
You also need to prove that all the expected responses - and no unexpected ones - are actually coming from the module, in the correct order, and reaching the microcontroller uncorrupted.
The thread I linked shows a method by which you could do that.
You need to understand what is actually happening in order to diagnose why it is happening - and, thence, to fix it.
"I am new to RTOS."
The RTOS is a red herring here. The GSM module neither knows nor cares whether you use an RTOS or not - all it sees are the commands arriving.
I have copied a part of the program which I am sending to the module. ///////////////////////////////////////////////////////////////////////////////////////// case GSM_STATE_POWERON_WAIT_00: g_stGSMWaitTimer = TMR_SetDelayVal(GSM_POWERON_WAIT0_MSEC); GSMState = GSM_STATE_POWERON_WAIT_1; #if defined(ENABLE_GSM_NOTIFICATION) StSetText(StNoRange, "GSM_STATE_POWERON_WAIT_00"); StDraw(StNoRange); #endif break;
case GSM_STATE_POWERON_WAIT_1: if(TMR_IsTimerExpired(g_stGSMWaitTimer))//wait for 1000ms { M66_PWRKEY_OFF; g_stGSMWaitTimer = TMR_SetDelayVal(GSM_POWERON_WAIT2_MSEC); GSMState = GSM_STATE_POWERON_WAIT_2; #if defined(ENABLE_GSM_NOTIFICATION) StSetText(StNoRange, "GSM_STATE_POWERON_WAIT_1"); StDraw(StNoRange); #endif } break;
case GSM_STATE_POWERON_WAIT_2: if(TMR_IsTimerExpired(g_stGSMWaitTimer))//wait for 1500ms in reset state { M66_PWRKEY_ON; g_stGSMWaitTimer = TMR_SetDelayVal(GSM_POWERON_WAIT3_MSEC); //3000 GSMState = GSM_STATE_SET_AUTOBAUD; #if defined(ENABLE_GSM_NOTIFICATION) StSetText(StNoRange, "GSM_STATE_POWERON_WAIT_2"); StDraw(StNoRange); #endif } break;
case GSM_STATE_SET_AUTOBAUD: UARTSend(U0,(uint8_t *)ATCMD_AUTOBAUD, sizeof(ATCMD_AUTOBAUD)); while (len == 0) { len = UARTReceive((UART_Type *)U0, &Master_Buf_UART0[0], sizeof(Master_Buf_UART0)); } #if defined(ENABLE_GSM_NOTIFICATION) StSetText(StNoRange, "I am in GSM_STATE_SET_AUTOBAUD"); StDraw(StNoRange); #endif if(CmpareStrOnly(Master_Buf_UART0,AT_RESPONSE_ATOK,3) == 1) {
GPIO_SetValue(PD,_BIT(0)); GSMState = GSM_STATE_SET_FIXBAUD; } else GSMState = GSM_STATE_SET_AUTOBAUD; break; /////////////////////////////////////////////////////////////////////////////////////////
First three cases that are GSM_STATE_POWERON_WAIT_00:, GSM_STATE_POWERON_WAIT_1:, GSM_STATE_POWERON_WAIT_2: which are working perfect and helping the module to Power ON. Then, you can see the "case GSM_STATE_SET_AUTOBAUD:", this program I cannot make it work when I migrated program to RTOS platform, but it works perfect without RTOS.
I am using the Keil-RTX(CMSIS-RTOS).
You're not listening, are you?
Please read my previous post again.
There is no point in looking at the code before you have demonstrated what is actually going on between the module & your microcontroller.
And, before posting source code, pay attention to the instructions for posting source code! Look at the picture: www.danlhenry.com/.../keil_code.png - is it not clear?
So Sorry... I will be aware from now. Thanks.