Shop OBEX P1 Docs P2 Docs Learn Events
Flash programmer — Parallax Forums

Flash programmer

HEi,

I was wondering if anyone attempted to build a Flash programmer (Parallel Flash/EPROM/EEPROM) using the propeller. For some other projects I would like to program some 29F010s. The Prop has not enough RAM but who cares ? Flashing say 16 kBytes per round would be tolerable for some low-volume flashing :).
The question is... If I use the serial port with some FullDuplex Serial and send say a ihex file, will be spin able to keep up ? (155 kBaud) or I'D have to go down to say 9600... dumb question, I don't think does it really matters....

Comments

  • kwinnkwinn Posts: 8,697
    edited 2015-09-10 12:55
    Ale wrote: »
    HEi,

    I was wondering if anyone attempted to build a Flash programmer (Parallel Flash/EPROM/EEPROM) using the propeller. For some other projects I would like to program some 29F010s. The Prop has not enough RAM but who cares ? Flashing say 16 kBytes per round would be tolerable for some low-volume flashing :).
    The question is... If I use the serial port with some FullDuplex Serial and send say a ihex file, will be spin able to keep up ? (155 kBaud) or I'D have to go down to say 9600... dumb question, I don't think does it really matters....

    I'ts possible. I used it to read and program 2716 and 2732 eproms. Probably easier to do for more modern chips than for the oldies that need high voltages for programming. For larger memories you may want to look at using qspi ram chips. Prop downloads the data, stores it in qspi ram, provides address bits to eprom, and steps through qspi ram.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-09-10 13:39
    Ale wrote: »
    HEi,

    I was wondering if anyone attempted to build a Flash programmer (Parallel Flash/EPROM/EEPROM) using the propeller. For some other projects I would like to program some 29F010s. The Prop has not enough RAM but who cares ? Flashing say 16 kBytes per round would be tolerable for some low-volume flashing :).
    The question is... If I use the serial port with some FullDuplex Serial and send say a ihex file, will be spin able to keep up ? (155 kBaud) or I'D have to go down to say 9600... dumb question, I don't think does it really matters....

    Tachyon has the speed and everything in place to do this fairly easily as I am very familiar with programming these devices from back in their day. You could download an Intel Hex file at 2M baud if you wanted or better still, just FTP it or transfer it across on an SD card. To save I/O lines I would just use shift registers for the address lines as these can be updated at a very high rate, especially if you have one for the lower 8-bits that has its own clock and another for all the higher bits although it isn't really necessary either. The SPIWR operation is only a single byte opcode and takes 2.6us for 8-bits.

  • AleAle Posts: 2,363
    I Started to build the flash programmer on a veroboard. And discovered why I haven't been able in late project to program the 24LC256 with the propeller tool... They are 24C256... they need to be powered from 5 V, well let's hope they like the mixed environment.

    Here the circuit I'm going to use.
    1183 x 801 - 50K
  • If the 24C256 is happy with 3.3V as logic high then I would skip the data bus buffer altogether, it is quite redundant as you are driving from bidirectional I/O anyway. Just put series resistors in the data lines in case of contention. That saves a chip and a direction line at the very least.

    The address bus could be driven directly from I/O as well so that even with 19 bits of address, 8 of data, and 3 control lines that will still fit if you use the I2C lines for address lines. When you access the EEPROM the state of the address won't matter. So if you do it this way you just need 8 resistors in addition to the basic Prop circuit.
  • AleAle Posts: 2,363
    The data buffer is there to translate from 5 to 3.3 and viceversa (I'll use a 74LCV245, when they arrive tomorrow or the day afterwards), one could skip it and use resistors... I just do not like the results I get with resistors... I wanted to use a console (VGA+KB) at some point and thought about freeing some pins for that, that's why I added the latch. But there are only 3 unused pins, though, well... let's see what happens when I code it. Maybe OE_245 is not that needed... and I can tie it to GND...

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-09-22 10:24
    For the address I would probably have used a shift register or counter which would only need 2 or 3 lines. The counter approach is fast for sequentially addressing memory while the shift register is better for random access although a 16-bit update can be done in just a couple of microseconds and no need to latch either, just clock and data.

    The datasheet for the 27C256 indcates TTL level compatibility as Vih is 2V, so no need for level shifters.

    As for the console I sometimes just dedicate another Prop for that due to lack of I/O on the main Prop. Just tie your serial comms across so my original suggestion would work fine. You could even slave the programmer Prop from the console Prop if you wanted. Then again serial bluetooth to a phone/tablet is a very handy console.
  • AleAle Posts: 2,363
    Programming the thing gets a bit complicated with all these pins... well.. something like this... I may have to reassign some pins...
    CON
    
    CNT_OE      = 1 << 18
    CNT_WE      = 1 << 21
    CNT_CE      = 1 << 19
    CNT_OE_245  = 1 << 20
    CNT_ALE_573 = 1 << 16
    CNT_DIR_245 = 1 << 17
    CNT_A16     = 1 << 22
    A16_SHIFT   = 22-16             ' shift amount from original A16 to the pin where A16 is output
    
    DAT
    { Assembler programming driver
    
    Supported Flash Memories
    
    Winbond W29C020
    ---------------
    Programming:
    Pages of 128 bytes, start download with [5555] = AA [2AAA] = 55 [5555] = A0
    then write 128 bytes to page A7..A17 and wait 10 ms
    
    
    Write data:
    
    Set Addresses A8..A18
    Latch driving ALE_573 high and then low
    Set Addresses A0..A7
    
    
    }
    
                            org 0
    
    { command processing code still missing }
    flash_seq
    ' sets the address
    ' P0..P7 are set as inputs
    ' P8..P24 are always outputs
    '
    ' Output status
    '
    ' OE_245 = 1
    ' CE = 1
    ' WE = 1
    ' OE = 1
    ' DIR_245 = 1 (Write Flash)
    ' ALE_573 = 0
    ' A0..A18 set flashaddr
    ' D0..D7 (inputs) 
    flash_addr_set          mov     temp, flashaddr                        
                            and     temp, addr_mask_8_15
                            or      temp, PIN_STBY
                            mov     OUTA, temp
                            or      OUTA, PIN_ALE_573
                            nop
                            andn    OUTA, PIN_ALE_573           ' latch A8..A15
    
                            mov     temp, flashaddr
                            and     temp, #$ff
                            mov     temp2, flashaddr
                            and     temp2, addr_mask_16_18
                            shl     temp2, A16_SHIFT
                            or      temp, temp2
                            or      temp, STBY
                            mov     OUTA, temp
    flash_addr_set_ret      ret                        
    
    flash_read_byte         call    flash_addr_set
                            andn    DIRA, #255              ' set D0..D7 to inputs
                            andn    OUTA, PIN_245_READ       ' set 245 to READ (B -> A) and OE
    
                            andn    OUTA, PIN_READ
                            rdlong  temp, #0
                            rdlong  temp, #0
                            mov     flashdata, INA
                            or      OUTA, PIN_READ          ' 16*12,5+7..21*12,5, also for slow memory
                            and     flashdata, #$ff
                            or      OUTA, PIN_245_READ      ' set to write
    flash_read_byte_ret     ret
    
    flash_write_byte        call    flash_addr_set
                            or      DIRA, #255
                            or      OUTA, PIN_DIR_245       ' set 245 to WRITE (B -> A) and OE
                            andn    OUTA, PIN_245_WRITE
                            and     flashdata, #255
                            or      OUTA, flashdata         ' sets output Data BUS
                            
                            andn    OUTA, PIN_WRITE
                            rdlong  temp, #0
                            rdlong  temp, #0
                            or      OUTA, PIN_WRITE         ' 16*12,5+7..21*12,5, also for slow memory
                            or      OUTA, PIN_245_READ      ' set to write, OE = 1
                            andn    DIRA, #255              ' set D0..D7 to inputs
    flash_read_byte_ret     ret                                                                                                        
    
    temp                    long    0
    temp2                   long    0
    curraddr                long    0
    pgmaddr                 long    0
    pgmcmd                  long    0
    pgmstatus               long    0
    pgmstatus2              long    0
    pgmbuffptr              long    0
    flashaddr               long    0
    flashdata               long    0
    addr_mask_8_15          long    $00_00_ff_00
    addr_mask_16_18         long    $00_07_00_00
    
    PIN_ALE_573             long    CNT_ALE_573
    PIN_OE_245              long    CNT_OE_245
    PIN_DIR_245             long    CNT_DIR_245
    PIN_OE                  long    CNT_OE
    PIN_WE                  long    CNT_WE
    PIN_CE                  long    CNT_CE
    
    PIN_STBY                long    CNT_CE | CNT_OE | CNT_WE | CNT_OE_245 | CNT_DIR_245
    PIN_READ                long    CNT_CE | CNT_OE
    PIN_WRITE               long    CNT_CE | CNT_WE
    PIN_245_READ            long    CNT_OE_245 | CNT_DIR_245 ' both low for reading flash
    PIN_245_WRITE           long    CNT_OE_245 | 255 ' used to set data bus        
    
  • I actually started some code to access EPROMS using the 30 direct I/O method mentioned and it won't be complicated at all. It will allow me to "talk" to the EPROM via the serial console and read or dump any part as well as program it from I2C EEPROM after a hex load from the PC. It is just an outline at the moment but this is where I got up to:

    --- I/O assignments
    #P0	== #DATA
    #P8	== #CE
    #P9	== #OE
    #P10	== #WE
    #P11	== #ADDR	--- P29..P11 = 19 BITS, upper address bits shared with I2C.
    
    -1 19 BITS #ADDR <<	== ADRBITS
    
    
    
    pub ADDR ( addr -- )
    	ADRBITS OUTCLR #ADDR << OUTSET
    	;
    pub RDBYTE ( -- byte )
    	$FF INPUTS #OE LOW P@ >B #OE HIGH
    	;
    
    pub WRBYTE ( byte -- )
    	$FF OUTCLR OUTSET #WE DUP LOW HIGH
    	;
    
    pub EPROM! ( byte addr -- )		ADDR WRBYTE ;
    pub EPROM@ ( addr -- byte )		ADDR RDBYTE ;
    
    --- prefix for DUMP commmands - i.e. 0 $1000 EPROM DUMP
    pub EPROM	' EPROM@ dmm W! ;
    
    --- Program the EPROM from src in eeprom - 100us pulse then verify etc
    pub PROGRAM ( src dst cnt -- )
    	ADO DUP BUFFERS $800 ELOAD I $800 ADO 
    	;
    
Sign In or Register to comment.