To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 1839
1838  |  1840
Subject: 
Motor Control Register (0xf000)
Newsgroups: 
lugnet.robotics.rcx, lugnet.robotics.rcx.legos
Date: 
Wed, 13 Nov 2002 17:21:22 GMT
Viewed: 
3997 times
  
Seeing as how there's been little traffic here recently,
I thought I'd post about something I found that's cleared
up a little mystery (for me at least).

It concerns the RCX register that is used to control
the motors.  This register lives at 0xf000.  In fact,
on one of Kekoa Proudfoot's pages he states that any
write in the range 0xf000-0xfb7f will affect the
motors.  This is true, I tested it.

Well, the thing that confused me was that people
were using some of this same address space as
external RAM.

For example, in the 0328 firmware, after it gets
downloaded it moves some of its code up into the
RAM starting at 0xf100.  It subsequently makes
calls to the functions located in this upper RAM
region and apparently everything works fine.

Another example is brickOS.  It adds the range
0xf010-0xfb7f to the memory manager's free
memory pool.  And this works, too.

So, I wrote a little test program that wrote a unique
pattern to all memory in the range 0xf000-0xfb7f.
I then inspected the memory, and sure enough the
entire pattern was intact.  It turns out that the entire
range is RAM, even the address 0xf000!

The only way to reconcile this is to assert that any
write to 0xf000-0xfb7f writes to BOTH the motor
control register and external RAM.  Any read in
this range reads from RAM.

What this means for brickOS users is that any
memory returned by malloc() in this range that
is written to will also affect the motors.  If you
do only sporadic writes to this memory then you
may not notice anything because the motor
control register gets refreshed every 1ms by
brickOS.  However, if you are doing some heavy
writing to this memory, then the waveform going
to the motors can be significantly altered (basicly
affecting the power given to the motor).

This is not a problem for the 0328 firmware
because once it uploads its code to 0xf100, it
only ever reads from this memory (when the
code that lives there is executing).

Perhaps brickOS can adopt the same approach
and move some of its code to this memory
region, freeing up space in lower RAM that
won't have an adverse affect on motor output.
It's fairly straightforward to do this kind of thing
using the GNU assembler and linker.

BTW, a side effect of this is that 0xf000 is its
own shadow register!

Anyways, sorry for the length... thanks for reading,

Mark



Message has 5 Replies:
  Re: Motor Control Register (0xf000)
 
Mark, This is very interesting. I have experienced strange motor behavior with programs on BrickOS before; I now wonder if this may have been the situation. I do not currently know enough about GCC to make the changes that you mentioned, but I am (...) (22 years ago, 13-Nov-02, to lugnet.robotics.rcx, lugnet.robotics.rcx.legos)
  Re: Motor Control Register (0xf000)
 
(...) Interesting, I never looked at that version. I think the one disassembled by Kekoa is 0309. Current versions of leJOS also use this upper memory to store part of its firmware (almost 3K). Jürgen (22 years ago, 13-Nov-02, to lugnet.robotics.rcx, lugnet.robotics.rcx.legos)
  Re: Motor Control Register (0xf000)
 
(...) This is interesting. It makes sense that the memory backing these locations still works, but I never would have thought to try to use it. I will make a note of this on my pages. -Kekoa (22 years ago, 13-Nov-02, to lugnet.robotics.rcx, lugnet.robotics.rcx.legos)
  Re: Motor Control Register (0xf000)
 
The lugnet registration takes forever :) After reading this post a light went on in my head. A few weeks ago I wrote a multi-threaded program for the RCX (about 7 threads, each running an endless loop). When I added one more thread, the robot (...) (22 years ago, 27-Nov-02, to lugnet.robotics.rcx, lugnet.robotics.rcx.legos)
  Re: Motor Control Register (0xf000) and Memory Space 0xFDB0-0xFD7F
 
This note is of interest to people who build their own RCX firmware. It provides some additiional insight to the recent post concerning dual use of upper memory range and the motor control register. There's a trade-off between real time performance (...) (22 years ago, 1-Dec-02, to lugnet.robotics.rcx, lugnet.robotics.rcx.legos)

16 Messages in This Thread:








Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR