Copy from SD to EEPROM
MagIO2
Posts: 2,243
Hi there.
Today I need some help from you. I have a little problem with my development environment. When I have big programs to write to the propeller, it says 'connection lost'. So, as I have the SD card running, my idea was to copy the EEPROM-file from SD to EEPROM using the·femot SD card driver and the basic I2C driver. I already fixed some little mistakes, but it still does not work. It seems to be copied, but when I do a reset nothing happens.
Could it be a problem to have two 32kB EEPROMs in parallel? But they have different adresses. Do you find something in the code?
It's part of a case statement of my CogOS which first makes a hash value out of the command input (·$00006BC0: ' eep )
The load_buffer has 512 longs, because I can load PASM code directly from SD card to COG RAM. I simply use it here again.
par_list is an array of command-line parameters. For strings it's an adress inside the keyboard string-buffer. Numbers are parsed from hex, bin, dec format into binary format and stored there directly.
In theory it should load the complete EEPROM-file in 512 byte pakets and store it in 64 byte pakets (which is the page-size of the EEPROM).
Today I need some help from you. I have a little problem with my development environment. When I have big programs to write to the propeller, it says 'connection lost'. So, as I have the SD card running, my idea was to copy the EEPROM-file from SD to EEPROM using the·femot SD card driver and the basic I2C driver. I already fixed some little mistakes, but it still does not work. It seems to be copied, but when I do a reset nothing happens.
Could it be a problem to have two 32kB EEPROMs in parallel? But they have different adresses. Do you find something in the code?
$00006BC0: ' eep i2c.Initialize(i2c#BootPin) fileName( par_list[noparse][[/noparse]0], @exts ) ' search for the file on SD card found:=sdfat.popen( @fname, "r") ' if the cog-program can be found, use it if found<>-1 sstart:=0 i:=true repeat 64 sdfat.pread(@load_buffer, 512) j:=@load_buffer repeat 8 if i2c.WritePage(i2c#BootPin, i2c#EEPROM, sstart, j, 64) i:=false quit if (sstart//1024) == 0 term.tx( "." ) start_time := cnt ' prepare to check for a timeout repeat while i2c.WriteWait(i2c#BootPin, i2c#EEPROM, sstart) if cnt - start_time > clkfreq / 10 i:=false quit sstart+=64 j+=64 sdfat.pclose if i==true term.tx(13) term.str(@fname) term.str(string(" written.",13)) else term.str(string("Write error [noparse][[/noparse]")) term.dec(i) term.str(string("]!",13)) else fnf
It's part of a case statement of my CogOS which first makes a hash value out of the command input (·$00006BC0: ' eep )
The load_buffer has 512 longs, because I can load PASM code directly from SD card to COG RAM. I simply use it here again.
par_list is an array of command-line parameters. For strings it's an adress inside the keyboard string-buffer. Numbers are parsed from hex, bin, dec format into binary format and stored there directly.
In theory it should load the complete EEPROM-file in 512 byte pakets and store it in 64 byte pakets (which is the page-size of the EEPROM).
Comments
Thank you Mike!
But unfortunately burning the Turbulence demo did not help ... it's not running. Does it need some hardware to be present?
You mentioned 2 EEPROMs on different addresses. Where is the turbulence code located? Does your CogOS get in the way of normal program loading? Do simple programs work when burned to EEPROM (like flashing an LED)? The EEPROM check done by the demo consists of reading the first 2 longs from offset 0 of the boot EEPROM and check it against the RAM copy. But getting there implies that it got past the VGA and audio setup.
Having said that, you could compile from source now and put in appropriate debug code [noparse]:)[/noparse]
Post Edited (kuroneko) : 5/12/2009 4:06:28 AM GMT
The first problem came into my mind last evening .. I'm running my breadboard system with a 10MHz crystal. Wonder if the demo will run if I patch the EEPROM-file to 10 MHz.
The next problem is the VGA ... I thought it will run on a TV.
Oh ... did he Linus post the code already ... cool