Have a look at the pickit serial analyser. It may give you the flexibility to send spi stuff as you like .
I have been trying to use an mBed NPC1768 to program a loose 4mb flash chip. I am not having any success. I believe my code is ok, but maybe I have made a mistake somewhere. The flash chip is a Macronix MX25L3206E. I successfully read the contents from the flash using the mbed, and also got the whole chip to erase, but I cannot get new data in there.
I would like to try and use another programmer. Anyone got one, or any ideas?
--
You received this message because you are subscribed to the Google Groups "Nottingham Hackspace - Nottinghack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nottinghack...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Send me your address
Borrow mine for a while :-)
No problem
:-)
I would suggest adding more decoupling on the chip.
The most common thing to fail on flash devices are the charge pumps responsible for generating the high voltages for write cycles. If that is the case, then replacing the part is the real way forward.
Got your emails BTW :-)
// mosi, miso, sclk
SPI spi(p5, p6, p7);
// setup outputs with identifiers
DigitalOut cs(p18);
DigitalOut wp(p19);
DigitalOut hold(p20);
cs = 0;
hold = 1;
wp = 1;
// open file for reading
FILE *fp = fopen("/local/AWESOME.BIN", "r");
// set write enable (WREN)
spi.write(0x06);
// writing memory page , PageProgram command then three address bytes
cs = 0;
spi.write(0x02);
spi.write(0x31);
spi.write(0x00);
spi.write(0x00);
for (a=0x000; a<0x100; a++){
r = fgetc(fp);
spi.write(r);
}
// write to flash from local file
#include "mbed.h"
// Create the local filesystem under the name "local"
LocalFileSystem local("local");
// mosi, miso, sclk
SPI spi(p5, p6, p7);
// setup outputs with identifiers
DigitalOut cs(p18);
DigitalOut wp(p19);
DigitalOut hold(p20);
Serial pc(USBTX, USBRX);
int main() {
int a = 0;
int r = 0;
// int b = 0x000;
// int c = 0x000;
// Serial speed
pc.baud(230400);
// 8-bit data mode 3 at 1MHz
spi.format(8,3);
spi.frequency(1000000);
// Chip select, Hold off, Write Protect off
cs = 0;
hold = 1;
wp = 1;
wait(0.01);
// open file for reading
FILE *fp = fopen("/local/Z.BIN", "r");
wait(0.1);
// for (c=0x000; c<0x040; b++){
// for (b=0x000; b<0x100; b++){
cs = 1;
wait(0.01);
// set write disable (WRDI)
cs = 0;
spi.write(0x04);
cs = 1;
wait(0.01);
// set write enable (WREN)
cs = 0;
spi.write(0x06);
cs = 1;
wait(0.01);
// writing memory page
cs = 0;
spi.write(0x02);
spi.write(0x00);
spi.write(0x00);
spi.write(0x00);
for (a=0x000; a<0x100; a++){
r = fgetc(fp);
spi.write(r);
// pc.printf("%c", r, " ");
}
cs = 1;
wait(0.01);
// }
// pc.printf("c", " ");
// }
fclose(fp);
// Open file on the local file system for writing
FILE *fpw = fopen("/local/X.BIN", "w");
// reading memory
cs = 0;
spi.write(0x03);
spi.write(0x00);
spi.write(0x00);
spi.write(0x00);
for (a=0x000000; a<0x000100; a++){
r = spi.write(0x00);
fprintf(fpw, "%c", r);
pc.printf("%c", r);
}
cs = 1;
fclose(fpw);
}