Author
NXP
At NXP, innovation is always now, but our focus is always the future. Our dedicated team of experts is united by a passion to make everyday life more remarkable through technologies that continually redefine life as we know it.
When dealing with a microcontroller that has two processor cores, it’s important to develop a clear set of rules for communications between the two cores. In the LPC4300 series, the two cores are of different types. There is a Cortex-M4 for complex applications processing, including DSP functions, and a Cortex-M0 for real-time control functions. In terms of communications, the Cortex-M4 is generally considered the leader and the Cortex-M0 is typically considered the follower. The designer can configure the LPC4300’s inter-processor communications (IPC) based on interrupts, a message queue or mailboxes.
Interrupt method
The interrupt method, which is the simplest of the three methods, lets one
core send an interrupt to the other, as notification that an
application-defined event has occurred. The interrupt routine is very compact,
so it doesn’t require a lot of code space. The designer can specify a
callback function, for execution during the interrupt, to perform some quick
function. If the callback function isn’t used, it can be left as an
empty function.
To signal the remote core, the local core issues the dedicated instruction SEV (send event), which is included in the Cortex architecture. Once an IPC notification is received, a flag variable is set. The flag variable can be used by the receiving core to check for status.
Message queue
In the message queue method, the designer defines two areas of shared memory,
to be used to store messages that each core sends to the other. A Host Command
buffer is dedicated to the commands sent from the leader to the follower, and a
separate Host Message Buffer is dedicated to the messages the follower sends back
in response. Figure 1 shows the setup.
Mailbox method
As the name implies, this method draws on the concept of a mailbox. Each core
has a placeholder in RAM memory that is used to send and receive messages.
Each core manages its own RAM mailbox, and messages are directed to the other
core’s mailbox.
The APIs
Each method of communication — interrupt, message queue and mailbox
— has its own set of application programming interfaces (APIs). The
APIs let the leader start or halt the follower, and let the leader download an
application image from the follower. There isn’t enough space in this
short blog to include the details of each API, but the application note
AN1117 provides full explanations of the coding, along with sample flowcharts
that make it easy to visualize the working method.
Tags: Technologies
At NXP, innovation is always now, but our focus is always the future. Our dedicated team of experts is united by a passion to make everyday life more remarkable through technologies that continually redefine life as we know it.
February 19, 2020
by NXP
March 23, 2020
June 3, 2020
by Lars Reger