Saturday, March 19, 2022

29F400 Chip installed on the DIP-48 adapter board, planning out the breadboard and arduino setup to write data to the chip

ADAPTER BOARD ARRIVED AND CHIP MOUNTED

I bought a board where I can solder down the surface mount flash chip, TSSOP-48 layout, which then has pins soldered to the back side to create a DIP-48 that can be inserted into a breadboard. I assembled everything and now have it inserted into a breadboard.

Surface mount flash chip now hooked to breadboard

Once the chip is programmed with the data for the IOB6120 board, I can use the hot air tool to remove it, then mount it into place on its permanent position. 

PLAN TO WIRE ADAPTER TO ARDUINO

I can load all the data onto the flash chip by using an Arduino Mega 2560 to drive the 19 address pins, 8 data pins, 2 control pins and read the ready status pin. That only requires 30 pins connected to the microcontroller. There are some other control signals on the flash chip which I can permanently wire to the appropriate logic level, because they don't need to change for the purposes of the file load.

Arduino Mega 2560 to drive the flash chip

DESIGNING ARDUINO CODE TO LOAD THE CHIP

I will be doing direct port manipulation for speed and to switch pins nearly simultaneously. The AT MEGA 2560 processor has a number of byte sized registers which directly control input-output pins. For example, the L port register drives pins 42 to 49 on the board. 

The direction of each port is set by writing to the directional  register for the port. In this case, writing B11111111 to DDRL will set all eight of the pins to output mode. The high or low state of that output is controlled by writing to the PORTL register. Thus, writing B00100000 will turn on pin44 (PL5) and turn off the other seven pins. 

If the pin is an input, it is read by accessing PINL to get the values of the eight pins for the L register. As a subtlety, if you set a pin to input (DDRL for PL7 is set to 0 for input direction), then set the PORTL for PL7 to a 1, it turns on a pullup resistor. I need this because the flash chip RD/BY# signal is an open collector output that needs a pullup to work. 

I have address pins A17 to A10 assigned to the C port, with A17 on PC7 and A10 on PC0. I continue with address bits A9 to A0 assigned to the L port, with A9 on PL7 and A2 on PL0. Finally, address bits A1, A0 and A(-1) are on port B, A1 is PB2, A0 is PB1 and A(-1) is PB0. 

To write an address of x00555 in byte mode, I would set port C to B00000001, port L to B01010101 and port B low end to B010. Which is x00AAA if you string all 19 bits together, just to be confusing. 

To write the data value xAA I would simply write B10101010 to port A which is the port which is assigned to data signals Q7 to Q0 on PA7 to PA0. 

Telling the flash chip that we are sending a command is done by first dropping CE# to 0, soon after dropping WE# to 0, leaving both down for a minimum of 35ns, then raising first WE# and then CE# to 1. This is done by doing an OR of B00100000 and PORTB to PORTB, then an OR of B00010000 and PORTB to PORTB, waiting in a loop, then doing an AND of B11101111 then B11011111 with PORTB to flip off the bits. 

EXPECTED TIMING OF OPERATIONS

The sector erase can take up to 8 seconds of real time to complete, per sector. A write of one byte to the flash can take as much as 300 microseconds. These are in addition to the times it takes to issue the sequence of writes to issue the command to erase or write. Each kilobyte is going to take around a third of a second to write and our file to load is around 128KB in size, thus the loading time is expected to be less than a minute. 

Add another minute or so to erase all the sectors and this is going to be limited mainly by the timing of sending the data file from the PC over USB to the Arduino. All in all, not a very long procedure once I have it working. 

No comments:

Post a Comment