Shop OBEX P1 Docs P2 Docs Learn Events
Propeller programming timing documentation — Parallax Forums

Propeller programming timing documentation

I need to make a stand-alone propeller programmer for our contract manufacturer.

I have found a couple threads about doing this, and some code, but nothing complete.

Is there a detailed document that explains the timing of how to program a propeller ? And to read the contents of the EEPROM back to verify that it programmed correctly.

I've looked in the manual and datasheet, but nothing there...

Thanks,
Bean

Comments

  • There's an object in the OBEX for loading one propeller from another one. Some info may be gleaned from that. Or i guess copy it wholesale, if your standalone programmer is prop-based, too.
  • Here is a comment on how to use Chip's propeller loader, one Prop to another.:
    http://forums.parallax.com/discussion/comment/1295168/#Comment_1295168

    Chip's original thread from 2006:
    http://forums.parallax.com/discussion/86311/propeller-loader
  • Would it be easier to send the CM an EEPROM image? They may already have the ability to program EEs prior to assembly.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-06-04 00:07
    I always have a second row of 4 pins with the prop plug pins to form a 4x2 with 5V and I2C on the other pins. That way I can still use a Prop plug or mostly my own 4x2 serial coms to supply power. However I have at times provided a small programmer that plugs into this connector and programs the EEPROM directly and indicates progress either with simple LEDs or an LCD. I've even retasked a small 1" sq PCB that had serial Flash as a programmer that was powered from the target. As soon as it is powered on it would hold the Prop in reset and program it while blinking the progress LED then verify and indicate success.
    That is about as foolproof as it gets plus it could program an optional serial number into each device (checking it first) and keep track of the ones it had programmed.

    Actually, my pcbs normally have a right-angle 4x2 pin header mounted on the Prop board and my cables have a 4x2 socket header, so the programmer uses a socket header too.
  • zx81vgazx81vga Posts: 56
    edited 2019-06-04 04:49
    @Bean

    have a Look at this

    Greetings from Nuremberg, Germany

    Werner

  • BeanBean Posts: 8,129
    edited 2019-06-04 09:59
    Thanks guys.

    The programmer might be a propeller, but it might not.

    I thought there would have been an app note about this, but I just couldn't find it.

    How do you read-back the EEPROM contents ? I'm pretty sure the Prop tool does that.

    Bean
  • BeanBean Posts: 8,129
    Okay, I guess you can't read the EEPROM contents directly.
    I suppose you have to upload a program to do it in the hub.

    Bean
  • MJBMJB Posts: 1,235
    edited 2019-06-04 15:23
    Bean wrote: »
    Okay, I guess you can't read the EEPROM contents directly.
    I suppose you have to upload a program to do it in the hub.

    Bean

    there is a tool by @PhiPi to upload a stub and download the EEPROM contents from WINDOWS (at least) - sorry I don't have the link here ...

    or as Peter said - If you provide the headers you can read/program the EEPROM directly
  • BeanBean Posts: 8,129
    I had to break out the oscope, but I think I got it working.

    The spin code is slow enough that some of the delays are implied. Had to add explicit delays to make it work.

    Thanks guys....

    Bean
  • JonnyMacJonnyMac Posts: 9,102
    edited 2019-06-04 17:22
    Bean wrote: »
    Thanks guys.

    The programmer might be a propeller, but it might not.

    I thought there would have been an app note about this, but I just couldn't find it.

    How do you read-back the EEPROM contents ? I'm pretty sure the Prop tool does that.

    Bean

    What I was suggesting is that your CM might have a production EEPROM programmer that would program and verify the image before putting into the assembly.

    EEPROM verification by the Propeller is done using a checksum that is part of the EE image. This is a bit of code I wrote from a project that allows pre-compiled code to be loaded from an SD card. It duplicates the EEPROM verification process.
    con
    
      PGM_MEM  = $8000 - ee#PG_SIZE                                  ' protect upper page of EE
      BUF_SIZE = ee#PG_SIZE                                          ' page writes are fastest
    
    
    var
    
      long  buf1[BUF_SIZE >> 2]                                     ' long align (for longfill, word/byte access)
      long  buf2[BUF_SIZE >> 2]
    
    
    pub load_eeprom(p_filename) | check, dbase, eeaddr, cs, p_buf
    
    '' Loads binary image file into eeprom.
    '' -- performs checksum validation on EEPROM
    
      check := wav.open_file(p_filename, "r")                       ' attempt to open file
      if (check <> 0)
        return false
    
      wav.rd_buf(@buf1, 16)                                         ' read initialization values
      dbase := buf1.word[5]                                         ' get DBASE (start of stack)
    
      wav.open_file(p_filename, "r")                                ' re-open file (resets file pointer)
      eeaddr := $0000
    
      repeat
        longfill(@buf1, 0,  BUF_SIZE >> 2)                          ' clear buffer
        check := wav.rd_buf(@buf1, BUF_SIZE)                        ' read block from file
        ee.wr_block(eeaddr, BUF_SIZE, @buf1)                        ' write to eeprom
        eeaddr += BUF_SIZE                                          ' update ee address
        if (check < BUF_SIZE)                                       ' if partial block
          quit                                                      '  we're done
    
      wav.close_file
    
      longfill(@buf1, 0,  BUF_SIZE >> 2)                            ' clear buffer
      repeat while (eeaddr < PGM_MEM)                               ' clear rest of non-protected eeprom
        ee.wr_block(eeaddr, BUF_SIZE, @buf1)                        ' write 0s to vars/stack space
        eeaddr += BUF_SIZE                                          ' update ee address
    
      ee.wr_long(dbase-8, $FFF9_FFFF)                               ' write initial stack frame
      ee.wr_long(dbase-4, $FFF9_FFFF)
    
      ' verify eeprom checksum
      ' -- checks entire image
    
      eeaddr := $0000                                               ' reset eeprom address
      cs := $00                                                     ' clear checksum
    
      repeat while (eeaddr < PGM_MEM)                               ' loop through 32K
        ee.rd_block(eeaddr, BUF_SIZE, @buf2)                        ' read block from eeprom
        p_buf := @buf2                                              ' point to buffer
        repeat BUF_SIZE                                             ' iterate through buffer
          cs += byte[p_buf++]                                       ' add byte to checksum
        eeaddr += BUF_SIZE                                          ' update address
    
      return (cs.byte[0] == $00)                                    ' return true if cs.0 is $00
    
  • tritoniumtritonium Posts: 543
    edited 2019-06-04 17:36
    Hi

    found this in my prop pdf's folder

    This is the protocol used to program the prop from a PC as I understand it.
    This I do via a usb serial device.
    But I 'thought' they were only good for asynchronous serial protocol- not serial bit streams without start and stop elements. So obviously I'm wrong- so where do I find how to use these usb serial devices in this 'bit bang' mode?

    Dave
  • jmgjmg Posts: 15,173
    tritonium wrote: »
    But I 'thought' they were only good for asynchronous serial protocol- not serial bit streams without start and stop elements. So obviously I'm wrong- so where do I find how to use these usb serial devices in this 'bit bang' mode?
    No, you are right the first time. Whilst the stream is not classic UART signaling, because the Prop1 Oscillator is not well enough calibrated, it is made such that a uart can be used by sending '0' or '00'.
    In the examples, varying number of payload bits are sent per UART byte. Calibration is 2 payload bits per byte. and full data can be packed up to 3 payload bit per byte
    eg ====\_._/=\_._/=\_._/=.=.

  • @jmg
    No, you are right the first time. Whilst the stream is not classic UART signaling, because the Prop1 Oscillator is not well enough calibrated, it is made such that a uart can be used by sending '0' or '00'.
    In the examples, varying number of payload bits are sent per UART byte. Calibration is 2 payload bits per byte. and full data can be packed up to 3 payload bit per byte
    eg ====\_._/=\_._/=\_._/=.=.

    Oh I LOVE it!

    to me that is genius.

    Thanks

    Dave
  • tonyp12tonyp12 Posts: 1,951
    edited 2019-06-04 23:36
    I ended up prefilling the buffer with ‭0x92 (% 10010010)
    reading 8 bits of spin code while running a rolling uart bit inserts.‬
    decimal 1, 8, 64 is added in: startbit-1x01x01x-stopbit
    Novice code as I just learned C# that week.

            byte bit = 1; 
            uint buffcnt=0;
            for(j=0; j<258; j++){;buffer[j]=0x092;}             // fill buffer with $92
            for(j=0; j<76; j++)
            { 
                for(i=0; i<8; i++)
                {
                    if ((SpinCode[j] & 1<<i) == 1<<i)          // check if bit is set
                    {
                      buffer[buffcnt]+=bit;                    // turn a %100 in to a %110 
                    }
                    bit<<=3; if(bit==0){; bit=1; buffcnt++;}   // rolling bit if shifted out to zero, move on to next byte
                } 
            } 
    
    https://forums.parallax.com/discussion/138549/c-prop-serial-boot-loader-example-for-the-silabs-cp2110
  • BeanBean Posts: 8,129
    Dave,
    Thanks !!! That is exactly what I was looking for.

    Bean
  • Bean wrote: »
    Dave,
    Thanks !!! That is exactly what I was looking for.

    Bean

    Maybe this could be interesting for you.
Sign In or Register to comment.