Constantin Razvan Chivu

[FlexIO] Flex your muscles with the latest MBDToolbox release

Discussion created by Constantin Razvan Chivu on Oct 16, 2017

Greetings @MBD-ers !


I'm excited to talk to you about a cool new feature we're introducing in our latest release (3.0) - FlexIO communication.


First of all, let's find out what FlexIO is and how it works:

FlexIO is an autonomous, asynchronous, adaptable peripheral.
It can make decisions without the processor's intervention, it has independent clocking - can operate in low power modes and (important) can emulate all sorts of protocols (like I2C, SPI, UART).
Basically, it has a number of double-buffered shift registers and timers, with input and output signals: 

                FlexIO block diagram

The number of timers, shift registers and pins depend on the implementation on the microcontroller. On the S32K144 you find:

  • 4 32bit shifters
  • 4 16bit timers
  • 8 input/output pins


How does it work?
A simple way to see it is - data is loaded onto a shifter and a timer is assigned to generate the shifter clock and use a pin to output the data from that shifter.


Where and when can you use it?
Let us look at the following scenario:
You have a solution for a problem, but you need more peripherals than you have. In this scenario, there are 2 options:
- either make changes to the (hardware)setup you already have and want to use
- either bit-bang[1] the protocol yourself - that usually results in slower performance and it takes time to do it (thus maybe increasing time-to-market)

This is where FlexIO comes in handy - it provides a 3rd option: don't make any hardware changes, don't bit-bang
anything - just use this smart peripheral that lets you emulate protocols like I2C, UART, SPI - saves you time and effort.

This is just one of many other scenarios where you have the perfect MCU - right performance, right memory size,
but it just so happens it doesn't have the number of X communication protocol that you need for your application.


In MBDToolbox for S32K v3.0 we've added FlexIO communication:
To make sure you have that 3rd option of making no compromises, we have added FlexIO blocks for

  • SPI
  • I2C
  • UART

emulation, so you don't have to worry if you are ever in need of one or more instances of any of these.


Examples and demos:

We have provided examples on how to use them and we will post a video demo of FlexIO SPI usage (ping-pong data between Master and Slave) and one in which we use FlexIO I2C to get data from a temperature sensor every 5 seconds, while the rest of the time the processor is in a low power mode (*also a cool new feature we've added in this latest release). So make sure to check them out and let us know if you are having trouble using them or if you have ideas on how to make them better!



We really appreciate the feedback and interest you are showing towards this toolbox, so I will end this with a sincere Thank You! on behalf of the MBDT team!

[1] bit-bang: technique for serial communications using software instead of dedicated hardware. Software directly sets and samples the state of pins on the microcontroller, and is responsible for all parameters of the signal: timing, levels, synchronization, etc.