New-Tech Europe Magazine | Sep 2019 | Digital Edition

for asserting an interrupt. Each FSM program can generate an interrupt and can modify the contents of a corresponding register value based on the selected input signal. These register values are used to pass data from the IMU to the host processor. It’s useful to think of the FSM as a microprocessor minus the arithmetic logic unit. The FSM can make selections, perform comparisons, and can make decisions about its next state based on those comparisons. It does not compute values other than the Boolean results from the comparisons. The FSM is not a microprocessor. It can make comparisons and perform simple changes to the program flow based on these comparisons. Because it’s a simple machine, it’s programmed directly with the FSM opcodes. There is no high level language compiler for the FSM, but the programs are generally so simple that no compiler is needed. Using the FSM The LSM6DSO IMU’s FSM can be programmed to generate interrupt signals activated by predefined motion patterns. The FSM can run as many as 16 simultaneous, independent programs to detect motion. Each FSM program consists of a sequence of if-then-else steps and uses the sensor streams from the LSM6DSO’s accelerometers and gyroscopes as inputs. If any of the FSM programs detects a match to its preprogrammed pattern, the FSM can generate an interrupt to the host processor. Each of the sixteen possible FSM programs contains three memory sections for fixed data, variable data, and instructions. A single FSM program block diagram is shown in Figure 3.

Figure 3: The FSM in the STMicroelectronics LSM6DSO IMU incorporates sixteen code blocks, each of which contains three memory sections for fixed data, variable data, and instructions. (Image source: STMicroelectronics)

demonstrate the use of the various FSM features. Any of these sample programs can be installed into an IMU demo platform like the STEVAL-MKI109V3 eMotion STM32 eval board, which has a 28-pin socket that accepts the LSM6DSO STEVAL-MKI197V1 IMU adapter board. Programming the STEVAL- MKI109V2 board with one of the example programs requires only a few clicks in the Unico development environment. However, there’s a bit more to the LSM6DSO than meets the eye. The machine learning core The LSM6DSO IMU also incorporates a more sophisticated and programmable pattern matching engine called the machine learning core. This can identify classes of movement using the multiple sensor data streams from the internal IMU sensors and any attached external sensors. Recognizable event classes include stationary (no movement), walking, jogging, biking, and driving. Classification takes the form of decision trees within the machine learning core. The machine learning core consists of three blocks: the sensor data

The structure of a single program in a code block consists of three sections in a block of memory: A fixed data section, which has the same size for all the FSM programs A variable data section, which can vary in size An instruction section, which contains conditions and commands Programming each FSM code block involves loading the three memory sections with programing values that determine the FSM’s behavior. STMicroelectronics provides an FSM programming tool within its downloadable Unico evaluation development software and development environment. STMicroelectronics has also included several sample FSM programs with the Unico development tools as an aid in learning how to program the FSM. These sample programs demonstrate several IMU based interrupt scenarios including: A basic pedometer System in free fall Simple motion detection System has been picked up System has been shaken System has stopped moving (stationary) Wrist tilt The sample FSM program examples

New-Tech Magazine Europe l 19

Made with FlippingBook flipbook maker