SMAC Data Receive

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SMAC Data Receive

1,615 Views
squeech
Contributor I
Hi all -

Is it necessary, when running an SMAC application on the HCS08, to always block the processor after an MLMERXEnableRequest? I noticed in the demo apps that after a receive request is made, the next instruction is almost always a call to wait().

As I was modifying some of the applications, I decided to remove that call (so I could allow the CPU to do some background processing while waiting for SMAC data to come in) and it seemed like I couldn't get the application to listen for the receives!

I know that a wait() will do nothing until the next interruptable event, but shouldn't the MC1319X received data interrupt call MCPSDataIndication function even if the processor is active and crunching? Is there a smarter way to implement background processing while the MC1319X receiver is on?

Thanks!
Dave
Labels (1)
0 Kudos
2 Replies

324 Views
stevasway
Contributor III
Hi Dave,

Is not necessary to block the processor after an MLMERXEnableRequest, when you do this you have to change the state of your state machine (usually you are in a endless loop).

Don't call MLMERXEnableRequest again!

for(;:smileywink:
{
switch (gi8AppStatus)
{
case IDLE_STATE:
gi8AppStatus= RECEIVER_ALWAYS_ON;
break;
case RECEIVER_ALWAYS_ON:
MLMERXEnableRequest(&gsRxPacket, timeout);
//LOW_POWER_WHILE();
gi8AppStatus= WAIT_RX_DATA;
break;

case WAIT_RX_DATA://Do nothing or background process
break;

case DO_SOMETHING:
break;
}

void MCPSDataIndication(tRxPacket *gsRxPacket)
{
if (gsRxPacket->u8Status == SUCCESS)
{
gi8AppStatus = DO_SOMETHING;
}
}
0 Kudos

324 Views
squeech
Contributor I
Aha!

That makes perfect sense, and it definitely worked like a charm!

If you don't mind my asking, why do multiple calls to MLMERxEnableRequest cause failure like that? I guess I don't fully understand how the MAC is working in that regard. Is it creating a buffer of requests that I'm overflowing? Is each call overwriting the last request? I'm curious, because it seemed to me that an enable request to an already enabled receiver would be ignored.

Thanks!! :smileyhappy:
0 Kudos