Show Posts
Pages: 1 2 [3] 4 5 ... 73
31  Using Arduino / Storage / Re: Building a working flash memory programmer. on: December 04, 2013, 05:47:44 pm
Now for a routine that makes use of these previous routines.

To read the Manufacturers ID and the Device ID requires a sequence of writes and then a 2 reads to collect this information. The sequence  is as follows -
At address 0x5555 write 0xAA,
at address 0x2AAA write 0x55,
at address 0x5555 write 0x90,
then do a read from address 0 to obtain the Manufacturer ID,
 and a read for address 1 to obtain the Device ID
and then to exit the ID mode write 0xF0 to any address.

From my experience - if you fail to write 0xF0 to close out the Device ID mode future reads may give random results.

Code:
void DeviceID()
{
   byte WorkByte;
   Serial.println();
   Serial.println("Device Identification");
   Serial.println();
   DoWrite(0x5555L,0xAA);   // First output byte of Software ID Entry
   DoWrite(0x2AAAL,0x55);   // Second output byte of Software ID Entry
   DoWrite(0x5555L,0x90);   // Third output byte of Software ID Entry
   WorkByte = DoRead(0L);
   if (WorkByte == 0xBF)
   {
      Serial.println("Chip Manufactured by SST");
   }
   else
   {
      Serial.println("Unkmown manufacturer");
   }
   WorkByte = DoRead(1L);
   if (WorkByte == 0xB5)
   {
      Serial.println("SST39SF010");
      Serial.println("128Kx8 Device");
      Serial.println("131,072 Bytes");
   }
   else if (WorkByte == 0xB6)
   {
      Serial.println(" SST39SF020");
      Serial.println("256Kx8 Device");
      Serial.println("262,144 Bytes");
   }
   else if (WorkByte == 0xB7)
   {
      Serial.println(" SST39SF040");
      Serial.println("512Kx8 Device");
      Serial.println("524,288 Bytes");
   }
   else
   {
      Serial.println(" Unknown Device");
   }
   Serial.println();
   DoWrite(0x5555L,0xF0);   // Exit ID Mode
}
32  Using Arduino / Storage / Re: Building a working flash memory programmer. on: December 04, 2013, 05:30:25 pm
Now for the start of the general purpose routines.

To start with - LoadAddr.

This function takes an unsigned long value and uses it to set the Address Lines for any read or Write function.
This function would need to be re-arranged if I wer to use a standalone 1284 and use the Mighty 1284 board rather than the Bobuino.

Because the lowest 8 address bits are all assigned to PORTC I just copy the lowest 8 bits to that port and then use shifts to move the rest of the bits into the address lines.

Code:
void LoadAddr(unsigned long AddressL)
{
   unsigned long workAddrL;
   workAddrL = AddressL;
   PORTC = workAddrL & 0xFF;
   workAddrL= workAddrL >> 8;
   digitalWrite(AB8, workAddrL & 1);
   workAddrL= workAddrL >> 1;
   digitalWrite(AB9, workAddrL & 1);
   workAddrL= workAddrL >> 1;
   digitalWrite(AB10, workAddrL & 1);
   workAddrL= workAddrL >> 1;
   digitalWrite(AB11, workAddrL & 1);
   workAddrL= workAddrL >> 1;
   digitalWrite(AB12, workAddrL & 1);
   workAddrL= workAddrL >> 1;
   digitalWrite(AB13, workAddrL & 1);
   workAddrL= workAddrL >> 1;
   digitalWrite(AB14, workAddrL & 1);
   workAddrL= workAddrL >> 1;
   digitalWrite(AB15, workAddrL & 1);
   workAddrL= workAddrL >> 1;
   digitalWrite(AB16, workAddrL & 1);
   workAddrL= workAddrL >> 1;
   digitalWrite(AB17, workAddrL & 1);
   workAddrL= workAddrL >> 1;
   digitalWrite(AB18, workAddrL & 1);
}

