Hi Milan
Thanks for your interesst. The reason why I still haven’t posted any code, is because I couldn’t get the effect again. However I didn’t test enought as well. This time, I will post some code just to give some more comments about it (I find it tyring to watch at pages of code posted in this forum, however there it is).
#include "adl_global.h"
const u16 wm_apmCustomStackSize = 1024;
#define TRACE_TERMINAL(STRING) adl_atSendResponse( ADL_AT_PORT_TYPE(ADL_PORT_UART1,ADL_AT_RSP), (char*)STRING)
#define false 0
void playSound();
void switchToW32K();
bool onSwitchToW32KDone(adl_atResponse_t* i_pArgs);
void closeUart1();
bool onCloseUart1Done(adl_atResponse_t* i_pArgs);
void adl_main ( adl_InitType_e i_eInitType )
{
switch(i_eInitType)
{
case ADL_INIT_POWER_ON:
TRACE_TERMINAL("ADL_INIT_POWER_ON");
break;
case ADL_INIT_DOWNLOAD_SUCCESS:
TRACE_TERMINAL("ADL_INIT_DOWNLOAD_SUCCESS");
break;
case ADL_INIT_DOWNLOAD_ERROR:
TRACE_TERMINAL("ADL_INIT_DOWNLOAD_ERROR");
break;
case ADL_INIT_REBOOT_FROM_EXCEPTION:
TRACE_TERMINAL("ADL_INIT_REBOOT_FROM_EXCEPTION");
break;
default:
TRACE_TERMINAL("default");
}
playSound();
switchToW32K();
}
void playSound()
{
u16 pMelody[] = {
WM_SND_C0 | WM_SND_QUAVER,
0
};
wm_sndMelodyPlay(WM_SND_DEST_BUZZER, pMelody, 2, 1, 13);
}
void switchToW32K()
{
u8 nRspflag = ADL_AT_PORT_TYPE(ADL_PORT_NONE, FALSE);
u8 nReturnValue = adl_atCmdCreate("at+w32k=1", nRspflag, onSwitchToW32KDone, "*", NULL);
if(nReturnValue != OK)
{
TRACE_TERMINAL("at+w32k=1: CmdCreate failed");
}
}
bool onSwitchToW32KDone(adl_atResponse_t* i_pArgs)
{
TRACE_TERMINAL(i_pArgs->StrData);
//closeUart1();
return false;
}
void closeUart1()
{
u8 nRspflag = ADL_AT_PORT_TYPE(ADL_PORT_NONE, FALSE);
u8 nReturnValue = adl_atCmdCreate("at+wmfm=0,0,1", nRspflag, onCloseUart1Done, "*", NULL);
if(nReturnValue != OK)
{
TRACE_TERMINAL("at+wmfm=0,0,1: CmdCreate failed");
}
}
bool onCloseUart1Done(adl_atResponse_t* i_pArgs)
{
TRACE_TERMINAL(i_pArgs->StrData);
return false;
}
As you can see, the parts of the code to close Uart1 is not used (I commented closeUart1).
That’s what I have in mind as well for being responsible for the reboots. However, I already tried your suggestion to post a lot to Uart1 and not to use it at all. There was no difference.
Now some Explanations:
To make sure, I have a fresh platform, I also reinstall the OS before running the tests, later more about that (I’m still working with OS 660 because OS 661 has a bug with buzzer output, I allready posted it in the forum)
After a reinstallation of OS 660 and the at+wopen=1, if I install the above software as it is, the current consumption is not getting low.
Then I put in the closeUart1 line and install just the application. The current gets low immediately, and I can expect a reboot somewhen (20sec - 20minutes or longer until reboot).
The next step is to reinstall the first software again. Now, after 10-15sec, the current dropps. Communication is off with terminal. No reboot.
When I tested my real larger application (I do not close the Uart1 anymore to avoid reboots) the current didnt dropp, as described above.
So I installed the above software above whith closing Uart1, run it and overwrote it again with my large application.
That’s how I get my large application work with dropping the current and stable. The supprise however is, that I have a working Uart1 communication with the terminal software as well!
Well, obviously I do much more in my application than just the posted software, however I haven’t found out the reason for this behaviour.
Nor do I understand why I can’t open and close Uart1 in the running application without the risk of a reboot.
My next step will be to create a Flag in the FlashROM and close Uart1 if no marker is set (at the first run of the software) then set the flag, cause a reboot and never use at+wmfm again. However, this has yet to be tested…