TPU-Function for I2C Interface

Da diese Seite schon etwas älter ist, ist sie auf englisch geschrieben. Ich habe sie nicht weiter überarbeitet und sie ist nur der Vollständigkeit halber hier weiterhin verfügbar. Es gab einige Interessenten in der Vergangenheit, die weiterhin die Quellen finden sollen, so wie sie schon jahrelang sind.

I was using the 68332 and the 68376 some time, when I was wondering about the TPU. There were several predefined functions with a lot of documentation, but the available source code was nearly unreadable. Fortunately I was in possesion of the old TPU manual, which is not longer available. The internal structure of the TPU is exactly described. I knew, that if I wanted to understand the TPU, I had to program my own TPU function. The 68332 and the 68376 lack an I2C bus, which is quite common at several other microcontrollers. To communicate with I2C memories, a TPU function to serve only as bus master was adequate. The task seemed to be demanding enough and the function was not time critical. A good opportunity to make my own experience.

The source code iic.uc (ASCII file).

At http://www.eslave.net/tpu/source/source.shtml you can find several other information about the TPU and the original Motorola TPU funtions. Unfortunately the information is not so easy to be found at the Motorola website, so have a look at the collected information at http://www.eslave.net/tpu/source/source.shtml.

If you don´t know how to use your own TPU code, the use of the source code will be a complicated task. In the following I want to describe the process of generating and downloading TPU code into the internal RAM of an 68332 or 68376.

  1. First you have to have the source code of your TPU function which you want to download.

  2. Every TPU function has to have its own function number. That´s the number you have to write into the CFSR0..3 register. To be flexible, all functions are included in one main wrapper file. Motorola named it tpumskab.asc for the A mask. It only contains some standard exit points and the list of the included TPU functions and their function number. This scheme allows to write a TPU function without fixing the function number. (Example of a modified tpumskab.asc).

  3. The TPUASM.EXE, which can be downloaded from the web site mentioned above, will be used to assemble the TPU code. This assembler will run under DOS on a PC. Zoltan Kocsi wrote a TPA assembler which runs under UNIX. Again, have a look at http://www.eslave.net/tpu/source/source.shtml.

  4. If the code assembles without error, you will get a file named tpumskab.lst. (Example of   tpumskab.lst). All you have to do now, is to extract the 32-bit numbers and generate an array to be included in C code or Assembler. I can´t give you the source of this tool, but the task is not so difficult to be done. (Example of C include file with TPU code).

  5. The next task will be to get the TPU code into your 683xx and running. (Example of TPU loader).

  6. Next, you have to initialise each function individualy. (Example of IIC initialisation).

  7. Last, you have to use the function. (Example of IIC use).

The Examples are cut out of my original test program. They are modified, because I can´t show the whole program and the comments were in german. They will not be able to compile directly, but I hope you get an idea how to use your own TPU function.

If you have questions or suggestions (english is not my native language) contact me.