voodoofish 35 Posted October 6, 2011 Share Posted October 6, 2011 Posted my code to github for others to pull down and use. It's not clean(I'm still a nube), but it works. currently it just writes to 1 memory location, but can easily be modified for whatever purposes. I still also need to add more functions as I have not completed it...this will be done soon. Thanks to Rickta59 for his post related to the 23k256 ram chip. It helped to look at someone elses code and confirm that mine in fact should have worked...I liked his streamlined code as well...so I may integrate that into the next version. Also thanks to fj604, though he doesn't know it, but his code also was useful and used in part for the timer related code from his max6957 project. As a short description of the problem. I was running into issues with reading the memory after writing to location X. When stepping through, I would get the correct value, but when allowing the code to just run I would get 0 for the read data. I added a timer delay (fj604 code)after the write which gives the chip enough time to wait for the memory to be written. I could have sworn I had tried something similar and it didn't work, but this one did. The timer value will most likely need to be changed based on the the mclk and smclk....so that will be up to the person using this to figure it out. This was run on a G2231 chip running at the base 1mhz. https://github.com/voodoofish/MemoryWriter25AA320A bluehash and Rickta59 2 Quote Link to post Share on other sites
DanAndDusty 62 Posted October 7, 2011 Share Posted October 7, 2011 Hi Voodoo, Coincidence you post this as at the moment Im working on a little "halloween" project with a similar chip (25AA1024). My project has this chip, a DAC, an LDR for triggering the sound and a serial connection (for menu/control and using the Xmodem protocol to upload soundfiles to the EEPROM).. What I do is after a write I read the status register because there is a Write In Process bit. my code is... void EEPROM_writeEnd(void) { /* ********************************************************************************************* * * * * * EEPROM_writeEnd This function simply takes the CS line down low (to commit the * * * data to be written. It then waits until the WIP bit in the * * * Status Register is cleared indicating the write is complete * * * * * ********************************************************************************************* * * PARAMETERS:- None * * ********************************************************************************************* * * RETURNS:- None * * ********************************************************************************************* */ P2OUT |= EEPROM_CS; // De-asserting CS performs the write while((EEPROM_getStatus() & MSK_STAT_WIP) == MSK_STAT_WIP) // Wait until there is no write in progress {} } Just had a look at the datasheet for the 25AA320A and it works the same way. This bit is also set for the Erase instructions.. The Erase Whole Chip instruction in particular can take some time. I have the project working satisfactorily through a PC Speaker amplifier setup, but I want it working through a standard 8 Ohm 0.25W speaker. This morning some LM386 chips arrived in the post. Im hoping to set these setup/debugged this weekend. Then maybe I'll have my 1st project posted up here. Hope this helps.. Dan voodoofish 1 Quote Link to post Share on other sites
voodoofish 35 Posted October 7, 2011 Author Share Posted October 7, 2011 I actually am reading the register...but I am always getting 0x00 for it....and you know what(realizing my fail).....I'm also doing this inside the write block before setting the cs high to end the write..GAHHHHH...what a fail on my part... :| Edit:I'm going to try this when I get home....geeez....I don't believe I did that.... Edit2: Yes this did help....the line right before your code pretty much clicked as to why my read was failing.....(I suspect) Quote Link to post Share on other sites
voodoofish 35 Posted October 7, 2011 Author Share Posted October 7, 2011 Thanks again DanAndDusty, this did in fact work and code working like a charm...I also used the check you have. Quote Link to post Share on other sites
DanAndDusty 62 Posted October 7, 2011 Share Posted October 7, 2011 Cool. Glad I could help. The chips are nice to work with aren't they? I especially like the HOLD line.. Means I can use the SPI pins for connecting to another device and not worry about dropping the CS (which will interrupt/cancel any pending read/write). Very useful when the other SPI device is a DAC that wants 1 byte 44K times a second Dan gatImmusepete and voodoofish 2 Quote Link to post Share on other sites
voodoofish 35 Posted October 7, 2011 Author Share Posted October 7, 2011 I do think these are great chips though I haven't used the hold feature yet, I did however note it. As you can see I've just been trying to get it to work correctly. This is the third type chip that I've worked with so this was a great experience(struggle) in trying to get it to work. I'm finding most of what I've been using doesn't have a lot of info on how to program it so I've been forging a lot of this on my own. It's awesomely frustrating... Quote Link to post Share on other sites
voodoofish 35 Posted October 12, 2011 Author Share Posted October 12, 2011 Just a small update. Modified code to now read ADC10 temp sensor and save the data to the mem chip. Now uses the WD timer using 1000 ms interval time(will add a function to specify time for delay in seconds(x second delay then write))currently this is just using the 1 second delay then writes the temp data to chip. Start of memory write is triggered by pressing the S2 button and goes through full mem capacity(4096 bytes). Currently this eats up 864 bytes and 36 bytes of data....need to trim this down.... next update will add software serial to allow for reading of memory on chip and dumping out to the terminal. This is the board I'm using which would also allow you to add an RTC with battery backup. Quote Link to post Share on other sites
bluehash 1,581 Posted October 12, 2011 Share Posted October 12, 2011 Hmm.. I was browsing LMR and say the same board. you guys are the same? Quote Link to post Share on other sites
DanAndDusty 62 Posted October 12, 2011 Share Posted October 12, 2011 Hmm.. I was browsing LMR and say the same board. you guys are the same? Never heard of LMR. Im not using a board.. Just about all my messing about is on breadboard.. The joys of fiddly wires and all that. I was originally planning using an SDCard to store the samples.. but was my first forray into hardware SPI and it just wasn't working.. I have since got a better grasp of how it all goes together so at some point I think I will return to getting an SDCard working. May have a problem though without a hold line.. Anyone know of a digital/analog switch like the 4066 that I can find cheap (or even sample?) Im a DIP dude through and through and Ihaven't been able to find anything suitable (though Ive only had a few brief searches). Quote Link to post Share on other sites
bluehash 1,581 Posted October 13, 2011 Share Posted October 13, 2011 I was replying to voodoofish: http://letsmakerobots.com/node/29287 gatImmusepete 1 Quote Link to post Share on other sites
voodoofish 35 Posted October 15, 2011 Author Share Posted October 15, 2011 Hmm.. I was browsing LMR and say the same board. you guys are the same? Yep, that would be me. I go by voodoobot there. Quote Link to post Share on other sites
voodoofish 35 Posted October 15, 2011 Author Share Posted October 15, 2011 yes, I'm one of the folks there that promote the msp430...though as you can see by the comment, people have their own unique sense of humor.. Quote Link to post Share on other sites
voodoofish 35 Posted February 5, 2012 Author Share Posted February 5, 2012 schematic for the board. someone was asking on irc so figured I'd post it here. It could look better.... :| bluehash, smooth_penguin, gatImmusepete and 1 other 4 Quote Link to post Share on other sites
gwdeveloper 275 Posted February 9, 2012 Share Posted February 9, 2012 Thanks for posting your schematic. I had found your code on github a while back. Mostly, I read through it to see what was going on and then ported it over to the USCI hardware on the G2553. Are you reading from the 1302 and storing info on the EEPROM? Quote Link to post Share on other sites
voodoofish 35 Posted February 10, 2012 Author Share Posted February 10, 2012 Thanks for posting your schematic. I had found your code on github a while back. Mostly, I read through it to see what was going on and then ported it over to the USCI hardware on the G2553. Are you reading from the 1302 and storing info on the EEPROM? I had planned to record the data from the rtc but never got around to working on it. I still plan to when I can get the time. If you get a chance, I'd love to see the changes to the code to get it to work with the usci module. :thumbup: Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.