Shop OBEX P1 Docs P2 Docs Learn Events
loading image from external memory, getting prop to run it — Parallax Forums

loading image from external memory, getting prop to run it

Bill HenningBill Henning Posts: 6,445
edited 2008-02-01 16:06 in Propeller 1
Ok, I tried search.parallax.com, but I could not find how to get the propeller to reset and run something I might load into it under the control of a large memory model loader [noparse]:)[/noparse]

Basically, I need to do a warm boot of the chip so that it will execute the image I load into the hub memory.

I have a vague memory that Chip posted how to do this over a year ago, but I could not find it.

A link would be most appreciated smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-01 05:47
    Don't have the link, but here's the assembly code:
    '
    ' Start up oscillator and begin Spin program at $0010
    ' (assumes EEPROM data already loaded into $0000-$7FFF)
    ' (assumes currently running RCFAST oscillator)
    ' (assumes this is COG 0 - gets rebooted)
    '
                  rdbyte  address,#$0004          'if xtal/pll enabled, start up now
                  and      address,#$F8             '..while remaining in rcfast mode
                  clkset  address
    :delay     djnz     time_xtal,#:delay       'allow 20ms @20MHz for xtal/pll to settle
                  rdbyte  address,#$0004           'switch to selected clock
                  clkset  address
                  coginit interpreter              'reboot cog with interpreter
    
    time_xtal       long    20 * 20000 / 4 / 1      '20ms (@20MHz, 1 inst/loop)
    interpreter     long    $0001 << 18 + $3C01 << 4 + %0000
    address          res     1
    
    


    This is used in the various FemtoBasic versions and the Propeller OS.
  • Bill HenningBill Henning Posts: 6,445
    edited 2008-02-01 16:06
    Thanks Mike - you've got my vote for most helpful guy on the forums [noparse]:)[/noparse]
    Mike Green said...
    Don't have the link, but here's the assembly code:
    '
    ' Start up oscillator and begin Spin program at $0010
    ' (assumes EEPROM data already loaded into $0000-$7FFF)
    ' (assumes currently running RCFAST oscillator)
    ' (assumes this is COG 0 - gets rebooted)
    '
                  rdbyte  address,#$0004          'if xtal/pll enabled, start up now
                  and      address,#$F8             '..while remaining in rcfast mode
                  clkset  address
    :delay     djnz     time_xtal,#:delay       'allow 20ms @20MHz for xtal/pll to settle
                  rdbyte  address,#$0004           'switch to selected clock
                  clkset  address
                  coginit interpreter              'reboot cog with interpreter
    
    time_xtal       long    20 * 20000 / 4 / 1      '20ms (@20MHz, 1 inst/loop)
    interpreter     long    $0001 << 18 + $3C01 << 4 + %0000
    address          res     1
    
    


    This is used in the various FemtoBasic versions and the Propeller OS.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.mikronauts.com - a new blog about microcontrollers
Sign In or Register to comment.