DoRead takes an address as an unsigned long and passes it to LoadAddr() to load the Address Lines and then sets ReadEN and ChipEN LOW and then using the PINA instruction reads the value present on the Data Lines. The it sets ChipEN and ReadEN High and returns the value read.

DDRA = 0 sets PORTA as an input. PORTA = 0 makes sure
Code:
byte DoRead(unsigned long readAddr)
{
   byte readVal;
   LoadAddr(readAddr);
   DDRA = 0;    // set PORTA as all inputs from Flash Data Lines
   digitalWrite(ReadEN,LOW);
   digitalWrite(ChipEN,LOW);
   readVal = PINA;
   digitalWrite(ChipEN,HIGH);
   digitalWrite(ReadEN,HIGH);
   return readVal;
}

DoWrite takes both an unsigned long address and a byte to write to the Flash. The address is passed to LoadAddr() and the byte is loaded into PORTA ,ChipEN and WriteEN lines a re set to LOW and then ChipEN and WriteEN are set back to HIGH.

Code:
void DoWrite(unsigned long writeAddr, byte writeVal)
{
    LoadAddr(writeAddr);
    DDRA = 255;    // set port A as all outputs to Flash Data Lines
    PORTA = writeVal;
    digitalWrite(ChipEN,LOW);
    digitalWrite(WriteEN,LOW);
    digitalWrite(ChipEN,HIGH);
    digitalWrite(WriteEN,HIGH);
}

These are the common routines that the rest of the program uses to read and write the Flash.
33  Using Arduino / Storage / Re: Building a working flash memory programmer. on: December 04, 2013, 05:10:43 pm
Here's what I have programmed so far -

I'll Start with the configuration information.
This is programmed around an ATMega1284P-PU 40 Pin DIP Device. A total of 32 I/O lines with 2 of them used as Serial 0, leaving 30 free I/O lines.

To the Arduino 1.0.5 environment I added the mighty-1284p hardware information and I am using the Bobuino board configuration.

When referring to the Address or Data busses I am referencing the socket for the SST39SF  type Flash Memory.

The Data Buss uses PORTA on the 1284 which corresponds to Pins D14 through D21 on the.Bobuino. (also serve as analog pins)

the lower 8 bits of the Address buss correspond to PORTC which is pins D22 through D29.

The three remaining pins are the 3 enable pins. On this type of memory device the are an ACTIVE LOW signal, meaning that the signal is active when at zero volts  and inactive at 5 volts. ReadEN and WriteEN both work with ChipEN to control the memory.

Code:
// Address bits -
// bits 0-7 are PORTC
// Because this board is using BOBUINO pinouts
//
int AB8 = 2;
int AB9 = 3;
int AB10 = 4;
int AB11 = 5;
int AB12 = 6;
int AB13 = 7;
int AB14 = 8;
int AB15 = 9;
int AB16 = 10;
int AB17 = 11;
int AB18 = 12;


int ChipEN = 13;
int ReadEN = 30;
int WriteEN = 31;


The Setup Function -

Setup configures the various pins to communicate with the Flash chip. The Control Lines and Address Lines are always writing to the flash so they are easy to configure as outputs, along with configuring the Serial port.

Controls Lines are set to 5 volts and all the address lines are set to 0zero volts  to begin.

Code:
void setup()
{
   Serial.begin(115200);
   
   // set control signals to HIGH
   pinMode(ChipEN,OUTPUT);
   digitalWrite(ChipEN,HIGH);
   pinMode(ReadEN,OUTPUT);
   digitalWrite(ReadEN,HIGH);
   pinMode(WriteEN,OUTPUT);
   digitalWrite(WriteEN,HIGH);
   
   // configure the address lines
   DDRC = 255;
   PORTC = 0;
   pinMode(AB8,OUTPUT);
   digitalWrite(AB8,0);
   pinMode(AB9,OUTPUT);
   digitalWrite(AB9,0);
   pinMode(AB10,OUTPUT);
   digitalWrite(AB10,0);
   pinMode(AB11,OUTPUT);
   digitalWrite(AB11,0);
   pinMode(AB12,OUTPUT);
   digitalWrite(AB12,0);
   pinMode(AB13,OUTPUT);
   digitalWrite(AB13,0);
   pinMode(AB14,OUTPUT);
   digitalWrite(AB14,0);
   pinMode(AB15,OUTPUT);
   digitalWrite(AB15,0);
   pinMode(AB16,OUTPUT);
   digitalWrite(AB16,0);
   pinMode(AB17,OUTPUT);
   digitalWrite(AB17,0);
   pinMode(AB18,OUTPUT);
   digitalWrite(AB18,0);
 
}

