Other Parts Discussed in Thread: MMWAVE-SDK
Tool/software: TI-RTOS
I want to communicate between ARM and DSP using Mailbox, but when ARM write to mailbox, new message flag not set and DSP cant go through while loop to read message in mailbox.
Code on ARM:
//
// Mailbox initialization
Mailbox_init(MAILBOX_TYPE_MSS);
// Set up mailbox
Mailbox_Config_init(&cfg);
cfg.readMode = MAILBOX_MODE_CALLBACK;
cfg.readCallback = test_callback;
//Open instance to DSS
handleDss = Mailbox_open(MAILBOX_TYPE_DSS, &cfg, &errCode);
if(handleDss == NULL)
{
printf("MSS: Error: unable open MailBox to DSS");
return;
}
if(errCode!=0)
{
printf("MSS: Error: Unable to open the Mailbox Instance. Error=%d\n",errCode);
return;
}
printf("MSS: Mailbox Instance to DSS %p has been opened successfully\n", handleDss);
// Write and send mess to DSS
mess = 2000;
printf("MSS: Mailbox Instance to DSS %p has been opened successfully\n", handleDss);
size = Mailbox_write(handleDss, (uint8_t*)&mess, sizeof(mess));
printf("MSS: received an ACK from DSS \n");
if(size != sizeof(mess))
{
printf("MSS: write Mbx fail");
}
//
Code on DSP:
//
Mailbox_init(MAILBOX_TYPE_DSS);
//Set up Mailbox
Mailbox_Config_init(&cfg);
cfg.readMode = MAILBOX_MODE_CALLBACK;
cfg.readCallback = test_callback;
// Open Mailbox channel
handle = Mailbox_open(MAILBOX_TYPE_MSS, &cfg, &errCode);
if (handle == NULL)
{
System_printf("DSS: Error: Unable to open the Mailbox Instance\n");
return;
}
if (errCode != 0)
{
System_printf("DSS: Error: Unable to open the Mailbox Instance. Error=%d\n",errCode);
return;
}
System_printf("DSS: Mailbox Instance %p has been opened successfully\n", handle);
System_printf("DSS: ************ Waiting for message 1 from MSS ****************\n");
/* wait for call back to set flag */
while (testAppCallbackFlag_dss == 0)
{
Task_sleep(100);
}
System_printf("DSS: Message 1 received.\n");
// read mess
mess_rx = 0;
size = Mailbox_read(handle, (uint8_t*)&mess_rx, sizeof(mess) );
if (size != sizeof(mess))
{
System_printf("DSS: Error read.\n");
}
//