 Right, so we're now up to the last lab of the day or the last hands-on lab There's still a DDR lab to go and this one's about the Interprocessor communication so this is sending information from the a7 to the m4 and from the m4 back to the a7 So we're going to illustrate how the interprocessor communication controller works for the Communications between the two cores We're going to show you again using the cube ID and system workbench to generate the project and then show you the Linux framework That goes around all of this So this one we're actually going to compile directly some firmware for the m4 and Load that firmware into the target device Again as in all the other labs our color coding and our icons are going to tell you which terminal screen And if the slide has some Theory or some practical parts to it. So this is what's actually going on when we do the communications For this project So we will have an application Running on the left-hand side, which is in our a7 side when that wants to send a message It'll use a section called stm32 remote program message That will then disappear into some community drivers called rp message and our proc core Which will then control our IPCC hardware, which is the st driver The st drivers really all it's doing is sending the control flags So the information to tell you the other side in the Cortex-M side so on the right hand of the screen if there's an interrupt that the rp message block will be using a buffer or a section of RAM to store the message that you want to transfer across from the a7 to the m4 then on the m4 side You'll have your separate application running This will be using a virtual ur which is part of the howl drivers for Cortex-M devices and again using a Community block called open amp. This is where you will have a receive the buffer data from the RAM into the application or Where you'll transfer it if the communications are going towards the a7 and again you'll have a howl IPCC driver Controlling all the flags and the interrupt stages that's going on There's also a version that runs an i2c protocols as well So it'll have an i2c rather than a virtual ur type procedure So what we're going to do we're going to initialize Timer one again So it's going to be the same timer we've had before rather than using the green LED this time We're going to use an orange LED to toggle so this is going to be on a different location on the board It's actually on the top side near the buttons and Timer one is going to be assigned to the Cortex-M4 and It's going to be stopped and restarted by messages received Through the virtual ur procedure you've just seen from the a7 side So actually you're going to send the message on the a7 and The control of the timer is going to be controlled by the Cortex-M4 Also, we can send messages from the m4 Echoing it back over the virtual ur to the a7 so as well as sending the data one way We're going to send an echo of a message back to the a7 side so this is what's going on with the messages in here you can see the Bit of software that's doing the virtual ur channel and this is going to be our callback routine down here We've got the commands based on our buffer that we've received to either stop or restart our timer So there's our timer interrupts, which is either stopped or started depending on which of the messages We've got through and both of these routines are in main.c of our code which will open in a second Again in a terminal window. We should already have one of these terminal windows open We want to go and unzip the lab material that we've got for the hands-on lab m4 So we need to go and unzip that first then we need to launch our system workbench I'll go back to my terminal window and go back to my root directory I'll go and unzip My project so that's my project now unzipped. I should already have a system workbench probably open here last time there we go and Before I do anything I'm going to I'm going to close that project that's currently open there so it doesn't interfere with our new project and to do that it was right-click on the project name to bring up that menu and Now what we want to do is we want to import that project We've just unzipped into that workspace to right-click anywhere in this right-hand side of the screen now select import Existing projects into workspace and then go to this directory where we've just unzipped our project So I shall right-click anywhere in that white box and import and under general Existing projects into workspace Next now we need to browse to our location which was in desktop desktop DK2 Timer 1 op-amp solution and then say okay So it's found the project and we can now hit finish and it's now brought the project in and expand the tree again and In the source file we should hopefully find main.c You can see there all the information in main.c You should be able to see those found those routines further down that we've just looked at on the slides for the messages Virtual UART messages And then down here in the while one loop we can see the start blink and stop blink Right down at the bottom You can see the set and reset The UART now we want to build the project So I shall highlight my project name again and click the hammer And hopefully when everything's built you should see that we've generated a .elf file or .elf file And it should have a size of about 26k There we go 26 676k and it's DK Timer 2 open amp solution .elf So that's built the software that we need for our project So now we want to plug in a USB stick again into our host laptop We want to copy that .elf file across to our USB stick I'll attach my USB stick There's my USB stick arrived So I go back to my workbench So on this side you might have to select refresh to actually see the .elf file Remember this is a view exactly of the directory structure So you can right-click and do a refresh Hopefully in here now in the debug folder We should now be able to see our .elf file which is there And I want to just drag and drop the .elf file Which is the one I had highlighted there Is that one and drop it on to there So I've already got one from the previous example back in September So I want to say replace now I can unmount my USB disk and reconnect it back to my Terminal window, so if I unplug it reattach it to my target board You should see my terminal window was recognized and memorized it plugged in Go back to the root directory of that one as well And as we've done before We need to mount the device and then we need to copy the file across to the lib Firmware file on our target device I will mount the device again. It's warning me because I didn't unmount it correctly earlier on I'm now going to copy to the lib firmware file of the target board And as always once you've copied something onto the target you need to sync and Now we need to specify the name of the firmware we want to load So we want to Specify the name which is our L file and then we want to start the firmware That we want to do and that should start the orange LED blinking on the top side of your board So you're noticing there sometimes I'm getting a bit of word wrap on my lines Just the window is not big enough that we're pasting into so that's done the cop the load of the firmware and Now I'm going to start the firmware running I'm going to echo start across And now hopefully we should have an orange LED Up near your micro USB cable connector Flashing on and off at about one second so it should be next to the blue LED that's flashing away on the target board Here you can now play with different commands to see the state So we can have a look at the state to see if it's offline or running Then you've got the command for stop and then you can have a look at the state again to make sure things have worked So if we go and check the state out So we can now see that according to the state My board is running, which is what I'd expect the device is running My orange LED is flashing on my target board at this time and if I want to stop my device I can enter the stop command That should have stopped my LED flashing and if again if I check the state I can now see that the device is offline So I can see that both things are enabled or disabled I'll start it running again With that command And now we've got various other commands We can see to send the messaging backwards and forwards so we can send our virtual messages between our M4 and our A7 using these remaining commands here So we'll now echo some messages around between our target boards So with that message we can now see hello UART has been echoed back and it's been received on the virtual UART channel 0 Send the stop command It now tell me the blinking state is off and then if I send the restart command again It sends the command to say that it is restart again My blinking should now be blinking on and off again on my target board