Help with a EEPROM boot loader
bambino
Posts: 789
I've been trying to replace this program with a simple hello world app by writting it to the eeprom then rebooting. I've worked out the bugs in my visual basic app and can send 32 bytes at a time to the prop. My problem is no doubt in my use of the I2C object, as I have not used it much.
Could someone look at the code here and see if anything jumps out. I have not made an installer for the vb app so you couldn't test it, but perhaps something is obvious.
Thanks
Could someone look at the code here and see if anything jumps out. I have not made an installer for the vb app so you couldn't test it, but perhaps something is obvious.
Thanks
Comments
It loops through, but I'm still not rebooting into the Hello World app. So it may still be my vb app isn't sending the correct sequence!
Thanks for your time.
Indeed, It does run from ram.
I was just thinking before leaving the shop that I needed to write it to upper 32k, and read back what I'm writting.............. And finding the time to write this code!................. Thanks...I could have reinvented the wheel!
I doubt I would have been reinventing this wheel. Thanks.
Thanks mike, I think this will help me see whats going on now.
I noticed that if the system is under heavy load the download may fail (empty file). This is probably due to a connection timeout. A console window should pop up and show a download countdown.
Here's a cool point: I modified my vb app to stop sending if it didn't get back what it sent. It delays on the first write of 32 bytes and shows that the eeprom has only the first 16 bytes. Does the I2c object require a 64 instead of 32 where it asks for the count paremeter?
Attached is the spin file that writes the EEPROM adapted from Mikes example
Jeff T.
To read the EEPROM I used the same file attached in the Sandbox thread.
I won't have time this morning, but hopefully tonight. It's not looking like my first device will go out with this code in it, but the second will I guess.
I don't know whether this would have an effect on the way my data is being stored or not but if I have the time this evening I will adjust the write loop to 64 bytes . The spin file is a little sloppy but I'm sure you will see whats going on , maybe you can also try the 64 byte page write.
Jeff T.
Edit : BTW the thread sleep pause in the VB loop may or may not be able to be got rid of , it's there for now to slow things down while testing.
So many apps take bin's from an sd card, but woe unto he that attempts it through a serial port. I didn't realize how slow my grasp of this was going to be this week.
Also, I assume a dry run works OK, i.e. receiving data and sending it back without actually programming it? For test purposes you could insert an artificial delay (e.g. 5ms) instead of the program call.
Once this was resolved and I got the test data to write to all 32K of EEPROM memory I played around writing different packet sizes , its possible to do 64 byte packets but I got better results writing 32 byte packets. Finally I tried it with the obligatory "Hello World" program and it worked fine.
The VB app needs a couple of·file dialogs to choose where to save and what to open and generally clean the file selection process up rather than keep it hard coded. It also needs several other cosmetic touches to get it to behave in a more user friendly manner.
Tweak this as you desire and use as and if you wish. I have tried it a few times and it looks good , if there are any problems I can help with let me know
Jeff T.
The PC would compare sent 32, and received 32, then move on or stop if data was the same, respectively
@unsoundcode The last of my parts needed to build a unit are due here today. So many thanks, I was getting nowhere!
That's good though, it will give me a chance to look over your code and find out what I kept running into. And even with a progress bar it loaded fairly quickly.
This would make an excellent object. Everyone is posting for the update from sd card, where as I'm surely not the only one that needs to update serially from a pin other 30, and 31.
Only problem is the vb app. I guess you could post in this thread when your done.
I'll continue to work with you on it, just bear in mind that my finished app will target a PDA. Most everything will still apply though. I doubt I'll be able to transmit faster than 56k though using 2008. Which is a big gripe I have with MS.. 2005 proved, with the help of a CFserial object, that 270k was possible with a PDA. All I had back then was a trial version and ended up with 2008, with limits port speed to a number less than 63768.
The project as a whole is interesting especially the PDA aspect , if it's possible to somehow link your spin object to some small Visual Basic application I may go ahead and ·finish what I started.
Jeff T.
I think I can add the file functions to your app as is though. One thought that I had was to close the serial port when downloads where complete.
This would allow you to turn around and use the new code with say the serial terminal without haveing to shut down the app. Then reopening the port when a button was pushed.
With regard to error checking I had originally thought of downloading the source , then uploading the destination and comparing the two. VB has functions for creating checksums for files , pros .. the code is there ,·cons..·consumes more·time.
I would also appreciate a pointer to the documentation that describes the Propeller programing protocol ( RAM / EEPROM )
Jeff T.
http://forums.parallax.com/showthread.php?p=591445
The idea of writting to certain addresses would not be a big jump from what you have now! increase your buffers from 32 to say 64( out of thin air).
Send your data just as you are now but make the spin code filter out the second set of 32 bytes. Have your arguments for address, offsets, bytes-to-write, etc. encoded into that second set of 32 bytes.
CRC's unfortunately are not within my grasp( other than their purpose). I downloaded some material once and was planning to learn more about what is actually happening during a crc, but wrapping this product up has barely left me time to walk my dog. My plan was to send each packet back for comparison and continue or resend the packet. If speed becomes a problem I thought I might just add the 32·bytes together and send that sum back for comparison. That is what I meant by homebrew crc.
I will not be useing the programming pins, but rather a serial connection with a blutooth radio, so the propeller chip programming protocol is and will remain a dark fog on the horizon for me. Fascinateing what Phil did with the load ram program above. My next project is allready waiting on me so I want have time to follow you down that road if you try to write programs of that nature. If you do, look at what Mike is referring to and the Propellant application in the downloads section. Get them two to talking and the possibilities are many to say the least.
The first thing that strikes me is the possibility of loading our "loader" spin·program to RAM via the VB program thus cutting out the Proptool. Keeping the "loader" would be nice I think because it gives us the additional option of altering·specific EEPROM contents ,·on the fly if need be. I am lost with the explanation of how and where to write those bytes but I will make up.
Downloading and uploading the same file then using a file checksum to compare the two seems like it would work pretty well .
My set back is time just as it is with yourself·, I check the forums throughout the day but being able to sit and program for fun for 2 or 3 hours is very rare .
As soon as I have something worth showing I will post it here .
later
Jeff T.
·
I still have features that I would like to include for my own preferences and that is why I have extra room on the main form. If you decide to check it out and feel it suits your needs let me know.
To get up and running put the Propellent dll in the system directory and run the setup file contained in the zip.
Jeff T.
Whilst I can not add anything to the help you are offereing here, I would be interested in seeing how you have used Propellent.dll from within VB.Net I do recall looking at this quite some time ago but found problems and gave up after a few hours.
I think would make an excellent tutorial for many people.
Thank-you for any light you can throw on this.
Regards
Mike.
I placed the instruction FinalizeDLL() in the Form closing event and though it maybe overkill I also included the garbage collection instruction GC.Collect.
I only needed 5 of the library functions so they are the only ones I tried and tested , I attach an Open Office document with the declarations and usage.
Also an image of an app I used the library with that I called Prop Remote for off site downloads , if that name is in use I may have to rethink.
Jeff T.