AnsweredAssumed Answered

Kernel Panic while creating the 12th message in VDK

Question asked by nigong on Oct 2, 2012
Latest reply on Oct 4, 2012 by CraigG

Hi all,

 

I am experiencing wired Kernel Panic while I am creating the 12th message in VDK

 

I have 3 threads: InitThread, NormalThread and UARTThread. The InitThread is the boot thread and it creates NormalThread and UARTThread and then dies. NormalThread keeps creating messages and send them to UARTThread by a time interval (100 ticks). UARTThread receives messages and prints them through UART port (interrupt driven) and then deletes the message it has printed.

 

It works totally fine for the first 11 messages. But by the time the NormalThread creates its 12th message, kernel panics. I have tried increasing the buffer size, sleep time. Doesn't help.

 

I am using BF533.

 

Code for UARTThread:

while (1)
    {
        // Pending. If no msg, release 
        VDK::PendSemaphore(kUART_Receive, 0);
        
        VDK::MessageID MID = VDK::PendMessage(VDK::kMsgChannel1, 0);
        
        if (MID == NULL)
                              UART_INT_printf("Message is void.\n\r");
                    else
                    {
                              VDK::GetMessagePayload(
                                                  MID,                                        /* inMessageID */
                                                  &PayloadType,                    /* outPayloadType */
                                                  &outPayloadSize,          /* outPayloadSize */
                                                  &outPayloadAddr                    /* outPayloadAddr */
                              );
  
                              UART_INT_printf((char*)outPayloadAddr);
  
                              VDK::FreeMessagePayload(MID);
                    }
    }

 

Code for the NormalThread:

while (1)
    {
        VDK::Sleep(sleepTime);
          
              VDK::MessageID MID = VDK::CreateMessage (
                                                                                    1,                                        /* inPaylodType */
                                                                                    strlen(msg),          /* inPaylodSize */
                                                                                    msg                                        /* *inPaylodAddr */
              );
    
              VDK::PostMessage(
                                  UARTThreadTID,                                                  /* inRecipient */
                                  MID,                                                                      /* inMessageID */
                                  VDK::kMsgChannel1                                        /* inChannel   */
              );
              
              // wakes up UART to receive the message
              VDK::PostSemaphore(kUART_Receive);
    }

 

Any thoughts?

Outcomes