This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can i pass a structure to another thread through mailbox in zephyr

Hi,

Im using nrf9160 based custom board, nrf sdk 1.5.1

I have below structure to frame the data packet and i need to send this packet to another thread through MailBox. i have tested mail box with char array buffers and its working fine but not in the case of these packets(structure).

typedef enum
{
    MSG_UNKOWN_COMM,
    MSG_COMM1,
    MSG_COMM2,
    MSG_COMM3,
    MSG_COMM4,
    MSG_COMM5,
}MSG_SOURCE;


typedef struct Mesg
{
   MSG_SOURCE         MsgSource;
   uint16_t           NumOfBytes;
   uint8_t           *BufferHandler;
}msg_t;

   msg_t msgSendPacket;
   //Fill the Packet from UART
   
    /* prepare to send message through Mailbox*/
    mailBoxMsg.info = sizeof(&msgSendPacket);
    mailBoxMsg.size = sizeof(&msgSendPacket);
    mailBoxMsg.tx_data = &msgSendPacket;
    mailBoxMsg.tx_block.data = NULL;
    mailBoxMsg.tx_target_thread = tid_myThread;
    k_mbox_async_put(&mailBoxMsgMailBox, &mailBoxMsg, NULL);//NULL means no semphore used
    
    k_poll_signal_raise(&myThreadSignal, dataSig);

so please help me to send this data packet to another thread.

Best Regards

Rajender

Parents Reply Children
Related