Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sharing Memory Between Processors? 2

Status
Not open for further replies.

eromlignod

Mechanical
Jul 28, 2006
402
Hi guys:

I'm an ME and I have an application where I'd like to use two Basic Stamp microcontrollers working together. One is the main processor that runs the show and does calculations; the other is a dedicated slave that constantly distributes a series of 16-bit numbers to
various devices in a continuous, timed loop. The first processor calculates what these numbers are based on feedback sources.

The reason I use a dedicated second processor is that its stream of numbers can't be interrupted...it has to provide a continuous series of values on a clock. The problem is that I can't even interrupt it long enough to pass numbers to it from the other processor without messing up the sequence.

What I'd like to try (if possible) is to share the same memory between the two MCU's. So the first Basic Stamp is calculating values and storing them to memory and the second Basic Stamp is using them as if they were in its own memory bank simply by referring to a value by variable name (or address??...I don't know).

Is this possible and, if so, what would be a good way of going about it? I'm also open to alternate suggestions to solve the problem including using a different processor (I would like to avoid investing in another development kit or chip burner if possible though).

Thanks for any help you can provide.

Don
 
Replies continue below

Recommended for you

Ha clever indeed... Probably end up under the wheels of some pickup truck Don.. a piano tuners! [auto][bugeyed][cry]HAHA.

Let me get this straight. You listen to each string and hence tune each string?

Is this done only during a "tuning time"?

Can you not use passive tuning and do it while it is being played or via someone running the keys once? Seems it would get out a sizable bit of wiring(expense) for you, (excitation coils).

You've probably thought of it already but maybe you should provide methods - perhaps using a DSP to allow "coloring" of the tuning so that a musician can have the tuning shift for their needs, or the music's, or the "halls" as Appalling was saying. That way the piano tuners could possibly embrace the system too.

230 channels yikes. I'd still stick with the same plan. I'd run the excitation and the heat and even the audio frequency detection with each module you'd then have a module run the basic tuning per group.

This format makes for a tidy development(always important!)

1) Build a board to completely control 8 channels.
2) Get it to control perfectly 1 channel.
3) Modify the SW to run 8 channels.
4) Add a simple comm protocol.
5) Develop a master controller that is wireless capable.
6) Develop laptop SW to wirelessly connect with your piano so you can run any number of tuning tools to be developed.

I'm sure there are going to be aesthetics about this whole thing. I can well imagine some players being fundamentally horrified about electrical switches knobs or dials on a Piano as I try to picture any location you might put them whereas, wireless kinda 'leaves the piano alone', even in the makers artisan's eyes.

Keith Cress
Flamin Systems, Inc.-
 
You could do the PWM by reading a bank of ram using a free running counter on the address lines.

[ I've done somthing similar, pwm-ing stepping motors using a 20kHz counter to run the low address lines and strobe continuous reads from an eprom, with the actual (sorta micro) steps done by manipulating the high address lines to select 'banks' of preprogrammed pwm patterns. It produced 16 sorta- micro steps per full step, but I couldn't make the step angles perfectly equally spaced because of detent torque. ]

You could interpose writes between the read cycles, or double the ram, bank-swap it and write it twice to keep it up to date.



Mike Halloran
Pembroke Pines, FL, USA
 
When the piano wires vibrate, they're suddenly moving quite quickly in air. The wires will instantly start to cool-off because of the 'breeze' caused by their oscillatory self-movement. This air-flow will remove the heat and tighten the wire.

In other words, there's going to be a rising pitch with each note. Even if the control loop is super fast, it would be a warble. If the control loop was mind-bendingly fast (many kilowatts of peak power), then it would still be a spread-spectrum note with a peculiar sound.

You could either coat the wires with some sort of newly-invented high-tech thermal insulation (an invention probably worth trillions of dollars by itself). Or perhaps apply a vacuum to the inside of the piano (but you'd have to keep the piano lid closed...).

Ignoring all the above negativity... ;-)

Is there some way of making the 256 channel count into a 16x16 matrix and thereby reducing the I/O count to 32?

Hmmm...

 
I'll have to repspectfully disagree with you since I've already built it and it works fine. Apparently any effects the vibration has on heat transfer are negligible, since it generally behaves thermodynamically the same as if it were still.

