<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックRe: problem with IPC on 4357</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/problem-with-IPC-on-4357/m-p/586957#M21522</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by maszup on Fri Apr 26 00:02:05 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;P&gt;the problem i had was solved by doing followning actions:&lt;BR /&gt;&lt;BR /&gt;1) in lpcexpresso M0/M4 projects configure MCU settings to use different RAM memory regions. proviously M0/M4 were using the same ram and i got hard faults. that allowed me to run M0 from M4&lt;BR /&gt;&lt;BR /&gt;2) change the way of debugging - by using debugger in lpcxpresso i thought i was running the code on M0 but in fact i did it on M4. in order to do it properly configure your Launch configuration for M0 so that it not Load the image to target "Load image" = FALSE @ Launch Configuration-&amp;amp;gt;Debugger-&amp;amp;gt;Script Values. Then i load both codes on M0/M4 with flasher and while running the code jump into M0 code with debugger - in this way M4 always runs M0 at startup&lt;BR /&gt;&lt;BR /&gt;3) configure timer in M4 and just enable/disable its interrupt in M0. I was not able to configure timer at the M0 (rit or timer0). I don't know why yet but probably i forgot about something.&lt;BR /&gt;&lt;BR /&gt;4) IPC example on queues did not work. it stopped after the second message recieved from M0. so i decided to simplify that and used IPC interrupts only and made my own communication structure which i located in shared memory space:&lt;BR /&gt;&lt;BR /&gt;CORE_DATA* const coreMasterData = (CORE_DATA*) MASTER_BLOCK_START;&lt;BR /&gt;CORE_DATA* const coreSlaveData = (CORE_DATA*) SLAVE_BLOCK_START;&lt;BR /&gt;&lt;BR /&gt;typedef struct {&lt;BR /&gt; Bool busy;&lt;BR /&gt; uint32_t cmd;&lt;BR /&gt; uint32_t param;&lt;BR /&gt;}CORE_DATA;&lt;BR /&gt;&lt;BR /&gt;void slaveInterruptCallback(void) {&lt;BR /&gt;&lt;BR /&gt; command = coreMasterData-&amp;amp;gt;cmd;&lt;BR /&gt; parameter = coreMasterData-&amp;amp;gt;param;&lt;BR /&gt;&lt;BR /&gt; switch(command) {&lt;BR /&gt;&lt;BR /&gt; case ...&lt;BR /&gt; &lt;BR /&gt; break;&lt;BR /&gt; case ...&lt;BR /&gt; &lt;BR /&gt; break;&lt;BR /&gt; default:&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; coreSlaveData-&amp;amp;gt;cmd = command;&lt;BR /&gt; coreSlaveData-&amp;amp;gt;param = parameter;&lt;BR /&gt;&lt;BR /&gt; IPC_resetIntFlag();&lt;BR /&gt; IPC_sendInterrupt(); //send reply immediately&lt;BR /&gt;&lt;BR /&gt; return;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Status cM4send(uint32_t cmd, uint32_t param) {&lt;BR /&gt;&lt;BR /&gt; if(coreMasterData-&amp;amp;gt;busy) {&lt;BR /&gt; return ERROR;&lt;BR /&gt; }&lt;BR /&gt; coreMasterData-&amp;amp;gt;param = param;&lt;BR /&gt; coreMasterData-&amp;amp;gt;cmd = cmd;&lt;BR /&gt; coreMasterData-&amp;amp;gt;busy = TRUE;&lt;BR /&gt;&lt;BR /&gt; IPC_sendInterrupt();&lt;BR /&gt;&lt;BR /&gt; //set some custom timer to wait max time for reply from M0&lt;BR /&gt;&lt;BR /&gt; return SUCCESS;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;i don't know the reson why the eample on queues did not work longterm, probably i did something wrong but for first setup this simple data handling is enough for me.&lt;BR /&gt;&lt;BR /&gt;that should be all. mostly the strange things i got was due to the common ram between cores. &lt;BR /&gt;&lt;BR /&gt;I hope that helps to somone in solving dual core startup problems&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:12:16 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:12:16Z</dc:date>
    <item>
      <title>problem with IPC on 4357</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/problem-with-IPC-on-4357/m-p/586956#M21521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by maszup on Fri Apr 19 02:04:52 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;P&gt;Hello&lt;BR /&gt;&lt;BR /&gt;I'm trying to run a simple IPC communication between M4 and M0.&lt;BR /&gt;I have LPC4357 Embedded Artists EVB running&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;a title="&lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.embeddedartists.com%2Fproducts%2Fkits%2Flpc4357_kit.php"&gt;http://www.embeddedartists.com/products/kits/lpc4357_kit.php&lt;/A&gt;&lt;SPAN&gt;" href="&lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.embeddedartists.com%2Fproducts%2Fkits%2Flpc4357_kit.php"&gt;http://www.embeddedartists.com/products/kits/lpc4357_kit.php&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.embeddedartists.com%2Fproducts%2Fkits%2Flpc4357_kit.php"&gt;http://www.embeddedartists.com/products/kits/lpc4357_kit.php&lt;/A&gt;&lt;SPAN&gt;&amp;lt;/a&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;under LPCxpresso (v5.1.2.2065 - recently downloaded). &lt;BR /&gt;&lt;BR /&gt;I have found example of IPC dual core using queues for LPC4357 cpu (without RTOS):&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;a title="&lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fnxpfile%2Fan11177-inter-processor-communication-lpc43xx"&gt;http://www.lpcware.com/content/nxpfile/an11177-inter-processor-communication-lpc43xx&lt;/A&gt;&lt;SPAN&gt; " href="&lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fnxpfile%2Fan11177-inter-processor-communication-lpc43xx%2520"&gt;http://www.lpcware.com/content/nxpfile/an11177-inter-processor-communication-lpc43xx%20&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Fnxpfile%2Fan11177-inter-processor-communication-lpc43xx"&gt;http://www.lpcware.com/content/nxpfile/an11177-inter-processor-communication-lpc43xx&lt;/A&gt;&lt;SPAN&gt;&amp;lt;/a&amp;gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;directly here:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;a title="&lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fsw.lpcware.com%2F%3Fp%3Dlpc43xx.git%3Ba%3Dtree%3Bf%3DExamples%2FDUALCORE%2FQueue_Demo%3Bh%3D397e0b718c31c4629070190a23b86a70f47a7547%3Bhb%3D7c7bb548e35069d9fc913352977cf44b36a73552"&gt;http://sw.lpcware.com/?p=lpc43xx.git;a=tree;f=Examples/DUALCORE/Queue_Demo;h=397e0b718c31c4629070190a23b86a70f47a7547;hb=7c7bb548e35069d9fc913352977cf44b36a73552&lt;/A&gt;&lt;SPAN&gt;" href="&lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fsw.lpcware.com%2F%3Fp%3Dlpc43xx.git%3Ba%3Dtree%3Bf%3DExamples%2FDUALCORE%2FQueue_Demo%3Bh%3D397e0b718c31c4629070190a23b86a70f47a7547%3Bhb%3D7c7bb548e35069d9fc913352977cf44b36a73552"&gt;http://sw.lpcware.com/?p=lpc43xx.git;a=tree;f=Examples/DUALCORE/Queue_Demo;h=397e0b718c31c4629070190a23b86a70f47a7547;hb=7c7bb548e35069d9fc913352977cf44b36a73552&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fsw.lpcware.com%2F%3Fp%3Dlpc43xx.git%3Ba%3Dtree%3Bf%3DExamples%2FDUALCORE%2FQueue_Demo%3Bh%3D397e0b718c31c4629070190a23b86a70f47a7547%3Bhb%3D7c7bb548e35069d9fc913352977cf44b36a73552"&gt;http://sw.lpcware.com/?p=lpc43xx.git;a=tree;f=Examples/DUALCORE/Queue_Demo;h=397e0b718c31c4629070190a23b86a70f47a7547;hb=7c7bb548e35069d9fc913352977cf44b36a73552&lt;/A&gt;&lt;SPAN&gt;&amp;lt;/a&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;where in API file (IPC_queue.c) i changed only the interrupt functions to &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;/* interrupt function for the Slave queue */&lt;BR /&gt;void M0_M4CORE_IRQHandler(void) {&lt;BR /&gt;LPC_CREG-&amp;amp;gt;M4TXEVENT = 0x0;&lt;BR /&gt;cmdPending = PENDING;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;/* interrupt function setting the flags for the application */&lt;BR /&gt;/* interrupt to master from slave */&lt;BR /&gt;void M0CORE_IRQHandler() {&lt;BR /&gt;LPC_CREG-&amp;amp;gt;M0TXEVENT = 0x0;&lt;BR /&gt;msgPending = PENDING;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;So...&lt;BR /&gt;&lt;BR /&gt;I have put the code of M0 into its default flash address 0x1b000000. then I'm debugging M4 in following order: &lt;BR /&gt;&lt;BR /&gt;1. M4 boots and runs SystemInit();&lt;BR /&gt;&lt;BR /&gt;2. M4 goes directly to function cM4restart();&lt;BR /&gt;&lt;BR /&gt;3. There M4 halts slave, configure IPC queue, set M0 shadow register and starts up M0 (I do not load M0's image since it is already loaded into flash)&lt;BR /&gt;&lt;BR /&gt;4. M4 waits for 1st msg from M0 - it gets it&lt;BR /&gt;&lt;BR /&gt;5. M4 checks the 1st msg - status is SUCCESS - everything seems to be fine&lt;BR /&gt;&lt;BR /&gt;6. M4 tries to return from function cM4restart() - it hangs! debugger goes to some unkown address of M0's flash memory 0x1b000338&lt;BR /&gt;&lt;BR /&gt;I have also debugged that M4 enters the M0CORE_IRQHandler() so it gets the interrupt from M0.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I already switched off everything in my code leaving only IPC. Previously I had used UART for debugging, systick in M4 for measuring time in M4, Timer0 in M0 for measuring time in M0. But then i had hard faults in M4. so i left only IPC and tried to debug.&lt;BR /&gt;&lt;BR /&gt;I presume that something is going wrong with interrupts but I'm not sure.&lt;BR /&gt;&lt;BR /&gt;I don't know if below addresses are OK:&lt;BR /&gt;&lt;BR /&gt;/* these addresses specify where the IPC queues shall be located */&lt;BR /&gt;#define MASTER_CMD_BLOCK_START 0x20008000&lt;BR /&gt;#define SLAVE_MSG_BLOCK_START 0x2000A000&lt;BR /&gt;&lt;BR /&gt;and that the interrupts of IPC have priority = 0.&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;[B]I have attached exported project from LPCxpresso.[/B]&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;Below is my cM4restart() function:&lt;BR /&gt;&lt;BR /&gt;void cM4restart(void) {&lt;BR /&gt;Status status = ERROR;&lt;BR /&gt;&lt;BR /&gt;IPC_haltSlave();&lt;BR /&gt;//lpc_printf("%010d Core M0 stopped\r\n",rtcGetTime_ms());&lt;BR /&gt;&lt;BR /&gt;// setup the queue system&lt;BR /&gt;IPC_masterInitQueue(&amp;amp;amp;_hostCmdBufferData[0], MASTER_CMDBUF_SIZE, &amp;amp;amp;_hostMsgBufferData[0], SLAVE_MSGBUF_SIZE);&lt;BR /&gt;//lpc_printf("%010d Core M4 IPC initialized\r\n", rtcGetTime_ms());&lt;BR /&gt;&lt;BR /&gt;// Set M0's vector table to point to start of M0 image&lt;BR /&gt;LPC_CREG-&amp;amp;gt;M0APPMEMMAP = 0x1B000000;//(unsigned int)&amp;amp;amp;CM0image_start;&lt;BR /&gt;//lpc_printf("%010d Core M0 shadow register 0x%X\r\n", rtcGetTime_ms(), LPC_CREG-&amp;amp;gt;M0APPMEMMAP);&lt;BR /&gt;&lt;BR /&gt;IPC_startSlave();&lt;BR /&gt;//lpc_printf("%010d Core M0 started\r\n",rtcGetTime_ms());&lt;BR /&gt;&lt;BR /&gt;// wait for the M0 to signal being ready via a message to the command queue&lt;BR /&gt;while(!IPC_msgPending())&lt;BR /&gt;__WFI();&lt;BR /&gt;//lpc_printf("%010d Core M0 IPC ready\r\n", rtcGetTime_ms(),qstatus);&lt;BR /&gt;&lt;BR /&gt;qstatus = IPC_masterPopMsg(&amp;amp;amp;msgBack);&lt;BR /&gt;if(qstatus == QVALID) {&lt;BR /&gt;&lt;BR /&gt;msgType = IPC_getMsgType((msgToken*)&amp;amp;amp;msgBack);&lt;BR /&gt;if(msgType == MSG_SRV) {&lt;BR /&gt;serviceMessage = (srvMsg*) &amp;amp;amp;msgBack;&lt;BR /&gt;taskId = serviceMessage-&amp;amp;gt;msgClass.parsedMsg.servicingAnswer.id;&lt;BR /&gt;statusInfo = serviceMessage-&amp;amp;gt;msgClass.parsedMsg.servicingAnswer.ss;&lt;BR /&gt;&lt;BR /&gt;if(taskId == CORE_TASK_INIT &amp;amp;amp;&amp;amp;amp; statusInfo) {&lt;BR /&gt;//lpc_printf("%010d Core M0 initialized\r\n", rtcGetTime_ms());&lt;BR /&gt;status = SUCCESS;&lt;BR /&gt;} else {&lt;BR /&gt;//err&lt;BR /&gt;}&lt;BR /&gt;} else {&lt;BR /&gt;//err&lt;BR /&gt;}&lt;BR /&gt;} else {&lt;BR /&gt;//err&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;} //here the function does not return - program goes to undefined address&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;Thank you for any kind of help&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337923"&gt;sources-M4.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337923"&gt;sources-M0_1.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/problem-with-IPC-on-4357/m-p/586956#M21521</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: problem with IPC on 4357</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/problem-with-IPC-on-4357/m-p/586957#M21522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by maszup on Fri Apr 26 00:02:05 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;P&gt;the problem i had was solved by doing followning actions:&lt;BR /&gt;&lt;BR /&gt;1) in lpcexpresso M0/M4 projects configure MCU settings to use different RAM memory regions. proviously M0/M4 were using the same ram and i got hard faults. that allowed me to run M0 from M4&lt;BR /&gt;&lt;BR /&gt;2) change the way of debugging - by using debugger in lpcxpresso i thought i was running the code on M0 but in fact i did it on M4. in order to do it properly configure your Launch configuration for M0 so that it not Load the image to target "Load image" = FALSE @ Launch Configuration-&amp;amp;gt;Debugger-&amp;amp;gt;Script Values. Then i load both codes on M0/M4 with flasher and while running the code jump into M0 code with debugger - in this way M4 always runs M0 at startup&lt;BR /&gt;&lt;BR /&gt;3) configure timer in M4 and just enable/disable its interrupt in M0. I was not able to configure timer at the M0 (rit or timer0). I don't know why yet but probably i forgot about something.&lt;BR /&gt;&lt;BR /&gt;4) IPC example on queues did not work. it stopped after the second message recieved from M0. so i decided to simplify that and used IPC interrupts only and made my own communication structure which i located in shared memory space:&lt;BR /&gt;&lt;BR /&gt;CORE_DATA* const coreMasterData = (CORE_DATA*) MASTER_BLOCK_START;&lt;BR /&gt;CORE_DATA* const coreSlaveData = (CORE_DATA*) SLAVE_BLOCK_START;&lt;BR /&gt;&lt;BR /&gt;typedef struct {&lt;BR /&gt; Bool busy;&lt;BR /&gt; uint32_t cmd;&lt;BR /&gt; uint32_t param;&lt;BR /&gt;}CORE_DATA;&lt;BR /&gt;&lt;BR /&gt;void slaveInterruptCallback(void) {&lt;BR /&gt;&lt;BR /&gt; command = coreMasterData-&amp;amp;gt;cmd;&lt;BR /&gt; parameter = coreMasterData-&amp;amp;gt;param;&lt;BR /&gt;&lt;BR /&gt; switch(command) {&lt;BR /&gt;&lt;BR /&gt; case ...&lt;BR /&gt; &lt;BR /&gt; break;&lt;BR /&gt; case ...&lt;BR /&gt; &lt;BR /&gt; break;&lt;BR /&gt; default:&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; coreSlaveData-&amp;amp;gt;cmd = command;&lt;BR /&gt; coreSlaveData-&amp;amp;gt;param = parameter;&lt;BR /&gt;&lt;BR /&gt; IPC_resetIntFlag();&lt;BR /&gt; IPC_sendInterrupt(); //send reply immediately&lt;BR /&gt;&lt;BR /&gt; return;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Status cM4send(uint32_t cmd, uint32_t param) {&lt;BR /&gt;&lt;BR /&gt; if(coreMasterData-&amp;amp;gt;busy) {&lt;BR /&gt; return ERROR;&lt;BR /&gt; }&lt;BR /&gt; coreMasterData-&amp;amp;gt;param = param;&lt;BR /&gt; coreMasterData-&amp;amp;gt;cmd = cmd;&lt;BR /&gt; coreMasterData-&amp;amp;gt;busy = TRUE;&lt;BR /&gt;&lt;BR /&gt; IPC_sendInterrupt();&lt;BR /&gt;&lt;BR /&gt; //set some custom timer to wait max time for reply from M0&lt;BR /&gt;&lt;BR /&gt; return SUCCESS;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;i don't know the reson why the eample on queues did not work longterm, probably i did something wrong but for first setup this simple data handling is enough for me.&lt;BR /&gt;&lt;BR /&gt;that should be all. mostly the strange things i got was due to the common ram between cores. &lt;BR /&gt;&lt;BR /&gt;I hope that helps to somone in solving dual core startup problems&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:12:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/problem-with-IPC-on-4357/m-p/586957#M21522</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:12:16Z</dc:date>
    </item>
  </channel>
</rss>

