Prop Loader
Humanoido
Posts: 5,770
I'm trying to get this simple loader to work. It only loads the first prop, and flashes the LED on the first prop. I put the LED on pin 15 and followed Chip's comments in PropellerLoader.spin (see quote below). The schematic is posted here along with comments by Ariba:
http://forums.parallax.com/showthread.php?130422-puzzle-Quine-in-Spin/page2
Chip Gracey's PropellerLoader.spin object is found here:
http://obex.parallax.com/objects/61/
Chip's comments: This object drives the other Propeller's RESn line, so it is recommended that the other Propeller's BOEn pin be tied high and that its RESn pin be pulled to VSS with a 1M resistor to keep it on ice until showtime.
http://forums.parallax.com/showthread.php?130422-puzzle-Quine-in-Spin/page2
Chip Gracey's PropellerLoader.spin object is found here:
http://obex.parallax.com/objects/61/
Chip's comments: This object drives the other Propeller's RESn line, so it is recommended that the other Propeller's BOEn pin be tied high and that its RESn pin be pulled to VSS with a 1M resistor to keep it on ice until showtime.
OBJ loader : "PropellerLoader" PUB LoadPropeller dira[15] := 1 'LED on outa[15] := 1 waitcnt(clkfreq + cnt) 'wait a second loader.Connect(0, 1, 2, 1, loader#LoadRun, 0) 'reproduce code on next Propeller
Comments
For this circuit the RESn must be high if the previous chip not pull it to low to make a reset, so just use the normal Reset connection: BOEn to VSS and RESn to P0 of the previous chip.
Andy
I've tried it with 2 Propellers (first programs the second, no loop) and found that the PropellerLoader works not with the internal 12MHz RCfast oscillator. But if you connect a crystal to every Propeller chip and set PLL mode x 4 or higher - it seems to work!
Andy
Here is the setup:
Prop1 pin 0 to Prop2 RESn
Prop2 RESn to 1M resistor to Vss
Prop1 pin 1 to Prop2 pin 31
Prop1 pin 2 to Pop2 pin 30
Prop2 BOEn to Vdd (3.3V)
LEDs on pin 15 both Props
run the program
Prop1 LED lights about 2 seconds and goes out
Prop2 LED lights on for a fraction of second and out
Why does the second Prop's LED quickly go out?
Can you show the new wiring?
waitcnt(40_000_000 + cnt)
I don't know why the timing is not working in the second prop but perhaps the key is in the understanding of the Propeller Loader object.
I tried adding a crystal to each prop and have the same problem. Prop one loads the program and its LED comes on for a total of approx. 3 seconds and goes out. After the first 2 seconds, Prop 2 has its LED switch on, for less than one second.
The only reason I can see the LED on at prop 2 is because I added a delay at the end of the code. Take away the delay and LED 2 never lights. Obviously it is not loading or running the code properly in prop 2.
I tried the circuit with and without the 1M resistor from RESn to Vss
and BOEn to 3.3V and this did not fix the problem.
I tried the code examples that you are trying here. I was only able to get them to work when I put a repeat forever at the end of the code (to keep the cog alive).
Without the repeat, I could not see a LED turn on.
What happens now is that the first Prop loads the code into the second, then terminates its code and tri-states all pins. So with a 1M pulldown the second Propeller resets immediatly.
Either you wire the 1M to 3.3V or you put a repeat at the end of the code, so the Propeller keeps its outputs, or you use the normal reset circuit with BOEn to VSS and no resistor at RESn.
Other than the reset you have the same wireing as I had at my test. The LED of the second goes on if the LED of the first goes off, and stays on for 2..3 seconds. This means for me: The second Prop was loaded with the correct code and started.
Andy
To load up the code, the propeller crystals are not needed.
With the 5mhz crystal, it runs at 14ma and with the rc timing only 4ma.
For those of you putting together large numbers of props,
it's possible to adjust the power draw.
Keeping the Cog alive will maintain 4ma draw using the rc method.
This code loads and runs the next prop in only 3 seconds.
The next step is to add another propeller chip and get that working.
I was thinking the same before I tried it. And for sure the receiving Propeller don't need a crystal. But the Propeller which sends the code to the next needs more speed than 12 MHz, otherwise the sent pulses are to long to be detected correct by the bootloader in the ROM. So the first Propeller needs a crystal to run with min. 20 MHz. If you want a chain that reloads always the next chip then all Propellers need a crystal.
Andy
And why could not you use each prop to provide a clock for the next, so that the first is clocked off of the crystal and the second of a software clock running in the first, and each additional Prop has its xin hooked to the xout of the one before it? Using a soft clock source, and assuming the first Propeller is running at 80MHz, you could generate a 5MHz clock and still have 10 MIPS to do something else (as long as you code carefully), thus you only lose half of a cog for any number of Propellers (as only the first Prop needs to provide a soft clock).
Yes you can do this as long as the first Propeller is still running after loading the second Propeller. But if the first Prop stops all cogs or goes in a reset then the clock for the second Prop stops. So it depends on the application.
You can even use the XO pin (connected to the crystal on the first Prop) wired to the XI pin of the next Propeller, you don't need an IO pin for that.
Andy
True. I was thinking about a good clean square wave. And if your system is not designed to reset a Propeller and one resets is not there a more serious issue than the clock source? though I whas thinking of using some code like this in cog 0 (after you have loaded the loader for the next prop into another cog).
But for other applications this may be a good solution. You can generate a clock much simpler than your assembly loop, just with the use of a counter: You even don't need another cog.
Andy
Andy
I tried all these versions and could not get the second prop's LED to light.
The second prop's LED comes on for about 1 second and goes out.
So is something not working correctly with the timing?
There are no crystals and both props are wired according the original
post schematic (in post 1 of this thread). Is anyone having different results?
I simply put a timing routine in the code and it responded correctly with both props.
So one version runs with the crystals and one version without.
This is with two props. Next, I will try adding more props.
Very nice Andy. Thank you. Your help with this is greatly appreciated!
The Loader is made to load one Propeller. You may be able to load more Propellers in parallel, but you should connect only one from P30 to P2. Otherwise there is a short circuit of all the P30s if they not send exactly the same data at the same time (which is unlikely, because of the different RCfast frequencies). This means only one can send the Acks and you don't know if the others have succesfully loaded the code.
How many can be loaded? I don't know. But many! The limiting factor is the capacity of the parallel P31 pins.
Andy
Andy, thank you. For the new parallel circuit, I have the first prop with P2 connected to the second prop's p30. The remaining props have p30 unconnected. I modified the program to blink LEDs on all props in unison (after one cycling of the loader). If there is any timing difference, I cannot notice it after hours and hours of blinking. All the props appear to be in perfect sync.
I really wonder what that capacity is! I have a circuit working with a total of five props in parallel. Circuits need to be transferred to some good breadboards to keep adding props. What I like about this system is the simplicity, both in the demonstration code and in the wiring. If the system can handle lots of props (the overall goal), it will be very useful for many apps. I will post the parallel loader circuit schematic and code soon.