I like your matrix idea. I'll have to give it some more thought. Too bad you can't connect directly to the bits inside a RAM. Maybe some type of display driver??

Don
Kansas City
 
16 high side outputs (drivers) and 16 low side sinks (think open collector 'outputs'). 256 strings connected at the intersections. Each string is individually addressable.

Do everything digitally (on/off) in the time domain. With this few signals, the processor should be able to buzz through them all pretty quickly.

If you need a speed boost, you can address multiple wires at once provided you choose the combinations carefully so that they don't get in each other's way. Probably need a preprogrammed table to do this efficiently.

PS: I'm glad that the basic idea does actually work.

 
One problem with the matrix concept I described is that the duty cycle when power is applied to each string has to go down. You'll need lots more peak power, and a pretty high frequency to hide the low duty cycle. Probably need a radio transmitter license for the beast.

 
Here's a though that you might jump on;

rather than heat the strings, anchor the stings to a carrier which would have a short heated section. The latency of the anchor could be engineered to provide latencies that could be managed by PID loops.
 
If you want to pursue the shared memory acces thing; In the past I've run DMA circuits on earlier 8 bit machines where the main CPU has bus access on phase 1 of the clock, whilst seconday CPUs shared phase 2 of the clock. Yet another method is to divide down a master and stretch one multlpe out. During this stretched clock interval, external devices can clock in for shared bus activities.

Yet another idea is rather than PWM, you can write out a byte into a resistor network which will give you stepped power command.
 
The moving string has no problems with getting cooled because the sting is mostly radiantly heated. Moving back and forth in the same radiant/convective field, like if you ran around under a heat lamp.

eromlignod; Do you have to heat each of the strings in a triplet?

Don; That Micrel part would work fine.

Check out this part too. It's an SPI digital bus part.


You might search out "executable high voltage shift register" in the hope that you could directly drive your heaters.

Keith Cress
Flamin Systems, Inc.-
 
Thanks for all the ideas. This is such a friendly group.

Itsmoked:

I like the idea of the built-in power electronics, but I need a lot of current. The average string has a resistance of about 0.5 ohms and takes about 2 or 3 watts to tune, so at just a few volts, the current gets pretty high. Even if I found one, it would have to cost less than the other chip + the FET's.

Automatic2:

I like the idea of running the two processors on opposite clock phases. I guess this would obviate the need for interrupts and busy signals?

Don
Kansas City

 
(Another competing technology is piezo-driven actuators. Basically, a pair of crystals are used in I-Q mode to drive a mechanism one way or t'other depending on the phasing. Linked to a screw thread they can move things with very, very, very fine control. But Don's heating concept has no moving parts and should be much cheaper to implement. But something with a screw thread might remain in tune even with no power applied.)

I think it's pretty obvious that the 16x16 matrix concept would have tremendous cost advantages over the 256 parallel approach.

The question becomes: how many milliseconds will a string remain in tune after the power is cut before you need to revisit that string with another blast of power? And what resolution is required for the width of the power pulse so that the string remains in tune over the longer term?

Also, thinking a bit more about the peak power, the matrix shouldn't be much different than doing it in parallel. The applied voltage would be more like tens of volts instead of 3 volts, but that's not at all difficult. Considering the likely timing and power, all you'd need is a supercap to smooth of any remaining current pulses.

The strings will have to be electrically isolated at both ends. The far end of the strings will be connected in groups of 16 and those 16 return wires (not too bad a count) will run back to the driving circuit. The near ends will have to be arranged in counted-off groups 1-16 repeated, then those 16 high side wires will run back to the driving circuit.

The matrix leads to a lower pin count but would require a processor with higher performance to accurately calculate and count-off the required pulse widths. Fortunately that is exactly what most processors are these days. Trading off a higher clock speed for an 8:1 reduction in I/O pin count and high power drivers/sinks seems very attractive. uSecond resolution of the power pulse width should be easy these days.

Now, how to achieve a similar reduction on the other side of the circuit (256 excitation/sensing coils, etc.)? Another 16x16 matrix with the coils at the intersections?

