-
Notifications
You must be signed in to change notification settings - Fork 9
RPi Examples
The following examples are provided for Raspberry Pi:
This example shows how to switch two half bridge outputs with minimal code. It will switch on two outputs (one to Vsup and one to GND), wait 3 seconds and switch off both outputs (both to floating state).
The TLE94112ES HAT needs to be stacked onto a compatible Raspberry Pi. A jumper needs to be placed between the middle pin and the CS0 marking as shown in the picture. The HAT needs to be connected to a 5.5V to 20V DC power supply. A load (max. 0.9A) has to be connected to output 1 and 5 of the HAT.
Please open the example source file at src/framework/raspberrypi/examples/basicTest.cpp
and read the comments before compiling it.
Change to Raspberry Pi framework folder:
cd src/framework/raspberrypi
Clean if any other example was compiled before:
make clean
Compile the example:
make examples/basicTest
Run the example:
../../../build/basicTest
This example runs an advanced controller test with one attached motor on the controller. It is meant for one bidirectional motor, connected to output 1 and 5 of the TLE94112. It demonstrates the following library functions:
- Basic motor control
- Run motor forward without PWM
- Stop (brake) motor
- Run motor backwards without PWM
- Coast motor
- Motor control with PWM
- Run motor forward with PWM (50% duty cycle)
- Stop (brake) motor with PWM (50% duty cycle)
- Ramp up/down motor speed
- Slowly ramp up duty cycle from 0% to 100%
- Slowly ramp down duty cycle from 100% to 50%
- Quickly ramp up duty cycle from 50% to 100%
- Quickly ramp down duty cycle from 100% to 0%
The TLE94112ES HAT needs to be stacked onto a compatible Raspberry Pi. A jumper needs to be placed between the middle pin and the CS0 marking as shown in the picture. The HAT needs to be connected to a 5.5V to 20V DC power supply. A bidirectional DC motor (max. 0.9A) has to be connected to output 1 and 5 of the HAT.
Please open the example source file at src/framework/raspberrypi/examples/advancedTest.cpp
and read the comments before compiling it.
Change to Raspberry Pi framework folder:
cd src/framework/raspberrypi
Clean if any other example was compiled before:
make clean
Compile the example:
make examples/advancedTest
Run the example:
../../../build/advancedTest
This example shows how to read and understand the status registers of the TLE94112. It will run the motor in forward direction and then read the status registers every 5 seconds. It shows how to understand the status registers and which errors can appear. Take this example if you want to learn how to debug the TLE94112 during operation.
The TLE94112ES HAT needs to be stacked onto a compatible Raspberry Pi. A jumper needs to be placed between the middle pin and the CS0 marking as shown in the picture. The HAT needs to be connected to a 5.5V to 20V DC power supply. A load (max. 0.9A) has to be connected to output 1 and 5 of the HAT. If you want to trigger errors you be ready to create a short circuit between output 1 and output 5 or disconnect the load to get an open load error.
Please open the example source file at src/framework/raspberrypi/examples/errorDiagnosis.cpp
and read the comments before compiling it.
This example will not terminate automatically. Use CTRL + C to terminate it.
Change to Raspberry Pi framework folder:
cd src/framework/raspberrypi
Clean if any other example was compiled before:
make clean
Compile the example:
make examples/errorDiagnosis
Run the example:
../../../build/errorDiagnosis
This example demonstrates how to control two motors, their speed and direction with the TLE94112.
The TLE94112ES HAT needs to be stacked onto a compatible Raspberry Pi. A jumper needs to be placed between the middle pin and the CS0 marking as shown in the picture. The HAT needs to be connected to a 5.5V to 20V DC power supply. A load (max. 0.9A) has to be connected to output 1 and 5 of the HAT. Another load has to be connected between output 7 and 9.
Please open the example source file at src/framework/raspberrypi/examples/multipleMotors.cpp
and read the comments before compiling it.
Change to Raspberry Pi framework folder:
cd src/framework/raspberrypi
Clean if any other example was compiled before:
make clean
Compile the example:
make examples/multipleMotors
Run the example:
../../../build/multipleMotors
The example shows how to control the half bridges to switch generic loads.
The TLE94112ES HAT needs to be stacked onto a compatible Raspberry Pi. A jumper needs to be placed between the middle pin and the CS0 marking as shown in the picture. The HAT needs to be connected to a 5.5V to 20V DC power supply. A load (max. 0.9A) has to be connected to output 1 and 5 of the HAT.
Please open the example source file at src/framework/raspberrypi/examples/halfBridge.cpp
and read the comments before compiling it.
Change to Raspberry Pi framework folder:
cd src/framework/raspberrypi
Clean if any other example was compiled before:
make clean
Compile the example:
make examples/halfBridge
Run the example:
../../../build/halfBridge
The multi half bridge TLE94112ES is able to drive voltage-controlled bipolar stepper motors This example shows how to control a stepper motor with the DC Motor Control HAT with TLE94112ES.
The TLE94112ES HAT needs to be stacked onto a compatible Raspberry Pi. A jumper needs to be placed between the middle pin and the CS0 marking as shown in the picture. The HAT needs to be connected to a 5.5V to 20V DC power supply. A low-current (<900 mA peak) voltage-controlled bipolar stepper motor needs to be connected as follows:
- Coil A, high side (A1) to half bridge output 1
- Coil A, low side (A2) to half bridge output 5
- Coil B, high side (B1) to half bridge output 7
- Coil B, low side (B2) to half bridge output 9
Please open the example source file at src/framework/raspberrypi/examples/stepperMotor.cpp
and read the comments before compiling it.
Change to Raspberry Pi framework folder:
cd src/framework/raspberrypi
Clean if any other example was compiled before:
make clean
Compile the example:
make examples/stepperMotor
Run the example:
../../../build/stepperMotor
Library Architecture
TLE94112 API
TLE94112Motor API
PAL Interface
Source Tree Structure
Preprocessor Configuration
Porting Guide
Doxygen Docs
Arduino
- Getting Started
- Lib Installation
- Arduino API
- PlatformIO
Cypress ModusToolbox
- Getting Started
- Lib Installation
- ModusToolbox API
- Examples
Cypress WICED
- Getting Started
- Lib Installation
- WICED API
- Troubleshooting Guide
Raspberry Pi (C++)
- Getting Started
- Lib Installation
- Raspberry Pi API
- Examples
Raspberry Pi (Python)
- Getting Started
- Lib Installation
- RPi Python API
- Examples