I2C TPU

I2C TPU

Post by Thanassis Roubi » Wed, 10 Sep 2003 22:41:11



Has anyone implemented a code for i2C in TPU? I need to find , get
some help. i have been searching all around the net and all i found
was Morbachs i2c code which is in assembly and i can't make it out!i
am using the ECOC compiler. any help would be great.

Thank you

 
 
 

I2C TPU

Post by Gene S. Berkowit » Thu, 11 Sep 2003 11:37:56




Quote:> Has anyone implemented a code for i2C in TPU? I need to find , get
> some help. i have been searching all around the net and all i found
> was Morbachs i2c code which is in assembly and i can't make it out!i
> am using the ECOC compiler. any help would be great.

> Thank you

Arno's code is written in TPU assembler; it lets the TPU do most of
the work of implementing an I2C master.
There is no C compiler for the TPU that I know of.
If you don't want to program the TPU, you can always "bit-bang"
on two I/O ports to create an I2C master, but it has quite a bit
of overhead.

--Gene

 
 
 

I2C TPU

Post by Thanassis Roubi » Thu, 11 Sep 2003 16:57:58


Quote:> Arno's code is written in TPU assembler; it lets the TPU do most of
> the work of implementing an I2C master.
> There is no C compiler for the TPU that I know of.
> If you don't want to program the TPU, you can always "bit-bang"
> on two I/O ports to create an I2C master, but it has quite a bit
> of overhead.

> --Gene

I have an evaluation board for the 68332, the mega332. along came the
ecoc compiler and allows one to write code in c and translate it for
the 68332. i can control all TPU functions and do the same as
assembly. i just don't understand which function he would use for SCL
and SDA. if you know could you help?

thank you.

 
 
 

I2C TPU

Post by Gene S. Berkowit » Fri, 12 Sep 2003 11:56:16




Quote:> > Arno's code is written in TPU assembler; it lets the TPU do most of
> > the work of implementing an I2C master.
> > There is no C compiler for the TPU that I know of.
> > If you don't want to program the TPU, you can always "bit-bang"
> > on two I/O ports to create an I2C master, but it has quite a bit
> > of overhead.

> > --Gene

> I have an evaluation board for the 68332, the mega332. along came the
> ecoc compiler and allows one to write code in c and translate it for
> the 68332. i can control all TPU functions and do the same as
> assembly. i just don't understand which function he would use for SCL
> and SDA. if you know could you help?

> thank you.

The TPU functions are written in TPU microcode which is stored in
a mask ROM on the 68332 die.
When you select a particular TPU function, you are causing the TPU
to execute microcode to carry out that function.
The TPU can be set to run from the on-chip RAM (called the
emulation RAM, because it emulates the mask ROM).
You can write your own function in TPU Assembly language, run it
through TPUASM, and the result is TPU microcode.  Load that code
into the emulation RAM, set the emulation bit in the TPUMCR register,
and your function will be executed just like the "built-in" ones.

Arno's code is a TPU microcode function that produces SCL and SDA on two
TPU pins in the proper relationships, and automatically reads/writes the
bits for you.

The drawback is, when you select the emulation RAM, you LOSE access
to the built-in functions in ROM.  Fortunately, Motorola kindly
supplies the SOURCE for the built-in functions, so you can assemble
these along with your custom function, load the whole kit into
RAM, and get the best of both worlds.

You can read all about it, and download the source and tools from
my web page: http://www.eslave.net
Note that Motorola supplies all this, but it's easier to find on my
page.

--Gene

 
 
 

I2C TPU

Post by Thanassis Roubi » Fri, 12 Sep 2003 16:43:46


Quote:> You can write your own function in TPU Assembly language, run it
> through TPUASM, and the result is TPU microcode.  Load that code
> into the emulation RAM, set the emulation bit in the TPUMCR register,
> and your function will be executed just like the "built-in" ones.

when i try to compile tpu-iic.asm with tpumasm.exe, which i got at
your site, i get errors which i cannot solve:
line 340: Delimiter expected
line 275,317: function not found
line 338: Error/Warning table is full
warning , no entry points found.

could you send me a compiled file which i could upload to the
emulation RAM and use it as you say? i could use some help on how to
load it to RAM! if i get past this problem i will be flying!!

thank you very much for your help!

 
 
 

I2C TPU

Post by Thanassis Roubi » Fri, 12 Sep 2003 19:23:16


Nevermind the tpumasm.exe compiler. i read some pdfs and i compiled a
file with the functions iic and dio. these are all i need.
now for the difficult part:
i have the mega332 board and i now want to write the s19 file to my
RAM and enter emulation mode. i don't know how. the pdf for "USING THE
TPU FUNCTION LIBRARY AND TPU EMULATION MODE" says that i can load by a
program or by a monitor. my monitor is TM.EXE, or else Nico Monitor by
MCT. i now am stuck again and i don't know how to write my RAM.
Any help would be great!email me for faster!

thank you again

 
 
 

I2C TPU

Post by Gene S. Berkowit » Sun, 14 Sep 2003 14:41:11




Quote:> Nevermind the tpumasm.exe compiler. i read some pdfs and i compiled a
> file with the functions iic and dio. these are all i need.
> now for the difficult part:
> i have the mega332 board and i now want to write the s19 file to my
> RAM and enter emulation mode. i don't know how. the pdf for "USING THE
> TPU FUNCTION LIBRARY AND TPU EMULATION MODE" says that i can load by a
> program or by a monitor. my monitor is TM.EXE, or else Nico Monitor by
> MCT. i now am stuck again and i don't know how to write my RAM.
> Any help would be great!email me for faster!

> thank you again

No, this should be the easy part.

First, set TPU RAM Base Address Register (TRAMBAR)
to map the RAM to a specific address:

TRAMBAR = 0xFFE8;      
// The TPU RAM is assigned to the 2Kbyte block beginning at 0xFFE800

Now, I don't know about the monitors you have, but they all should
have the capability to read a file in some format to a block of
memory.  If not, you might be able to find a utility that converts
a binary into a C array. Then, it's a simple matter to copy that
array to the emulation RAM address.

Set the emulation bit in TPUMCR, and you're on your way.

Keep reading the manuals, you're doing great so far!

--Gene