Quantcast
Channel: Wireless Connectivity
Viewing all articles
Browse latest Browse all 116964

Forum Post: OSAL Questions

$
0
0

Situation:

The project is SimpleBLEPeripheral derivative, using 1.3 stack and  USB-dongle configuration on actual cc2540USB. I setup msg generator that supplies data at given rate. My app reads from UART 10 messages a second, each message is 12 bytes.  I parse these into c-structs and blink RED led as an indication that a message is processed. Everything works, but I observed some things that don't seem logical to me.

Question 1:

UART business is extremly fast (can easily parse 1000 msg per sec if need be), until I try to wrap up my data into OSAL_Message form:

              canappEvent_t* pMsg =  (canappEvent_t*) osal_msg_allocate(sizeof(canappEvent_t) + 3 + msgLen);

As soon as I invoke osal_msg_allocate strange things become noticable. It takes the system about 5-7 seconds to produce first blink (it takes some time to process first message). I guess there is some sort of lazy initialization of OSAL facilities, but the code is available and it doesn't seem like osal_msg_allocate is doing much. If the app could parse thousands messages in 1 sec without OSAL memory allocation part, it hardly keeps up with 100s and it sometime falls into an inconsistent state and hangs the device.  I noticed that LED business doesn't work in the debug mode at all. IAR Debuger can be subject of entirelly different discussion, I am often puzzled with its results. So I am trying to get an idea by using peripherals attached to the chip.  Can I trust blinks? Maybe blinking mechanism is somehow affected by osal_mem_alloc?

Question 2:

Relevant code snippet.

             canappEvent_t* pMsg =  (canappEvent_t*) osal_msg_allocate(sizeof(canappEvent_t) + 3 + msgLen);
             pMsg->hdr.event = msgType;
             osal_memcpy(pMsg->data,&msgID,2);
             pMsg->data[2] = msgLen;
             osal_memcpy(pMsg->data+3,msgPayload,msgLen); // Line in question
             HalLedSet( 0x02,  0x02);

Even though the logic seems to be perfectly functional in accordance to IAR Debugger, the line in question has a weird effect.If commented out it blinks RED led (as intended), if uncommented it blinks GREEN LED. 100% reproducable. How can it be? 

Question 3:

Is there some analog to coredump when software crashes on a chip?

Looking forward to any input on this,

-B

           

  





Viewing all articles
Browse latest Browse all 116964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>