1
Bus Pirate Support / Re: Help reading EEPROM AT93C46 SPI
Below is my mini tutorial :
My Bus Pirate is 3.6 , version 6.xx of the firmware (6.3 beta)
1. my connection (The 3.3 voltage instead 5v can be also used but I have not tested it)
Bus Pirate At93C46
==============================
Vcc 5v = VCC
CS = CS
CLK = SK
MOSI = DI
MISO = DO
GND = GND
and also:
at the At93C46 ORG = GND (it selects 128 x 8 bit mode)
at the Bus Pirate VCC = VPU (required for pull-up)
-------------------------------------------------------------------------------
After connect :
HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)
(1)>7
Set speed:
1. ~5KHz
2. ~50KHz
3. ~100KHz
4. ~400KHz
(1)>4
CS:
1. CS
2. /CS *default
(2)>1
Select output type:
1. Open drain (H=Hi-Z, L=GND)
2. Normal (H=3.3V, L=GND)
(1)>1
Clutch disengaged!!!
To finish setup, start up the power supplies with command 'W'
Ready
3WIRE>W
POWER SUPPLIES ON
Clutch engaged!!!
3WIRE>P
Pull-up resistors ON
3WIRE>l
MSB set: MOST sig bit first
example of commands (don't worry explanation is below):
[0b10011000 0][0b101;3 0;7 0xE7;8][0b10000000 0][0b110;3 0;7 r;8]
[0b110;3 0;7 r;8]
[-^^_^ _^:7 r]
[-^^_^_^^^^^^^ r]
First one: enable write, write 0xc1 at address 0 , disable write , read what was written
About hardware: pin ORG at chip connected to GND it is choice of mode: 128 x 8 bytes rather the 64 x 16 bit word
Reading an writing requires the pull-up resistors -happily Bus Pirate has the feature to use it
VCC connected to VUP , opend drain and commands W and P turn it on.
The At93C46 uses positve CS for enable so the positive CS was selected.
The problem with read and write is that the chip uses rather bits than the whole bytes to communicate sent in MSB LSB order.
Every operation starts with CS ENABLE ,CS DISABLE , we do it with "[ ] "
Read operation example [0b110;3 0;7 r;8] (can be written as [0b11000000 0;2 r;8], or [-^^_^ _^:7 r] etc)
[ means CS select, 0b110;3 is read command, we need to send exactly 3 bits from the binary number 0b110 so ';3' do this job. Then we need to specify the 7-bit address 0;7 is just address 0, 0x10;7 is memory address 16 , then we need to read byte r;8 does it ';8' is necessary because Pirate Bus remembers last used '; ' parameter. ']' finishes job - CS DISABLE - chip know now that we have finished operation.
Writing is a little more complicated -requires two additional commands Write Enable and Write Disable after writing .
[0b10011000 0] enables writing
[0b101;3 0;7 0xE7;8] writes 0x E7 at address 0;
[0b10000000 0] disables writing finishes operation.
The [-^^_^ _^:7 r] and [-^^_^_^^^^^^^ r] are just examples of the reading with manual data and clock steering.
(enable CS([), set 1 [-],accept it with clock tick (^), keep it during next clock tick , set 0 (_) etc etc.
_^:7 just sends seven binary zeros.
Shortly if you need to dump the chip - after wiring and proper initialization you need to use the set of commands like this
[0b110;3 0x00;7 r;8] ... [0b110;3 0x7F;7 r;8] shall do the job.
0x00 - 0x7F is the address space of the EEPROM, The binary bitbang mode of the PB is a little harder to use and it is another story.
I hope it helps.
Artur Babecki