Blog

ELC/OpenIoT NXP Demo

By December 3, 2018 December 7th, 2018 No Comments

In October, thousands of people met in Edinburgh, Scotland for the Embedded Linux Conference Europe and OpenIoT 2018. During the conference, attendees saw 12 Zephyr technical presentations, participated in a full-day hackathon and stopped by the Zephyr Project booth to see demos and speak with member representatives and community members. The event proved to be a fantastic opportunity to learn about the diverse and innovative ways ZephyrOS is being used by members. In an effort to share some of the highlights of this event with the larger community, we’ll be posting demos, videos and resources throughout the winter. Thank you to NXP and Stanislav Poboril for starting this series with a closer look at their demo.

Software Defined Peripherals- Zephyr Used to Offload Real-Time Tasks from Linux

This demonstration demonstrates the offloading of the real-time task from Linux using Zephyr and RPMsg. For the purpose of this example, the UDOO Neo board with an NXP i.MX 6SoloX heterogeneous multicore SoC was chosen. Linux is running on the ARM Cortex-A9 core. The Linux deployment consists of a kernel module which creates one or more virtual devices /dev/ttySoftX to read and write data to the M4 core. The ARM Cortex-M4 core runs Zephyr for the execution of a real-time task, in this case  emulation of the UART protocol using GPIO pins. RPMsg is used for communication between the two systems.

Internally, RPMsg uses a Messaging Unit block and shared memory on the platform. On the Arm Cortex-M4 core, Zephyr waits for the configuration message from Linux on an RPMsg endpoint. Then it configures the emulation of UART using GPIO pins. It starts two cooperative threads – to transmit and to receive data. The transmit thread reads data received from Linux, decodes it into the form of UART pin changes which are enqueued to a buffer. The buffer is consumed from a timer callback, which toggles respective GPIO output pin(s). The timer callback also reads the input GPIO pin(s) states and places them into the receive buffer. This is read by the receive thread, which decodes it into bytes and sends it to the Arm Cortex-A9 using RPMsg.

The source code and description for the demo can be found here: https://github.com/NXPmicro/zephyr/tree/soft_periph/samples/soft_periph/  

https://source.codeaurora.org/external/imxsupport/lkm-softperipherals/about/