This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F: Queue Message gets erase or corrupted?

Part Number: CC2640R2F


Hi,

     I am queuing this string "22222222222" at TestApp__QueueWriteTagID(). After Processing the App Message at main Task, the "222222222222" gets erased or corrupted.

static void TestApp__QueueWriteTagID(BYTE* msg) 
{ 
    uint8_t *pData;
      // Allocate space for the event data.
    if ((pData = ICall_malloc(sizeof(uint8_t))))
    {
        pData = msg;
        XXBLEPeripheral__EnqueueMsg(SBP_WRITE_TAG_EVT, NULL,  pData);
    }    
    
    return;
}

The message is queued at XBLEPeripheral__EnqueueMsg(). As you can see the "222222222222" is stored at pData.

At XBLEPeripheral__ProcessAppMsg() the "222222222222" gets erased or corrupted.

Why does "222222222222" gets erased? 

- kel

  • I already made it to work. I allocate just enough memory for the message and then use MEMCPY to transfer msg contents to pData.

    static void TestApp__QueueWriteTagID(BYTE* msg) 
    { 
        uint8_t *pData;
        if (STRLEN(msg) <= XX_TAG_ID_LEN)
        {  
          // Allocate space for the event data.
          if ((pData = ICall_malloc(XX_TAG_ID_LEN + 1)))
          {
              MEMCPY(pData, msg, STRLEN(msg)); 
              XXBLEPeripheral__EnqueueMsg(SBP_WRITE_TAG_EVT, NULL,  pData);
          }
        }
        else
        {
          UartApp__WriteString("INV TAGID LEN\r\n");       
        }  
        
        return;
    }
    

    - kel

  • Ok, good. I was starting to think it was another double pointer issue :)

    Best wishes