34  Using Arduino / Storage / Re: Building a working flash memory programmer. on: December 04, 2013, 04:28:55 pm
Hey Crossroads - Here's where I come up with that -

On the Bobuino  PORTB goes like this - Pin 1 D4, Pin2 d5, pin3 D6, Pin4 D10, Pin5 D11, Pin6 D12, Pin7 D13
and on PORTD Pin1 RX0, Pin2 TX0, Pin3 D2, Pin3 D3, Pin4 D30, Pin 5 D8, Pin6 D9, Pin7 D31.

As is, I got a few wires mixed up and I was just going from PinX on the Crossroads Bobuino board to PinY on the flash chip.  By not trying to sort out the pins at this time I felt I had a higher degree of possibility of not getting myself confused and haveing it work, WHICH IT NOW DOES!!! I have successfully WRITTEN, READ and Erased a Sector of the flash. 90% finished.  Took about a week. Now the remaining 10% will take months...

If I used just PORT I/O it would work, but there would be 2 levels of numbers to keep track of the get all the wires in the proper place. If I used a "Standard" pin configuration then the individual PORT groups would not be mixed up in any manner.

Just a matter of the number of things I want to juggle when I am not real sure what I am doing.
As is, I got a few wires mixed up and I was just going from PinX on the Crossroads Bobuino board to PinY on the flash chip.  By not trying to sort out the pins at this time I felt I had a higher degree of possibility of not getting myself confused and having it work, WHICH IT NOW DOES!!! I have successfully WRITTEN, READ and ERASED A SECTOR of the flash. 90% finished.  Took about a week. Now the remaining 10% will take months...


If I make another Flash Programmer ) will get a 1284 and a couple caps, a resistor, a switch and a resonator and make a 1 chip, 1 socket programmer using the "Standard" configuration.

I have attached a drawing I made comparing the pinouts, Bobuino to Standard.
35  Using Arduino / Storage / Re: Building a working flash memory programmer. on: December 04, 2013, 03:38:11 pm
I have previously worked with Direct Port Manipulation on a Stepper Driver I made using an ATtiny2313 so I wanted to use that here wherever possible. Direct Port I/O is faster, but on a standard Arduino the use is limited by other functions sharing the different ports and the ATMega328. On the 1284 configured like a Bobuino, PORTA - which is shared with the 8 Analog pins (A0-A7) and (D14-D21) and PORTC which is digital pins D22-D29.

I assigned the Flash Data pins to PORTA and the lower 8 address bits to Port C.

I can read the chip ID, and I can read chip data.

Reading the chip data is the easiest. Load an address onto the address lines,
    
     digitalWrite(ReadEN,LOW);
     digitalWrite(ChipEN,LOW);
     readVal = PINA;
     digitalWrite(ChipEN,HIGH);
     digitalWrite(ReadEN,HIGH);

I am working on using the "sector" operations. Sectors are 4K blocks of memory. So a sector runs from address XX000 to XXFFFF. So to read secto 0 the command is R00, to read sector stating at 7000 the command would be R07. It will read a 4K sector and send it out the serial port in approx. 10 seconds.

The CHip ID function uses both Write and Read. It writes to a sequence of addresses and then any address ending in 0 will return the Manufactirer ID, and any address ending in 1 will return the Chip ID. The sequence for the Chip ID function is  -
Write to address 5555 the value AA,
write to address 2aaa the value 55,
Write to address 5555 the value 90,
then read from and Even address the Chip Manufacturer ID,
and from and Odd address the Chip ID.
and when finished send 0f to any address to exit Chip ID Mode.

