When to use:
When to use:
When NOT to use:
The MAIN-SECONDARY INTERFACE (MSI) block enables data exchange between the master and secondary cores in dsPIC33CH dual-core devices. The MSI peripheral provides hardware-accelerated mailbox communication with protocol synchronization, allowing efficient inter-core data transfer without CPU polling overhead.
| Parameter | Description | Options | Variable |
|---|---|---|---|
| direction | Data transfer direction | send to main core / receive from main core / send to secondary core / receive from secondary core | direction |
| Offset | Starting mailbox number for data allocation | 0 to 15 | Offset |
| protocol | Protocol channel for synchronization | use protocol A through H | protocol |
| NData | Number of data items to transfer (1-32) | 1 to 32 | NData |
| Data1-Data32 | Data type for each item | unsigned int8/int16/int32, signed int8/int16/int32, single, double | Data1-Data32 |
| SampleTime | Block execution rate | -1 (inherited), or numeric value | SampleTime |
Important: MSI blocks on master and secondary cores must have matching configurations. Drag and drop the block from master to secondary model to ensure consistency.
% Master Core (33CH128MP508):
MSI_Mailbox0_Write:
- Write speed reference to Mailbox 0
- Trigger secondary interrupt
MSI_Mailbox1_Read:
- Read current measurement from Mailbox 1
- Update speed controller
% Secondary Core (33CH128MP508S1):
MSI_Mailbox0_Read:
- Read speed reference from Mailbox 0
- Execute in interrupt handler
MSI_Mailbox1_Write:
- Write current measurement to Mailbox 1
- Trigger master interrupt
| Scenario | Recommended | Reason |
|---|---|---|
| Control loop parameters | Mailbox | Fast, deterministic, 16 words enough |
| Sensor data streaming | FIFO | Buffered, handles variable rates |
| Event flags, status | Mailbox | Immediate, small data |
| Data logging | FIFO | Large buffer, non-critical timing |
| Synchronization signals | Protocol Interrupt | No data, just notification |
% Master triggers secondary task execution
Master:
compute_reference();
MSI_SendProtocolInterrupt(SECONDARY_START);
Secondary (Interrupt Handler):
if (protocol_interrupt == SECONDARY_START)
execute_fast_control_loop();
MSI_SendProtocolInterrupt(TASK_COMPLETE);
end
% Result: Precise task synchronization between cores