fischertechnik TXT 4.0 Controller: Internals and Programming

Printed book cover

fischertechnik® TXT 4.0 Controller
Internals and Programming

© 2024 David Adams, Tarma Software Research Ltd.
ISBN 978-1-7394538-9-3

Premium colour paperback: 709 pp., 126 full-colour illustrations.
eBook: 804 pp. due to different formatting, otherwise same content.

The most recent draft is available as a free download below. To buy a paperback edition, go to either Amazon or Lulu.

 

Update 4 September 2024: The same book is now also available from Lulu.com, as a standard colour paperback instead of premium colour. However, the Lulu price is less than half the Amazon price and the quality of the colour images is fine. Due to marginally different formatting, the Lulu edition is 707 pp. but the contents are identical.

Amazon Premium colour paperback from Amazon: DE NL UK US (EUR89, GBP75, USD99)

Lulu.com Standard colour paperback from Lulu.com (EUR39, GBP35, USD42)

This book covers most aspects of the hardware and software internals of the fischertechnik TXT 4.0 controller, along with chapters about application development for that controller. Find out:

  • Why the counting inputs C1-C4 can only count 500 pulses per second instead of the 1000 per second that fischertechnik claims (sections 8.2 and 24.3.5)
  • How the resistance and NTC temperatures are calculated for inputs I1-I8 (sections 7.2.4 to 7.2.6)
  • How the ultrasonic distance sensor protocol works (section 7.4)
  • What the output signals on O1-O8 / M1-M4 look like under various loads (sections 9.4.1 to 9.4.6)
  • How to switch between boot partitions A and B (section 5.4.5)
  • How to obtain root access and add yourself to the sudoers list (sections 2.4 and 2.4.1)
  • How the various interface protocols work: CAN (chapter 11), I2C (chapter 12), USB (chapter 13)
  • How extension controllers are discovered and registered (section 11.3)
  • How to program each sensor and actuator, from micro switches and LEDs to encoder motors, each I2C sensor, and the USB colour camera (chapters 23 to 29)
  • How to program mecanum vehicle movements efficiently (section 26.4.6)
  • How the image processing steps by the ball detector (section 30.3.6), line detector (section 30.3.9), and motion detector (section 30.3.11) algorithms work.

The book combines theoretical background with practical examples and a wealth of information and technical data about the TXT 4.0 controller and the fischertechnik sensors and actuators.

On this page

What this book is

This book is primarily a dissection of the TXT 4.0 controller combined with an in-depth reference manual. It provides detailed information about the TXT 4.0 controller from three perspectives:

  1. The hardware implementation: what is the controller made of?
  2. The low-level software implementation: how does the hardware connect to the software?
  3. The application software interface: how do you program the controller?

The topics that we cover

  • The internal operation of the TXT 4.0 controller: the STM32MP157 SoC and its CPUs, peripherals, storage, and the way the Linux and FreeRTOS operating systems are used.
  • The details of the embedded firmware and how it implements the front-panel I/O connections: the universal inputs I1-I8, the counter inputs C1-C4, the general outputs O1-O8 and motor outputs M1-M4, and the servo outputs S1-S3.
  • The way that multiple TXT 4.0 controllers are connected in an extension chain using the CAN FD protocol within the EXT1-EXT2 connectors and how they interact with each other.
  • The I2C interface within the EXT1-EXT2 connectors and how it is used to communicate with I2C-based sensors. The sensors themselves are discussed separately.
  • The USB1 host and the USB2 device ports and how each of them, and the USB protocol itself, operates in the context of the TXT 4.0.
  • A complete treatment of all current fischertechnik sensors and actuators: their technical data, operation, and programming.
  • A complete programming reference for the C client libraries TxtControlLib and ftlock.
  • A complete programming reference for the fischertechnik Python class library.

Figure 51. Output signal for 25% PWM duty cycle with XS motor load.

Oscilloscope screenshot

What this book is not

This book is not a tutorial; there are no step-by-step instructions on how to accomplish a particular programming task or build a specific model. The book explains the inner workings of the hardware and the software and uses source code examples to illustrate various points, but these are not intended as complete applications. In addition, the following topics are not covered in this book, either because they are outside its scope or because they require a volume of their own and are (or will be) covered separately:

  • Programming with ROBO Pro Coding, including Blockly programming
  • User interface programming with Qt
  • Remote programming using the REST API
  • Remote access via Node-RED

Figure 13. Outline of the TXT 4.0 boot process from power-up to Linux startup.

TXT 4.0 boot process

Structure of the book

After the introductory chapters, the book is organised in a bottom-up fashion: we start with the hardware internals of the TXT 4.0 controller, then turn to the internal software implementation (the firmware), follow that with low-level system programming chapters, and finish with the application programming class library. In outline:

Part 1 - Introducing the TXT 4.0 controller

A high-level overview of the TXT 4.0 controller's features, usage, and programming options.

  1. Introduction
  2. TXT 4.0 controller overview

Part 2 - System internals

Detailed exploration of the TXT 4.0 controller's hardware and software implementation.

  1. System hardware
  2. Software architecture
  3. Cortex-A7 subsystem
  4. Cortex-M4 subsystem
  5. Universal inputs I1-I8
  6. Counter inputs C1-C4
  7. Outputs O1-O8 / Motors M1-M4
  8. Servo outputs S1-S3
  9. CAN interfaces EXT1-EXT2
  10. I2C interfaces EXT1-EXT2
  11. USB interfaces USB1-USB2

Part 3 - System programming with C, C++, and Python

Discussion of and reference manual for the low-level C, C++, and Python libraries.

  1. TxtControlLib library
  2. ftlock library
  3. C++ wrapper classes
  4. Python bridge modules

Part 4 - Application programming with Python

Reference for the application-level Python class library and all standard fischertechnik sensors and actuators. These are organised by package name and input or output type.

  1. Python application class library
  2. fischertechnik root package
  3. factories package
  4. controller package
  5. TXT 4.0 controller
  6. Universal inputs I1-I8
  7. Counter inputs C1-C4
  8. General outputs O1-O8
  9. Motor outputs M1-M4
  10. Servo outputs S1-S3
  11. I2C interfaces EXT1-EXT2
  12. USB interfaces USB1-USB2
  13. camera package
  14. control package
  15. events package
  16. http package
  17. machine_learning package
  18. models package
  19. mqtt package
  20. utility package

Part 5 - Appendices

Various appendices with supplemental material.

  1. Integer number encodings

Downloads

The updated draft version is available as a free PDF download using the link below. Please note that this is copyrighted material – for personal study only. Reproduction and distribution prohibited. Contact the author for information about multiple copies.

Differences between printed and eBook versions

The printed and eBook versions are identical in content, but the formatting of the printed edition is better for reading. The eBook conversion is done by an automated process that changes some fonts for on-screen use. Jumping to specific chapters and sections is easier in the eBook version, but the printed version reads more comfortably, so a combination of both may be the best solution: the printed version for focused reading and the eBook version for reference and searching.

Screenshot of eBook version with electronic table of contents

TXT 4.0 book open spread