These 2 functions are Non-Destructive, but when the Chip-ID function works properly then all programming steps should also work.



    

36  Using Arduino / Storage / Building a working flash memory programmer. on: December 04, 2013, 12:58:17 pm
I am working on making a z80 based CPM computer based on the design from Grant Searle - http://searle.hostei.com/grant/ - and have been studying up what would be needed to make a go of it. With the passage of time some electronic devices have gotten more expensive, and some have gotten cheaper. For a ROM, the current cheapest way that I could find for a 1-off board is one of the 128Kx8bit memories. An SST39SF010A is only $1.66US at Digikey, and a 628128 128Kx8bit RAM is $2.15US.

NOTE: This programmer will never be a standalone device. A goal is that I could send it a IntelHex file and it would read each line and write it to the flash, with the PC based program checking for addresses used, and offsets I might want to put on the data (more than 1 ROM image on a chip for testing/playing) In this case the Erase and write and verify could be automated.  The other possibility is that I would send data to it in a binary mode which would be dependant on a program in another computer to send it address and data.

The biggest problem is this - How do I program one of these Flash ROMS? And it turns out it is really rather easy. I started out with a design that uses an Arduino and 3 74595 shift registers, and then I dug out a board that I had put together a while back - ATMega1284P-PU 40 pin DIP based board that Crossroads pproduced and I bought a bare board form him. Here's the where the conversation can be found - http://forum.arduino.cc/index.php?topic=80483.0. I hadn't done much with the board for awhile and recently I purchased several USB to Serial converters form DIPMicro and got one of them wired up and working.

So I went from trying to design it with an ATMega328P and 3 supporting 595 shift registers to needing 1 ATMega1284 and no supporting chips.. The ATMega1284 is a 40 pin DIP device with 32 I/O pins, of which can use up to 2 serial ports. In this application I only need 1 serial port so 30 pins are left free. The 8 pins for PORTA are assigned to the Flash's 8 data pind, PORTC is the lower 8 address bits, and because of the way things are defined under the Bobuino the other pins move around so they are not as easy to map to a port. So 2 Serial Port Pins, 8 Data bits, 19 address bits and 3 control bits - (*OE, *WE,*CE) and all the pins are used.
37  Community / Bar Sport / Re: About low-level programming... on: December 02, 2013, 04:59:57 pm
C is known to be dangerous, so most go in expecting trouble. If they don't find it? GREAT!!! But at least YOU WERE WARNED.

C++ was formed by a committee to make C safe. So poor blighters go in expecting a great experience and get devoured by beasts that never have been described. And if one survives, one has know way of knowing how one survived,it's as if all memories were erased.
38  Using Arduino / Storage / Re: Flash Memory Programmer "AM29F040B" on: November 26, 2013, 11:44:27 am
Sector Protect is to keep those sectors from being re-written without first going through the process of clearing the protection bits. That would be used where part of the chip is really ROM and part of the chip is used for parameter storage. Wouldn't want to re-write the ROM, but parameters would need to be changed from time to time.

Chips by different manufacturers will return different ID codes. You need the datasheet for your exact chip. It may not make any difference, but the ID would help flag a chip that is too slow or in some other way might be incompatible. On the other hand it might not make any difference.

Your conditions for the line breaks on your display have a problem. The first line is 17 bytes. Don't know how you are saving this info but that might give you a problem.

Here are a couple pictures of my progress on a programmer. Waiting to get some chips in. Once I have the 595's I can then use a 628128 to begin to test some functions.  The write  routine would have to be different - either that or just be aware that a couple addresses are going to be trashed by the write routine. Read should work just fine. Just do all reads and writes as if it were from the upper half of a 256x8 chip so the CS2 pin is held high...
39  Using Arduino / Storage / Re: Flash Memory Programmer "AM29F040B" on: November 20, 2013, 11:12:31 am
Here's a drawing of the schematic that will work with the programs that PITO created.

