Shop OBEX P1 Docs P2 Docs Learn Events
Bootloader idea.....possible? — Parallax Forums

Bootloader idea.....possible?

WBA ConsultingWBA Consulting Posts: 2,935
edited 2010-06-23 21:26 in Propeller 1
We have a product we make at work that utilizes an MSP430 processor that has 3 firmware sets programmed into it. To cycle between the firmware programs, you cycle power X amount of times. IE: Cycle power 1, 2, or 3 times and it runs the default program. Cycle power 4 times and it runs a diagnostic firmware. (the 4 times guarantees it is not reset by accident in the field and ends up in diagnostic mode).

Anyhow, I thought of using this method for the prop, since it only requires a power switch to select what program it runs. Here are my thoughts on the bootloader, but would it work?

1) Load EEPROM with bootloader program
2) Upon power up, a counter value is incremented in a location on the EEPROM
3) Config LED is lit and X amount of time passes (this is where the power cycle would need to occur)
4) Config LED is turned off, Counter value in EEPROM is set as program number, and EEPROM counter value is set back to 1
5) Program number is loaded from SD and ran (1=default)

So, if you power cycle the unit (or hit reset) while the config LED is lit one time, the counter value would be 2 and the 2nd program would be ran from the SD.

Another idea is to use a 128K EEPROM and store multiple programs in the upper area. Is that possible also?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
PowerTwig Dual Output Power Supply Module
My Prop projects: Reverse Geo-Cache Box, Custom Metronome, Micro Plunge Logger

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-06-23 21:23
    We ran into this when designing the Prop-based S2 robot. The old Scribbler has a reset button that can be used to select a program by pressing it multiple times using EEPROM similarly to what you describe. But the BS2 it's based upon comes out of reset very quickly, compared to the Prop's half-second or more. For this reason we decided to make the S2's "reset" button just an input that is monitored by a background cog that counts the number of button pushes within a given timeframe, writes the count to EEPROM, then resets the chip. When the Prop comes out of reset, it reads the EEPROM (then zeros it), to see if the reset was from a button sequence (count > 0) or from a power on or DTR->nRST (count == 0). From there, it decides what it needs to do.

    You don't need any kind of special bootloader to make this work. You just need a single program with a decision tree at the beginning to select the proper action.

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-23 21:26
    Yes to all. There are several EEPROM loaders that could do it. The one that's part of FemtoBasic (sdspiFemto.spin) can do what you want. Look at the "bootEEPROM" routine. All you have to do is to provide the address of the 32K block to be loaded plus "bootAddr" to indicate that the EEPROM is on I/O pins 28/29. A 128K EEPROM would allow for 3 programs in addition to the default program. You can attach up to 4 x 128K EEPROMs to I/O pins 28/29 for a total of 15 programs plus the default one.
Sign In or Register to comment.