【LPC54100】LPC54102 M0+打包快递给M4
[复制链接]
【LPC54100】LPC54102 M0+打包快递给M4
目的: M0+核间歇性的读取温度,和角度值 ,打包快递给M4
占用硬件资源 MAILBOX
一、初始化MAILBOX
myCoreBox = MAILBOX_CM0PLUS;
otherCoreBox = MAILBOX_CM4;
/* M4 core initializes the mailbox */
/* ROM will setup VTOR to point to the M0 vector table in FLASH
prior to booting the M0 image. */
/* Enable mailbox interrupt */
NVIC_EnableIRQ(MAILBOX_IRQn);
二、打包快递
//读温度
utemp=Read_TMP275_TEMP();
dat =Write_SPI(AS5055A_Angular_Data,READ_CMD,0);
sum=sum + dat;
if(++ii>7)
{
ii=0;
sharedbyte = sum >> 3;
sum=0;
sharedbyte = sharedbyte | ((utemp<<16) & 0xFFFF0000);
//----------------------------------------------
mutexTake();
Chip_MBOX_SetValue(LPC_MBOX, otherCoreBox, (uint32_t) &sharedbyte);
mutexGive();
//---------------------------------------
}
这里用了一个4个字节的变量,高2字节用温度,低2字节用角度。
|