If there are any errors,please let me know Pito.

Pito - with your programs - how are you feeding the data to the programmer?
40  Using Arduino / Storage / Re: Flash Memory Programmer "AM29F040B" on: November 20, 2013, 10:03:11 am
You can take a memory chip. put it on a breadboard and wire it fir an address and then wire the *OE to ground and then wire the *CE to ground and it will put the data for that address on the data lines. timing is not a problem.  That timing chart just shows the minimum times. Can't run the chip any faster than those timings. Can run it way slower...

Are you sure what you are putting on the address lines? Verify address inputs before you worry about anything else. If they aren't correct then everything else is a waste of time.
41  Using Arduino / Storage / Re: Arduino as brain for Flash Prom Programmer. (128Kx8, 17 address bits) on: November 19, 2013, 12:54:44 pm
found a better developed discussion of the same topic here -

http://forum.arduino.cc/index.php?topic=194796.0

So that would be the place to go.
42  Using Arduino / Storage / Re: Flash Memory Programmer "AM29F040B" on: November 19, 2013, 12:52:32 pm
Timing is critical when you are trying to run fast - like connected in circuit to a CPU. To read data -t is important that you properly set the address inputs before you try to set the chip selects. * WE or *OE can be set before the *OE. Timings on the chart are generally the minimums - meaning that there is a minimum time from the address line being set before the *CE and then some delay between the *CE before the *OE or *WE have to be stable. But a best practice is set the *OE or *WE at he same time the *OE is set.

To use some of the features - sector erase for instance - you do need to be able to control all address pins.

Thanks for this discussion - I missed it when I asked if anyone had any experience with these devices... I am preparing to build a Z80 CPM single board computer, and maybe even a 65C02 based board to play with.  Will be making a Flash Programmer shield to program these devices.
43  Using Arduino / Storage / Arduino as brain for Flash Prom Programmer. (128Kx8, 17 address bits) on: November 17, 2013, 07:26:57 pm
I am working on putting together the parts for a Z80 based single board computer. Small memory in DIP  type chips is now 128Kx8bit devices. For ram this is no problem, but for Flash Prom it makes it difficult because I have to use 17 address lines in programming and erasing. Nothing to exotic about it, but was wondering if anyone else had tried this.
44  Using Arduino / Motors, Mechanics, and Power / Re: Problem with getting fast speed with heavy load. on: November 15, 2013, 10:25:55 am
If you try to use a stepper motor you have to realize that as speed goes up, the torque goes down. Steppers are not a high speed device. They are designed more for low speed, highly repeatable motion. If you want speed and torque yo need to look at any of a number of SERVO (not hobby servos, industrial servos) . You will need a geearbox as most of them max out near 3000 RPM.
Automation Direct, Yaskawa and Mitsubishi have some of these servo and driver packages, though for on axis it will probably come to $1000US or more. They will have a step and direction input so they will look just like a stepper as far as programming is concerned.
Here's a page showing some options. Automation direct is of decent quality while keeping prices down. No affiliation with the company, I have used their products and have had no problems.
http://www.automationdirect.com/adc/Shopping/Catalog/Motion_Control/Servo_Systems
45  Community / Bar Sport / Re: Not quite available yet on: November 14, 2013, 04:26:36 pm
So far I have been able to use it on XP and Win7, and run the programs on Win8.  I hate the new versions of Visual Studio as it seems they went out of their way to break it and make it as slow as possible. Don't know exactly why they had to screw it up so bad when they went to .net, but VB in that environment is a totally different animal, and much slower to develop with.

Just today I was writing a couple of small programs, one on the survaillence computer at our transmitter, and one here at master control (tv station) to let the operator know when one of the cameras sees something. A total of less than 30 lines of code. Runs the program with the camera name on the command line and passes the that to a computer at the station which logs the event. Tomorrow I have to work on having it ring a bell...
Pages: 1 2 [3] 4 5 ... 73