Also, I'd be tempted to provide a closed loop so that the piano could stay in perfect tune during a performance. Just measure the frequencies (intelligently) from the sensing coils and update the table.

Give this thread a star for being the most interesting application of technology recently.

 
Thanks for the star.

Actually, I have the sensor end worked out. I use an FPGA. The sensors put out a 5V square wave at the frequency of the string vibration (I square them with LM339 comparators). I just feed them into the inputs of the FPGA and have 256 independent 16-bit counters inside. Basically I measure how many cylces of a 22 MHz clock happen during one cycle of the string (rising edge to rising edge) using the string signal as a gate for the counter. Then I strobe this number into a 16-bit register and clear the counters before the next rising edge of the gate. All the counters run continuously.

I mux all the 16-bit vectors down to one bank of 16 ouput pins, using 8 input pins as the address. So the main MCU puts out an 8-bit address indicating which string it wants to read and the period of the wave of that string appears on the 16 data pins from the FPGA. I use this number for my PWM calculations.

I was actually pretty proud of myself for getting the FPGA (Xilinx Spartan-3) to work, since I'm just an ME.

I haven't picked out a main MCU yet, but I'm thinking about a Rabbit 3000.

...now I have to figure out my PID algorithms...ugh!

Don
Kansas City
 
Certainly in this case, "... just an ME" does you a disservice.

That's a really neat hack.



Mike Halloran
Pembroke Pines, FL, USA
 
This thread started with a question about shared memory.

As often the case, the real problem was something else, mostly I/O and speed. And, for that, there are many different solutions. The matrix approach reduces the I/O problem and the Propeller micro mentioned by IR in his 10 Mar 07 12:31 post definitely reduces the speed problem. See
I recommend everyone to have a look at this marvellous machine! It runs eight parallel 32-bit processors at up to 80 MHz/processor. The processors share a common RAM area and all processors have equal access to the 32 I/O:s that exist in the 40 pin package. You are probably not willing to believe that such a machine exists in such a small package and at such a low cost (less than 20 USD in single quantity) - but it does exist and it is being shipped.

It has a high-level language that is very clean and it has an assembler which also is clean and efficient. I have come to like it a lot and, I am really sorry to say this, I have left the ARM processors and the FORTH language for this new beauty.

And, yes, almost forgot to mention that each processor has two independent 32 bit counters with lots and lots of modes that makes the implemention of UARTS, D/A and A/D converters, SPI, I2C, CAN(?) controllers a snap. Mostly, there's code for it already in the application library.

I'm in love again...

Gunnar Englund
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...
 
Yes! Two counters in each processor. That is sixteen 32 bit counters (I wouldn't call them counters - tools for building peripherals is more adequate) in each 40 pin package. And, on top of that, there's the system counter to synchronize the eight processors. You owe yourself to learn about it.

Checked pricing - it is 12.95 USD in singles and about 8 USD in 1k lots.

For those that have used Parallax before (I haven't) it must be the way to go when you need to increase capacity in one direction or more.


Gunnar Englund
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...
 
With respect to the matrix, I'd said, "...you can address multiple wires at once provided you choose the combinations carefully so that they don't get in each other's way."

Obviously (in hindsight), you can address up to 16 strings at once in parallel (call them columns) by simply running through the rows. This allows the max duty-cycle to be roughly 1 over 16. So the applied voltage would have to be about 12 volts instead of about 3 volts (helpful squareroot in there). 12 volts is perfectly do-able. Total average power is unchanged.

All you have to do is achieve a sufficiently high revisit frequency so that the string maintains a constant note. That goes back to the question about milliseconds.

This type of 16x16 driver circuit would seem to be dirt cheap.

 
It surely is a dual port device. But I do not think that it is a good solution if you are sticking to the Basic Stamp. The main reason is that you do not have the data and address busses brought out on the Stamp.

I think that you have to face it. Forget about the Basic Stamp. But stick with the Parallax and use my new love - the Propeller. It will do it all for you. It has lots of counters and shared memory built into it, too. Not that you are likely to need it, but it is there if you need it.

Also, the Propeller is a very economical device. Incredible power for that kind of money.

Gunnar Englund
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor